import{c as e,r as a,q as l,H as t,v as s,x as o,e as u,B as n,y as r,Q as d,z as i,C as m,D as p,F as c,b0 as v,N as f,I as _,aC as j,az as y,U as b,ak as x,al as g,G as h}from"./base-lib.js?v=1761009159";import{B as C}from"./index115.js?v=1761009159";import{jJ as V,P as w,jK as B,jL as k,aC as q,b as z}from"./utils-lib.js?v=1761009159";import{p as U}from"./useController4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./useController5.js?v=1761009159";import"./site.js?v=1761009159";import"./useStore4.js?v=1761009159";import"./useController6.js?v=1761009159";import"./useMethod5.js?v=1761009159";const G={class:"flex flex-col"},H={class:"flex items-center justify-between mb-[8px]"},E={key:0},F={class:"h-[44rem] w-full"},I=e({__name:"default-page",setup(e,{expose:I}){const K=z(),O=a("index"),S=a(""),D=a(),J=a("utf-8"),L=a(["utf-8","GBK","GB2312","BIG5"]),M=a(!1),N=a(!1),P=async()=>{try{N.value=!0;const{data:e}=await V({default_type:O.value});S.value=e.data[O.value].data,J.value=e.data[O.value].encoding||"utf-8","404"===O.value&&(M.value=Boolean(e.data.auto_create_404)),N.value=!1}catch(e){}},Q=async e=>{N.value=!0,O.value=e,await P(),N.value=!1},R=e=>{w({loading:"正在设置，请稍后...",request:B({auto_create:e?"1":"0"}),message:!0})},A=async()=>{const e=await k({default_type:O.value,default_body:S.value,encoding:J.value});K.request(e)};return l(()=>{P()}),I({onRefresh:()=>{O.value="index",P()}}),(e,a)=>{const l=j,V=q,w=y,B=b,k=x,z=g,I=C,K=h,P=t("bt-loading");return s(),o("div",G,[u(V,{type:"card",modelValue:r(O),"onUpdate:modelValue":a[0]||(a[0]=e=>d(O)?O.value=e:null),onChange:Q},{default:n(()=>[u(l,{label:"新建网站默认页面",name:"index"}),u(l,{label:"404错误页",name:"404",lazy:!0}),u(l,{label:"网站不存在页",name:"not_found",lazy:!0}),u(l,{label:"网站停用后的提示页",name:"stop",lazy:!0})]),_:1},8,["modelValue"]),u(w,{placement:"top",width:"320","popper-class":"white-popover",trigger:"hover",content:"创建网站时会使用页面模板，不会影响已经存在的网站"},{reference:n(()=>a[4]||(a[4]=[i("i",{class:"absolute right-[2rem] top-[2.4rem] svgtofont-el-question-filled text-warning !text-medium"},null,-1)])),_:1}),i("div",H,["404"===r(O)?(s(),o("div",E,[u(B,{modelValue:r(M),"onUpdate:modelValue":a[1]||(a[1]=e=>d(M)?M.value=e:null),onChange:R},{default:n(()=>a[5]||(a[5]=[m("创建网站时自动创建404.html页面",-1)])),_:1,__:[5]},8,["modelValue"])])):p("",!0),a[6]||(a[6]=m(" 提示：Ctrl+F 搜索关键字，Ctrl+S 保存，Ctrl+H 查找替换 ",-1)),u(z,{class:"!w-[16rem]",modelValue:r(J),"onUpdate:modelValue":a[2]||(a[2]=e=>d(J)?J.value=e:null),onChange:A},{default:n(()=>[(s(!0),o(c,null,v(r(L),e=>(s(),f(k,{key:e,value:e,label:e},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_((s(),o("div",F,[u(I,{ref_key:"aceEditor",ref:D,"is-request":!1,modelValue:r(S),"onUpdate:modelValue":a[3]||(a[3]=e=>d(S)?S.value=e:null),editorOption:r(U)(),saveEvent:A,class:"h-[40rem] w-full"},null,8,["modelValue","editorOption"]),u(K,{class:"flex !mt-[12px]",type:"primary",onClick:A},{default:n(()=>a[7]||(a[7]=[m("保存",-1)])),_:1,__:[7]})])),[[P,r(N)]])])}}});export{I as default};
