import{_ as e}from"./index.vue_vue_type_script_setup_true_lang10.js?v=20260328163632";import{u as a,l as s,K as l,t,v as u,L as n,x as i}from"./utils-lib.js?v=20260328163632";import{B as o}from"./index158.js?v=20260328163632";import{aY as r,aZ as p,a_ as m,V as v}from"./site.js?v=20260328163632";import{u as d}from"./store4.js?v=20260328163632";import{n as c,B as f,au as y}from"./naive-ui.js?v=20260328163632";import{k as x,a9 as b,r as h,o as g,U as _,V as w,W as j,X as k,Y as V,l as C,O as I,N as q,a1 as E,a3 as U,j as B,Z as F,_ as N,F as A}from"./base-lib.js?v=20260328163632";const D={class:"h-660px"},K={key:0},S={key:0,class:"flex items-center justify-between"},T={class:"my-[12px]"},W={key:1,class:"bg-[var(--bg-color-79)] flex items-center justify-center h-full",style:{"min-height":"600px"}},Y={class:"bg-white px-[48px] py-[16px] text-[var(--text-color-1)] flex"},Z=x({__name:"index",setup(x,{expose:Z}){const{plugin:G,panel:L,getGlobalInfo:O,isIIS:R}=a(),{paths:X}=b(L.value),{webserver:z}=b(G.value),{getFileEvent:H}=a(),{siteInfo:J,siteType:M,isBindExtranet:P,jumpTabEvent:Q}=d(),$=h(!1),ee=h(!1),ae=h(""),se=h("0."+s("当前")),le=h([]),te=[{content:s("请选择您的应用，若设置伪静态后，网站无法正常访问，请尝试设置回default")},{content:s("您可以对伪静态规则进行修改，修改完后保存即可。")}],ue=e=>{let a=X.value.panel+"/rewrite/".concat(z.value,"/").concat(e,".conf");ne({filename:"0.当前"===e?"":a})},ne=async e=>{try{if(ee.value=!0,null==e?void 0:e.filename){const{data:a,msg:s}=await H({filename:e.filename});ae.value=a||s}else{const e=await r({siteid:J.value.id});ae.value=e.data.data}ee.value=!1}catch(a){ee.value=!1}},ie=async()=>{i({loading:ee,request:v(),data:Array,success:e=>{le.value=e.map((e=>({label:e,value:e})))}})},oe=async()=>{i({loading:s("正在保存，请稍后..."),request:p({siteid:J.value.id,body:ae.value}),message:!0,success:e=>{e.status&&(se.value="0."+s("当前"),ne())}})},re=h({formAttrs:{labelWidth:"100px"},formItems:[{label:s("模板名称"),ruleKey:"name",rules:[l({message:s("请输入模板名称")})],children:[{type:"input",key:"name",attrs:{placeholder:s("请输入模板名称")}}]}]}),[pe,me,ve]=t(re),de=()=>{me.value.name="",$.value=!0},ce=async()=>{await ve.value.validate(),i({loading:s("正在保存，请稍后..."),request:m({name:me.value.name,body:ae.value}),message:!0,success:e=>{e.status&&($.value=!1,ie())}})},fe=async()=>{var e;if(!Number(null==(e=J.value)?void 0:e.status)&&R.value&&"php"===M.value)return;await O();["php","proxy","html"].includes(M.value)&&(P.value=!0),await ie(),P.value&&await ne()};return g(fe),Z({init:fe}),(a,l)=>{const t=c,i=f,r=y,p=_("bt-loading");return w(),j(A,null,[k("div",D,[V(P)?C((w(),j("div",K,[["php","proxy","phpasync"].includes(V(M))?(w(),j("div",S,[I(t,{class:"!w-[15rem]",value:V(se),"onUpdate:value":[l[0]||(l[0]=e=>q(se)?se.value=e:null),ue],options:V(le)},null,8,["value","options"])])):E("",!0),k("div",T,[I(V(o),{id:"staticContentRef",request:!1,class:"!h-[400px] !w-full border border-[#DCDFE6] rounded-[4px]",modelValue:V(ae),"onUpdate:modelValue":l[1]||(l[1]=e=>q(ae)?ae.value=e:null),onSave:l[2]||(l[2]=e=>oe())},null,8,["modelValue"])]),I(r,null,{default:U((()=>[I(i,{type:"primary",onClick:l[3]||(l[3]=e=>oe())},{default:U((()=>[B(F(V(s)("保存")),1)])),_:1}),["php","proxy"].includes(V(M))?(w(),N(i,{key:0,onClick:de},{default:U((()=>[B(F(V(s)("另存为模板")),1)])),_:1})):E("",!0)])),_:1}),I(V(u),{options:te,class:"ml-[20px] !mt-[20px]"})])),[[p,V(ee)],[p,V(s)("正在加载内容，请稍候..."),"title"]]):(w(),j("div",W,[k("div",Y,[B(F(V(s)("请开启"))+" ",1),k("span",{class:"mx-[.4rem] bt-link",onClick:l[4]||(l[4]=e=>V(Q)("mapping"))},F(V(s)("外网映射")),1),B(" "+F(V(s)("后查看配置信息")),1)])])),I(V(n),{title:V(s)("另存为模板"),modelValue:V($),"onUpdate:modelValue":l[5]||(l[5]=e=>q($)?$.value=e:null),area:420,"show-footer":"",onConfirm:ce},{default:U((()=>[I(V(pe),{class:"p-20px"})])),_:1},8,["title","modelValue"])]),!Number(V(J).status)&&V(R)&&"php"===V(M)?(w(),N(e,{key:0})):E("",!0)],64)}}});export{Z as _};
