import{P as D,_ as F}from"./util-82232e37.js";import{d as T,r as t,f as j,u as z,x as A,a as e,o as v,j as V,w as u,i as c,c as B,A as C,F as K,P as L,l as M,dK as q,_ as E,d3 as G,aR as H,ah as J}from"./index-6d906b8a.js";import{g as N}from"./template-e0bc2a0d.js";import{u as O}from"./page-983e3110.js";import{u as Q}from"./tagsView-e2746912.js";import{u as W}from"./useMessage-cb0d0c75.js";import"./Dialog-7d76582a.js";import"./_plugin-vue_export-helper-1b428a4d.js";import"./Qrcode-3c3f024c.js";import"./el-text-7d7615f3.js";import"./IFrame.vue_vue_type_script_setup_true_lang-d0abbb76.js";import"./el-card-dcb0121c.js";import"./vuedraggable.umd-f8121945.js";import"./el-collapse-item-ee2828c3.js";const f="diy_page_index",X=T({name:"DiyTemplateDecorate",__name:"decorate",setup(Y){const a=t(0),m=j([{name:"\u9996\u9875",icon:"ep:home-filled"}]),g=W(),i=t(!1),l=t(),w=t(),r=t(),y=t(""),h=t([]),_=()=>{h.value=D,r.value=l.value.pages.find(n=>n.name===m[a.value].name)},x=async()=>{if(w){i.value=!0;try{await O(e(r)),g.success("\u4FDD\u5B58\u6210\u529F")}finally{i.value=!1}}},k=()=>I(),I=()=>sessionStorage.setItem(f,`${a.value}`),{currentRoute:p}=z(),{delView:S}=Q();return A(async()=>{var n;if(l.value={id:void 0,name:"",used:!1,usedTime:void 0,remark:"",previewPicUrls:[],property:"",pages:[]},(n=w.value)==null||n.resetFields(),!p.value.params.id)return g.warning("\u53C2\u6570\u9519\u8BEF\uFF0C\u9875\u9762\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01"),void S(e(p));await(async o=>{i.value=!0;try{l.value=await N(o),r.value=l.value;const d="https://letcgo.com";y.value=`${d}/#/pages/index/index?templateId=${l.value.id}`}finally{i.value=!1}})(p.value.params.id),(()=>{const o=q(sessionStorage.getItem(f))||0;sessionStorage.removeItem(f),o!==a.value&&(a.value=o),_()})()}),(n,o)=>{const d=E,P=G,R=H,U=J,$=F;return e(l)&&!e(i)?(v(),V($,{key:0,modelValue:e(r).property,"onUpdate:modelValue":o[1]||(o[1]=s=>e(r).property=s),title:e(m)[e(a)].name,libs:e(h),"show-page-config":e(a)===0,"show-tab-bar":e(a)!==0,"show-navigation-bar":e(a)!==0,"preview-url":e(y),onSave:x,onReset:k},{toolBarLeft:u(()=>[c(U,{modelValue:e(a),"onUpdate:modelValue":o[0]||(o[0]=s=>L(a)?a.value=s:null),class:"h-full!",onChange:_},{default:u(()=>[(v(!0),B(K,null,C(e(m),(s,b)=>(v(),V(R,{key:b,content:s.name},{default:u(()=>[c(P,{label:b},{default:u(()=>[c(d,{icon:s.icon,size:24},null,8,["icon"])]),_:2},1032,["label"])]),_:2},1032,["content"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","title","libs","show-page-config","show-tab-bar","show-navigation-bar","preview-url"])):M("",!0)}}});export{X as default};