import{c as a,r as e,H as l,v as t,x as s,e as u,B as n,y as r,Q as o,z as m,C as d,D as i,F as v,b0 as c,I as p,aC as w,U as f,al as h,G as y,N as b,ak as _}from"./base-lib.js?v=1761009159";import{B as x}from"./index115.js?v=1761009159";import{u as g,P as V,aC as C,b as j}from"./utils-lib.js?v=1761009159";import{getFileBody as B,getErrorConfig as k,setErrorConfig as S}from"./site.js?v=1761009159";import{S as U}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";const z={class:"flex flex-col"},D={class:"flex items-center justify-between mb-[8px]"},G={key:0},q={class:"h-[44rem] w-full"},F=a({__name:"default-page",setup(a,{expose:F}){const{saveFileEvent:H}=U(),E=j(),{plugin:I}=g(),{webserver:N}=I.value,K=e("/www/server/panel/data/defaultDoc.html"),P=e(""),Q=e(),R=e("utf-8"),A=e(["utf-8","GBK","GB2312","BIG5"]),J=e(!1),L=e(!1),M=async()=>{try{L.value=!0;const{data:a}=await B({path:K.value});P.value=a.data,R.value=a.encoding||"utf-8",L.value=!1}catch(a){}},O=async a=>{try{L.value=!0,K.value=a,await M(),"/www/server/panel/data/404.html"===a&&T(),L.value=!1}catch(e){}finally{L.value=!1}},T=async()=>{const{status:a}=await V({request:k(),data:{status:String}});J.value=Boolean(Number(a))},W=a=>{V({loading:"正在设置，请稍后...",request:S({status:a?1:0}),message:!0})},X=async()=>{const a=await H({path:K.value,data:P.value,encoding:R.value});E.request(a)};return F({onRefresh:()=>{K.value="/www/server/panel/data/defaultDoc.html",M()}}),(a,e)=>{const g=w,V=C,j=f,B=_,k=h,S=x,U=y,F=l("bt-loading");return t(),s("div",z,[u(V,{type:"card",modelValue:r(K),"onUpdate:modelValue":e[0]||(e[0]=a=>o(K)?K.value=a:null),onChange:O},{default:n(()=>[u(g,{label:"新建网站默认页面",name:"/www/server/panel/data/defaultDoc.html"}),u(g,{label:"404错误页",name:"/www/server/panel/data/404.html",lazy:!0}),u(g,{label:"网站不存在页",name:"/www/server/"+r(N)+"/"+("nginx"===r(N)?"html":"htdocs")+"/index.html",lazy:!0},null,8,["name"]),u(g,{label:"网站停用后的提示页",name:"/www/server/stop/index.html",lazy:!0})]),_:1},8,["modelValue"]),m("div",D,["/www/server/panel/data/404.html"===r(K)?(t(),s("div",G,[u(j,{modelValue:r(J),"onUpdate:modelValue":e[1]||(e[1]=a=>o(J)?J.value=a:null),onChange:W},{default:n(()=>e[4]||(e[4]=[d("开启404错误页设置",-1)])),_:1,__:[4]},8,["modelValue"])])):i("",!0),e[5]||(e[5]=d(" 提示：Ctrl+F 搜索关键字，Ctrl+S 保存，Ctrl+H 查找替换 ",-1)),u(k,{class:"!w-[16rem]",modelValue:r(R),"onUpdate:modelValue":e[2]||(e[2]=a=>o(R)?R.value=a:null),onChange:X},{default:n(()=>[(t(!0),s(v,null,c(r(A),a=>(t(),b(B,{key:a,value:a,label:a},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),p((t(),s("div",q,[u(S,{ref_key:"aceEditor",ref:Q,"file-path":r(K),modelValue:r(P),"onUpdate:modelValue":e[3]||(e[3]=a=>o(P)?P.value=a:null),onSave:X,class:"h-[40rem] w-full"},null,8,["file-path","modelValue"]),u(U,{class:"flex !mt-[12px]",type:"primary",onClick:X},{default:n(()=>e[6]||(e[6]=[d("保存",-1)])),_:1,__:[6]})])),[[F,r(L)]])])}}});export{F as default};
