var z=Object.defineProperty;var l=(h,f)=>z(h,"name",{value:f,configurable:!0});import{s as D,u as P}from"./vendor-vue-CXt3ZZQ3.js";import{q as E,s as x}from"./vendor-primevue-B6rcS73U.js";import{e as M,f as O,M as G,ds as H,_ as C,dp as J,bn as K}from"./index-2-qFLlQP.js";import{u as Q}from"./serverConfigStore-trwJaF_M.js";import{bx as W,w as b,df as X,j as m,d as t,k as a,c as u,F as y,y as _,by as o,q as S,e as r,u as n,z as p,A as V}from"./vendor-other-CSX7WseZ.js";import"./vendor-xterm-CWYFmgbN.js";import"./vendor-three-BKWXAgVe.js";import"./vendor-tiptap-BkFTmTb3.js";const Y={class:"flex flex-col gap-2"},Z={class:"flex justify-end gap-2"},ee={class:"flex items-center justify-between"},fe=W({__name:"ServerConfigPanel",setup(h){const f=M(),k=Q(),$=O(),{serverConfigsByCategory:A,serverConfigValues:T,launchArgs:B,commandLineArgs:v,modifiedConfigs:g}=D(k);let w=!1;const I=l(()=>{k.revertChanges()},"revertChanges"),j=l(async()=>{w=!0,await K().restartApp()},"restartApp");b(B,async e=>{await f.set("Comfy.Server.LaunchArgs",e)}),b(T,async e=>{await f.set("Comfy.Server.ServerConfigValues",e)});const{copyToClipboard:q}=G(),L=l(async()=>{await q(v.value)},"copyCommandLineArgs"),{t:d}=P();X(()=>{w||g.value.length!==0&&$.add({severity:"warn",summary:d("serverConfig.restartRequiredToastSummary"),detail:d("serverConfig.restartRequiredToastDetail"),life:1e4})});const N=l(e=>({...e,name:d(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?d(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0}),"translateItem");return(e,c)=>(t(),m(J,{value:"Server-Config",class:"server-config-panel"},{header:a(()=>[r("div",Y,[o(g).length>0?(t(),m(o(x),{key:0,severity:"info","pt:text":"w-full"},{default:a(()=>[r("p",null,n(e.$t("serverConfig.modifiedConfigs")),1),r("ul",null,[(t(!0),u(y,null,_(o(g),s=>(t(),u("li",{key:s.id},n(s.name)+": "+n(s.initialValue)+" → "+n(s.value),1))),128))]),r("div",Z,[p(C,{variant:"secondary",onClick:I},{default:a(()=>[V(n(e.$t("serverConfig.revertChanges")),1)]),_:1}),p(C,{variant:"destructive",onClick:j},{default:a(()=>[V(n(e.$t("serverConfig.restart")),1)]),_:1})])]),_:1})):S("",!0),o(v)?(t(),m(o(x),{key:1,severity:"secondary","pt:text":"w-full"},{icon:a(()=>c[0]||(c[0]=[r("i",{class:"icon-[lucide--terminal] text-xl font-bold"},null,-1)])),default:a(()=>[r("div",ee,[r("p",null,n(o(v)),1),p(C,{size:"icon",variant:"muted-textonly",onClick:L},{default:a(()=>c[1]||(c[1]=[r("i",{class:"pi pi-clipboard"},null,-1)])),_:1})])]),_:1})):S("",!0)])]),default:a(()=>[(t(!0),u(y,null,_(Object.entries(o(A)),([s,F],R)=>(t(),u("div",{key:s},[R>0?(t(),m(o(E),{key:0})):S("",!0),r("h3",null,n(e.$t(`serverConfigCategories.${s}`,s)),1),(t(!0),u(y,null,_(F,i=>(t(),u("div",{key:i.name,class:"mb-4"},[p(H,{id:i.id,"form-value":i.value,"onUpdate:formValue":l(U=>i.value=U,"onUpdate:formValue"),item:N(i),"label-class":{"text-highlight":i.initialValue!==i.value}},null,8,["id","form-value","onUpdate:formValue","item","label-class"])]))),128))]))),128))]),_:1}))}});export{fe as default};
//# sourceMappingURL=ServerConfigPanel-5RPRkuvl.js.map
