import{i as e,n as t}from"./rolldown-runtime-ConPGZeh.js";import{$n as n,Gn as r,Lr as i,Nn as a,Pr as o,Qn as s,Sr as c,Ut as l,Wt as u,Zn as d,_n as f,_r as p,er as m,ii as h,ir as g,li as _,or as v,rr as y,vn as b,wr as x}from"./vendor-primevue-D1-E3-0M.js";import{at as S,it as C}from"./vendor-other-CT05lTmi.js";import{i as w,r as T}from"./vendor-vue-W0uRz0qB.js";import{_n as E,fn as D,pn as O,vn as k}from"./api-DvJuMrZn.js";import{n as A,t as j}from"./Button-DXEyozJJ.js";import{n as M,t as N}from"./PanelTemplate-CURL0L1Z.js";import{Hr as P,Ja as F,Vr as I,a as L,o as R,qa as z}from"./dialogService-DIdX_hbW.js";import{n as B,t as V}from"./serverConfigStore-DrxDnpOi.js";var H,U,W,G,K=t((()=>{a(),T(),l(),f(),C(),R(),M(),A(),I(),z(),D(),V(),k(),H={class:`flex flex-col gap-2`},U={class:`flex justify-end gap-2`},W={class:`flex items-center justify-between`},G=v({__name:`ServerConfigPanel`,setup(e){let t=F(),a=B(),l=O(),{serverConfigsByCategory:f,serverConfigValues:v,launchArgs:C,commandLineArgs:T,modifiedConfigs:D}=w(a),k=!1,revertChanges=()=>{a.revertChanges()},restartApp=async()=>{k=!0,await E().restartApp()};o(C,async e=>{await t.set(`Comfy.Server.LaunchArgs`,e)}),o(v,async e=>{await t.set(`Comfy.Server.ServerConfigValues`,e)});let{copyToClipboard:A}=P(),copyCommandLineArgs=async()=>{await A(T.value)},{t:M}=S();p(()=>{k||D.value.length!==0&&l.add({severity:`warn`,summary:M(`serverConfig.restartRequiredToastSummary`),detail:M(`serverConfig.restartRequiredToastDetail`),life:1e4})});let translateItem=e=>({...e,name:M(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?M(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0});return(e,t)=>(c(),s(N,{value:`Server-Config`,class:`server-config-panel`},{header:i(()=>[d(`div`,H,[h(D).length>0?(c(),s(h(b),{key:0,severity:`info`,"pt:text":`w-full`},{default:i(()=>[d(`p`,null,_(e.$t(`serverConfig.modifiedConfigs`)),1),d(`ul`,null,[(c(!0),m(r,null,x(h(D),e=>(c(),m(`li`,{key:e.id},_(e.name)+`: `+_(e.initialValue)+` → `+_(e.value),1))),128))]),d(`div`,U,[g(j,{variant:`secondary`,onClick:revertChanges},{default:i(()=>[y(_(e.$t(`serverConfig.revertChanges`)),1)]),_:1}),g(j,{variant:`destructive`,onClick:restartApp},{default:i(()=>[y(_(e.$t(`serverConfig.restart`)),1)]),_:1})])]),_:1})):n(``,!0),h(T)?(c(),s(h(b),{key:1,severity:`secondary`,"pt:text":`w-full`},{icon:i(()=>t[0]||=[d(`i`,{class:`icon-[lucide--terminal] text-xl font-bold`},null,-1)]),default:i(()=>[d(`div`,W,[d(`p`,null,_(h(T)),1),g(j,{size:`icon`,variant:`muted-textonly`,onClick:copyCommandLineArgs},{default:i(()=>t[1]||=[d(`i`,{class:`pi pi-clipboard`},null,-1)]),_:1})])]),_:1})):n(``,!0)])]),default:i(()=>[(c(!0),m(r,null,x(Object.entries(h(f)),([t,i],a)=>(c(),m(`div`,{key:t},[a>0?(c(),s(h(u),{key:0})):n(``,!0),d(`h3`,null,_(e.$t(`serverConfigCategories.${t}`,t)),1),(c(!0),m(r,null,x(i,e=>(c(),m(`div`,{key:e.name,class:`mb-4`},[g(L,{id:e.id,"form-value":e.value,"onUpdate:formValue":t=>e.value=t,item:translateItem(e),"label-class":{"text-highlight":e.initialValue!==e.value}},null,8,[`id`,`form-value`,`onUpdate:formValue`,`item`,`label-class`])]))),128))]))),128))]),_:1}))}})})),q;t((()=>{K(),K(),q=G}))();export{q as default};
//# sourceMappingURL=ServerConfigPanel-D9B7xqvN.js.map