import{P as a,aC as e,e as s,$ as l,b as t}from"./utils-lib.js?v=1761009159";import{c as n,r as o,g as u,q as r,H as i,I as m,y as d,v as c,x as p,e as v,Q as f,z as y,C as g,B as _,D as b,G as j}from"./base-lib.js?v=1761009159";import{B as x}from"./index115.js?v=1761009159";import{u as h,S as C}from"./useStore4.js?v=1761009159";import{getConfigFile as w}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";const V={class:"flex items-center justify-between my-[4px]"},k={key:0,class:"flex items-center"},S={class:"my-[12px]"},H=n({__name:"index",setup(n){const H=t(),{siteInfo:q}=h(),{getFileEvent:E,saveFileEvent:F}=C(),U=o(!1),z=o(!1),B=o(""),I=o([]),T=o(""),A=[{content:"此处为站点主配置文件,若您不了解配置规则,请勿随意修改."}],D=u(()=>I.value.find(a=>a.type===B.value)),G=async()=>{const a=await F({path:B.value,data:T.value,encoding:"utf-8"});H.msg({dangerouslyUseHTMLString:!0,message:a.msg,type:a.status?"success":"error",duration:a.status?2e3:0}),a.status&&L()},L=async(a=B.value)=>{z.value=!0;const e=await E({path:a});T.value=e.data.data,z.value=!1},M=a=>{B.value=a,L()};return r(()=>{a({loading:U,request:w({sitename:q.value.name}),success:a=>{I.value=[],Object.keys(a.data).forEach(e=>{I.value.push({label:e,lazy:!0,name:a.data[e],render:()=>v("span",null,null)})}),B.value=I.value[0].name,L()}})}),(a,t)=>{var n;const o=e,u=s,r=x,h=j,C=l,w=i("bt-loading");return m((c(),p("div",null,[v(o,{type:"card",modelValue:d(B),"onUpdate:modelValue":t[0]||(t[0]=a=>f(B)?B.value=a:null),options:d(I),onChange:M},null,8,["modelValue","options"]),y("div",V,[t[5]||(t[5]=y("span",{class:"text-secondary"},"提示：Ctrl+F 搜索关键字，Ctrl+S 保存，Ctrl+H 查找替换",-1)),"伪静态配置文件"===(null==(n=d(D))?void 0:n.label)?(c(),p("span",k,[t[4]||(t[4]=g("规则转换工具： ",-1)),v(u,{href:"https://www.bt.cn/Tools",target:"_blank"},{default:_(()=>t[3]||(t[3]=[g("Apache转Nginx ",-1),y("i",{class:"svgtofont-el-link"},null,-1)])),_:1,__:[3]})])):b("",!0)]),y("div",S,[m(v(r,{class:"!h-[40rem] rounded-base",modelValue:d(T),"onUpdate:modelValue":t[1]||(t[1]=a=>f(T)?T.value=a:null),id:"configContent",request:!1,onSave:G},null,8,["modelValue"]),[[w,d(z)]])]),v(h,{type:"primary",onClick:t[2]||(t[2]=a=>G())},{default:_(()=>t[6]||(t[6]=[g("保存",-1)])),_:1,__:[6]}),v(C,{options:A,class:"ml-2rem"})])),[[w,d(U)]])}}});export{H as default};
