var S=Object.defineProperty;var y=(n,s)=>S(n,"name",{value:s,configurable:!0});import{bx as k,r as c,o as U,n as V,c as C,d as v,l as E,e as t,v as N,by as o,p as B,s as T,E as p,j as b,k as h,z as i,u,J as z,q as R,A as x}from"./vendor-other-CSX7WseZ.js";import{e as M,q as j,i as q,s as A}from"./vendor-primevue-B6rcS73U.js";import{k as D}from"./vendor-vue-CXt3ZZQ3.js";import{a6 as I,bn as J,cd as K,bs as O,_ as P}from"./index-2-qFLlQP.js";import"./vendor-xterm-CWYFmgbN.js";import"./vendor-three-BKWXAgVe.js";import"./vendor-tiptap-BkFTmTb3.js";const W={class:"flex w-full grow items-center justify-center overflow-auto"},F=k({__name:"BaseViewTemplate",props:{dark:{type:Boolean,default:!1}},setup(n){const s={color:"rgba(0, 0, 0, 0)",symbolColor:"#d4d4d4"},d={color:"rgba(0, 0, 0, 0)",symbolColor:"#171717"},l=c(null);return U(async()=>{I()&&(await V(),J().changeTheme({...n.dark?s:d,height:l.value?.getBoundingClientRect().height??0}))}),(a,m)=>(v(),C("div",{class:T(["flex h-svh w-screen flex-col font-sans",[a.dark?"dark-theme bg-neutral-900 text-neutral-300":"bg-neutral-300 text-neutral-900"]])},[E(t("div",{ref_key:"topMenuRef",ref:l,class:"app-drag h-(--comfy-topbar-height) w-full"},null,512),[[N,o(K)()]]),t("div",W,[B(a.$slots,"default")])],2))}}),G={id:"comfy-user-selection",class:"relative min-w-84 rounded-lg bg-(--comfy-menu-bg) p-5 px-10 shadow-lg"},H={class:"flex w-full flex-col items-center"},L={class:"flex w-full flex-col gap-2"},Q={for:"new-user-input"},X={class:"flex w-full flex-col gap-2"},Y={for:"existing-user-select"},Z={class:"mt-5"},ie=k({__name:"UserSelectView",setup(n){const s=O(),d=D(),l=c(null),a=c(""),m=c(""),w=p(()=>a.value.trim()!==""),$=p(()=>s.users.find(e=>e.username===a.value)?`User "${a.value}" already exists`:""),g=p(()=>$.value||m.value),_=y(async()=>{try{const e=w.value?await s.createUser(a.value):l.value;if(!e)throw new Error("No user selected");await s.login(e),await d.push("/")}catch(e){m.value=e instanceof Error?e.message:JSON.stringify(e)}},"login");return U(async()=>{s.initialized||await s.initialize()}),(e,r)=>(v(),b(F,{dark:""},{default:h(()=>[t("main",G,[r[2]||(r[2]=t("h1",{class:"my-2.5 mb-7 font-normal"},"ComfyUI",-1)),t("div",H,[t("div",L,[t("label",Q,u(e.$t("userSelect.newUser"))+":",1),i(o(M),{id:"new-user-input",modelValue:a.value,"onUpdate:modelValue":r[0]||(r[0]=f=>a.value=f),placeholder:e.$t("userSelect.enterUsername"),onKeyup:z(_,["enter"])},null,8,["modelValue","placeholder"])]),i(o(j)),t("div",X,[t("label",Y,u(e.$t("userSelect.existingUser"))+":",1),i(o(q),{modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=f=>l.value=f),class:"w-full","input-id":"existing-user-select",options:o(s).users,"option-label":"username",placeholder:e.$t("userSelect.selectUser"),disabled:w.value},null,8,["modelValue","options","placeholder","disabled"]),g.value?(v(),b(o(A),{key:0,severity:"error"},{default:h(()=>[x(u(g.value),1)]),_:1})):R("",!0)]),t("footer",Z,[i(P,{onClick:_},{default:h(()=>[x(u(e.$t("userSelect.next")),1)]),_:1})])])])]),_:1}))}});export{ie as default};
//# sourceMappingURL=UserSelectView-tu0lXAri.js.map
