import{F as b}from"./link-UF1gGYGD.js";import{C as u,a4 as V,i as n,a2 as w,M as v,aA as F,u as M,q as D}from"./app-JmgyQoR0.js";import{F as N}from"./section-yxO0GkeZ.js";import{M as p}from"./MkKeyValue-qNXtpS4q.js";import{b as S,a as A,c as y,h as m,t as _,l as r,j as s,K as a,E as t,z as l,F as P,G as E,u as d,i as K,H as L,n as g}from"./vue-y3KLWBaS.js";const R={class:"_formRoot"},T=d("i",{class:"ph-download-simple ph-bold ph-lg"},null,-1),U={style:{display:"flex"}},$={style:{"margin-left":"auto"}},j={style:{display:"flex",gap:"var(--margin)","flex-wrap":"wrap"}},q=d("i",{class:"ph-gear-six ph-bold ph-lg"},null,-1),z=d("i",{class:"ph-trash ph-bold ph-lg"},null,-1),W=S({__name:"plugin",setup(G){const h=A(u.get("plugins"));function x(o){u.set("plugins",h.value.filter(i=>i.id!==o.id)),F(),g(()=>{M()})}async function B(o){const i=o.config;for(const f in o.configData)i[f].default=o.configData[f];const{canceled:e,result:c}=await D(o.name,i);if(e)return;const k=u.get("plugins");k.find(f=>f.id===o.id).configData=c,u.set("plugins",k),g(()=>{location.reload()})}function C(o,i){const e=u.get("plugins");e.find(c=>c.id===o.id).active=i,u.set("plugins",e),g(()=>{location.reload()})}return y(()=>[]),y(()=>[]),V({title:n.ts.plugins,icon:"ph-plug ph-bold ph-lg"}),(o,i)=>(m(),_("div",R,[r(b,{to:"/settings/plugin/install"},{icon:s(()=>[T]),default:s(()=>[a(t(l(n).ts._plugin.install),1)]),_:1}),r(N,null,{label:s(()=>[a(t(l(n).ts.manage),1)]),default:s(()=>[(m(!0),_(P,null,E(h.value,e=>(m(),_("div",{key:e.id,class:"_formBlock _panel",style:{padding:"20px"}},[d("span",U,[d("b",null,t(e.name),1),d("span",$,"v"+t(e.version),1)]),r(w,{class:"_formBlock","model-value":e.active,"onUpdate:modelValue":c=>C(e,c)},{default:s(()=>[a(t(l(n).ts.makeActive),1)]),_:2},1032,["model-value","onUpdate:modelValue"]),r(p,{class:"_formBlock"},{key:s(()=>[a(t(l(n).ts.author),1)]),value:s(()=>[a(t(e.author),1)]),_:2},1024),r(p,{class:"_formBlock"},{key:s(()=>[a(t(l(n).ts.description),1)]),value:s(()=>[a(t(e.description),1)]),_:2},1024),r(p,{class:"_formBlock"},{key:s(()=>[a(t(l(n).ts.permission),1)]),value:s(()=>[a(t(e.permission),1)]),_:2},1024),d("div",j,[e.config?(m(),K(v,{key:0,inline:"",onClick:c=>B(e)},{default:s(()=>[q,a(" "+t(l(n).ts.settings),1)]),_:2},1032,["onClick"])):L("",!0),r(v,{inline:"",danger:"",onClick:c=>x(e)},{default:s(()=>[z,a(" "+t(l(n).ts.uninstall),1)]),_:2},1032,["onClick"])])]))),128))]),_:1})]))}});export{W as default};
