import{B as e,e as a,b as t,aK as s}from"./utils-lib.js?v=1761009159";import{c as l,r,w as i,q as n,a6 as o,H as u,I as c,y as p,v as d,x as v,z as m,D as y,C as f,e as x,Q as _,B as g,G as h}from"./base-lib.js?v=1761009159";import{B as b}from"./index115.js?v=1761009159";import{_ as j}from"./index.vue_vue_type_script_setup_true_lang5.js?v=1761009159";import{saveFileBody as k,getJavaProjectConfigList as w,getFileBody as C}from"./site.js?v=1761009159";import{u as S,S as T}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";const B={class:"h-full relative"},H={key:0,class:"bg-darkTertiary flex items-center justify-center h-[72rem]"},V={key:1},q={class:"inline-block text-secondary items-center flex"},D={class:"max-w-[55rem] truncate leading-[1.3] inline-block"},I={class:"my-12px"},L={key:0,class:"flex"},O={key:2,class:"bg-darkTertiary flex items-center justify-center h-[72rem]"},U={class:"bg-white px-48px py-16px text-default flex items-center"},z=l({__name:"index",props:{compData:{default:()=>({})}},setup(l,{expose:z}){const{siteInfo:E}=S(),{jumpTabEvent:G}=T(),K=t(),M=r(!1),Q=r(""),A=r(!1),F=r({}),J=r(""),N=r(!1),P=r(""),R=async e=>{if(A.value)try{if(e.data)return J.value=e.data;N.value=!0;const{data:a}=await C({path:e.path});J.value=a.data,N.value=!1}catch(a){s(a),J.value=""}finally{N.value=!1}},W=async()=>{let e=K.load("正在保存内容，请稍候...");try{const e=await k({data:J.value,encoding:"utf-8",path:F.value.path});K.msg({dangerouslyUseHTMLString:!0,message:"<div>".concat(e.msg,"</div>"),type:e.status?"success":"error",duration:e.status?2e3:0,showClose:!e.status,customClass:"!max-w-[70rem]"})}catch(a){}finally{e.close()}};i(()=>E.value,e=>{var a;(null==(a=E.value.project_config)?void 0:a.bind_extranet)&&(A.value=!!E.value.project_config.bind_extranet)},{immediate:!0});const X=async()=>{let e=E.value.project_type.toLowerCase();P.value=e,A.value=!0,(async()=>{try{M.value=!0;const{data:e}=await w({project_name:E.value.name});if(!e.status)return void K.error(e.msg);F.value=e.data.find(e=>"伪静态配置文件"===e.name),F.value&&(Q.value=F.value.path,R(F.value))}catch(e){s(e)}finally{M.value=!1}})()};return n(X),z({init:X}),o(()=>{F.value={}}),(t,s)=>{var l,r;const i=b,n=h,o=a,k=u("bt-loading");return c((d(),v("div",B,[(null==(l=p(F))?void 0:l.path)?y("",!0):(d(),v("div",H,s[3]||(s[3]=[m("div",{class:"bg-white px-48px py-16px text-default"},"暂无配置文件",-1)]))),p(A)&&(null==(r=p(F))?void 0:r.path)?(d(),v("div",V,[m("span",q,[s[4]||(s[4]=f(" 文件位置： ",-1)),m("div",D,[x(j,{text:p(F).path},null,8,["text"])]),m("span",{class:"ml-[2rem] svgtofont-el-document-copy cursor-pointer",onClick:s[0]||(s[0]=a=>p(e)({value:p(F).path}))})]),m("div",I,[c(x(i,{class:"!h-[54rem] !w-[64rem] border border-dark rounded-base",modelValue:p(J),"onUpdate:modelValue":s[1]||(s[1]=e=>_(J)?J.value=e:null),request:!1,onSave:W,editorOption:{readonly:"spring"===p(F).type}},null,8,["modelValue","editorOption"]),[[k,p(N)]])]),"spring"!==p(F).type?(d(),v("div",L,[x(n,{type:"primary",onClick:W},{default:g(()=>s[5]||(s[5]=[f("保存",-1)])),_:1,__:[5]})])):y("",!0)])):(d(),v("div",O,[m("div",U,[s[7]||(s[7]=f("请开启 ",-1)),x(o,{onClick:s[2]||(s[2]=e=>p(G)("mapping"))},{default:g(()=>s[6]||(s[6]=[f("外网映射",-1)])),_:1,__:[6]}),s[8]||(s[8]=f(" 后查看配置信息",-1))])]))])),[[k,p(M)],[k,"正在加载配置文件，请稍后...","title"]])}}});export{z as default};
