import{J as w}from"./index-UcVXCjOs.js";import{bf as S,a4 as x,i as a,a7 as z,a5 as E,a6 as g,M as F,az as I,aA as y}from"./app-JmgyQoR0.js";import{g as J,r as R}from"./theme-store-0-WTQMQ_.js";import{b as $,a as T,c as m,h as o,t as d,l as _,j as u,K as c,E as s,z as l,u as p,F as f,G as B,i as C,H as k}from"./vue-y3KLWBaS.js";const j={class:"_formRoot"},A=["label"],D=["value"],G=["label"],H=["value"],K=p("i",{class:"ph-trash ph-bold ph-lg"},null,-1),Q=$({__name:"theme.manage",setup(L){const v=T(J()),h=S(),r=T(null),V=m(()=>[...v.value,...h.value]),t=m(()=>r.value==null?null:V.value.find(n=>n.id===r.value)),b=m(()=>t.value==null?null:w.stringify(t.value,null,"	"));async function M(){var n;await I((n=b.value)!=null?n:""),await y()}function N(){R(t.value),v.value=v.value.filter(n=>n.id!==r.value),r.value=null,y()}return m(()=>[]),m(()=>[]),x({title:a.ts._theme.manage,icon:"ph-folder-notch-open ph-bold ph-lg"}),(n,i)=>(o(),d("div",j,[_(z,{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=e=>r.value=e),class:"_formBlock"},{label:u(()=>[c(s(l(a).ts.theme),1)]),default:u(()=>[p("optgroup",{label:l(a).ts._theme.installedThemes},[(o(!0),d(f,null,B(v.value,e=>(o(),d("option",{key:e.id,value:e.id},s(e.name),9,D))),128))],8,A),p("optgroup",{label:l(a).ts._theme.builtinThemes},[(o(!0),d(f,null,B(l(h),e=>(o(),d("option",{key:e.id,value:e.id},s(e.name),9,H))),128))],8,G)]),_:1},8,["modelValue"]),t.value?(o(),d(f,{key:0},[_(E,{readonly:"","model-value":t.value.author,class:"_formBlock"},{label:u(()=>[c(s(l(a).ts.author),1)]),_:1},8,["model-value"]),t.value.desc?(o(),C(g,{key:0,readonly:"","model-value":t.value.desc,class:"_formBlock"},{label:u(()=>[c(s(l(a).ts._theme.description),1)]),_:1},8,["model-value"])):k("",!0),_(g,{readonly:"",tall:"","model-value":b.value,class:"_formBlock"},{label:u(()=>[c(s(l(a).ts._theme.code),1)]),caption:u(()=>[p("button",{class:"_textButton",onClick:i[1]||(i[1]=e=>M())},s(l(a).ts.copy),1)]),_:1},8,["model-value"]),l(h).some(e=>e.id==t.value.id)?k("",!0):(o(),C(F,{key:1,class:"_formBlock",danger:"",onClick:i[2]||(i[2]=e=>N())},{default:u(()=>[K,c(" "+s(l(a).ts.uninstall),1)]),_:1}))],64)):k("",!0)]))}});export{Q as default};
