import"./rolldown-runtime-DIIn1E2Q.js";import{W as e,st as t}from"./vendor-primevue-_eYbXsHY.js";import"./vendor-firebase-D7u00oy9.js";import{A as n,F as r,I as i,O as a,R as o,Rt as s,S as c,Ut as l,Y as u,_t as d,et as f,j as p,k as m,l as h,nt as g,pt as _}from"./vendor-vue-core-DO0afONr.js";import"./vendor-other-D7fTIduy.js";import"./useFeatureFlags-ChmiVSwD.js";import{qt as v}from"./api-BebQfoGK.js";import"./vendor-markdown-Da9QPS2x.js";import"./colorUtil-xHrUTSza.js";import{n as y}from"./vendor-i18n-JbyM4Qz7.js";import"./i18n-dAUEhQVe.js";import"./vendor-reka-ui-D1HCh14_.js";import{t as b}from"./Button-hTbieW3T.js";import{P as x,i as S}from"./dialogService-Cm1GEBK8.js";import"./formatUtil-Gr6H7233.js";import"./userStore-DMlTsx5E.js";import"./useErrorHandling-DudkVSep.js";import{n as C}from"./extensionStore-P-YqST__.js";import{t as w}from"./envUtil-BPtcYFTX.js";import"./useExternalLink-DY6FqhTr.js";import"./vendor-tiptap-CcjHVRxb.js";import"./markdownRendererUtil-PltcX2Bi.js";import"./Popover-BhkpNQxC.js";import"./electronDownloadStore-BYrGQ7mS.js";import{t as T}from"./serverConfigStore-BvCsxqQN.js";var E={class:`server-config-panel flex flex-col gap-2`},D={class:`flex justify-end gap-2`},O={class:`flex items-center justify-between`},k=o({__name:`ServerConfigPanel`,setup(o){let k=S(),A=T(),j=v(),{serverConfigsByCategory:M,serverConfigValues:N,launchArgs:P,commandLineArgs:F,modifiedConfigs:I}=h(A),L=!1,revertChanges=()=>{A.revertChanges()},restartApp=async()=>{L=!0,await w().restartApp()};_(P,async e=>{await k.set(`Comfy.Server.LaunchArgs`,e)}),_(N,async e=>{await k.set(`Comfy.Server.ServerConfigValues`,e)});let{copyToClipboard:R}=C(),copyCommandLineArgs=async()=>{await R(F.value)},{t:z}=y();u(()=>{L||I.value.length!==0&&j.add({severity:`warn`,summary:z(`serverConfig.restartRequiredToastSummary`),detail:z(`serverConfig.restartRequiredToastDetail`),life:1e4})});let translateItem=e=>({...e,name:z(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?z(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0});return(o,u)=>(f(),p(`div`,E,[s(I).length>0?(f(),m(s(t),{key:0,severity:`info`,"pt:text":`w-full`},{default:d(()=>[a(`p`,null,l(o.$t(`serverConfig.modifiedConfigs`)),1),a(`ul`,null,[(f(!0),p(c,null,g(s(I),e=>(f(),p(`li`,{key:e.id},l(e.name)+`: `+l(e.initialValue)+` → `+l(e.value),1))),128))]),a(`div`,D,[i(b,{variant:`secondary`,onClick:revertChanges},{default:d(()=>[r(l(o.$t(`serverConfig.revertChanges`)),1)]),_:1}),i(b,{variant:`destructive`,onClick:restartApp},{default:d(()=>[r(l(o.$t(`serverConfig.restart`)),1)]),_:1})])]),_:1})):n(``,!0),s(F)?(f(),m(s(t),{key:1,severity:`secondary`,"pt:text":`w-full`},{icon:d(()=>u[0]||=[a(`i`,{class:`icon-[lucide--terminal] text-xl font-bold`},null,-1)]),default:d(()=>[a(`div`,O,[a(`p`,null,l(s(F)),1),i(b,{size:`icon`,variant:`muted-textonly`,"aria-label":o.$t(`g.copyToClipboard`),onClick:copyCommandLineArgs},{default:d(()=>u[1]||=[a(`i`,{class:`pi pi-clipboard`},null,-1)]),_:1},8,[`aria-label`])])]),_:1})):n(``,!0),(f(!0),p(c,null,g(Object.entries(s(M)),([t,r],u)=>(f(),p(`div`,{key:t},[u>0?(f(),m(s(e),{key:0})):n(``,!0),a(`h3`,null,l(o.$t(`serverConfigCategories.${t}`,t)),1),(f(!0),p(c,null,g(r,e=>(f(),p(`div`,{key:e.name,class:`mb-4`},[i(x,{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))]))}});export{k as default};
//# sourceMappingURL=ServerConfigPanel-DOlqZgzM.js.map