var S=Object.defineProperty;var y=(a,t)=>S(a,"name",{value:t,configurable:!0});import{defineComponent as x,ref as n,onMounted as U,nextTick as V,openBlock as h,createElementBlock as C,normalizeClass as $,withDirectives as E,createElementVNode as o,vShow as N,unref as i,renderSlot as B,computed as d,createBlock as _,withCtx as b,toDisplayString as f,createVNode as m,withKeys as T,createTextVNode as M,createCommentVNode as R}from"vue";import z from"primevue/button";import D from"primevue/divider";import I from"primevue/inputtext";import H from"primevue/message";import K from"primevue/select";import{g as j}from"./vendor-vue-CazFs7AC.js";import{H as A,aV as J,bH as O,aZ as P}from"./index-1hU-CrHv.js";import"./vendor-other-CxTHhkh8.js";import"@primevue/themes";import"@primevue/themes/aura";import"primevue/config";import"primevue/confirmationservice";import"primevue/toastservice";import"primevue/tooltip";import"vue-i18n";import"primevue/checkbox";import"primevue/scrollpanel";import"primevue/usetoast";import"primevue/card";import"primevue/listbox";import"primevue/skeleton";import"primevue/multiselect";import"./vendor-xterm-DV1MVhAx.js";import"primevue/progressspinner";import"primevue/galleria";import"primevue/popover";import"primevue/iconfield";import"primevue/inputicon";import"primevue/badge";import"primevue/chip";import"primevue/contextmenu";import"primevue/tree";import"primevue/toolbar";import"primevue/progressbar";import"primevue";import"primevue/slider";import"./vendor-three-B-uslVEb.js";import"primevue/floatlabel";import"@primevue/forms";import"@primevue/forms/resolvers/zod";import"primevue/password";import"primevue/tag";import"primevue/inputnumber";import"primevue/tabpanels";import"primevue/tabs";import"primevue/tabpanel";import"primevue/toggleswitch";import"primevue/colorpicker";import"primevue/radiobutton";import"primevue/knob";import"primevue/panel";import"primevue/tabmenu";import"primevue/tab";import"primevue/tablist";import"primevue/autocomplete";import"primevue/dropdown";import"primevue/selectbutton";import"primevue/dialog";import"primevue/confirmpopup";import"primevue/useconfirm";import"primevue/confirmdialog";import"primevue/tieredmenu";import"primevue/chart";import"primevue/imagecompare";import"primevue/textarea";import"primevue/treeselect";import"./vendor-tiptap-fKn4WMvi.js";import"primevue/blockui";const W={class:"flex w-full grow items-center justify-center overflow-auto"},Z=x({__name:"BaseViewTemplate",props:{dark:{type:Boolean,default:!1}},setup(a){const t={color:"rgba(0, 0, 0, 0)",symbolColor:"#d4d4d4"},p={color:"rgba(0, 0, 0, 0)",symbolColor:"#171717"},l=n(null);return U(async()=>{A()&&(await V(),J().changeTheme({...a.dark?t:p,height:l.value?.getBoundingClientRect().height??0}))}),(r,u)=>(h(),C("div",{class:$(["flex h-svh w-screen flex-col font-sans",[r.dark?"dark-theme bg-neutral-900 text-neutral-300":"bg-neutral-300 text-neutral-900"]])},[E(o("div",{ref_key:"topMenuRef",ref:l,class:"app-drag h-(--comfy-topbar-height) w-full"},null,512),[[N,i(O)()]]),o("div",W,[B(r.$slots,"default")])],2))}}),q={id:"comfy-user-selection",class:"relative min-w-84 rounded-lg bg-(--comfy-menu-bg) p-5 px-10 shadow-lg"},F={class:"flex w-full flex-col items-center"},G={class:"flex w-full flex-col gap-2"},L={for:"new-user-input"},Q={class:"flex w-full flex-col gap-2"},X={for:"existing-user-select"},Y={class:"mt-5"},vt=x({__name:"UserSelectView",setup(a){const t=P(),p=j(),l=n(null),r=n(""),u=n(""),v=d(()=>r.value.trim()!==""),k=d(()=>t.users.find(e=>e.username===r.value)?`User "${r.value}" already exists`:""),w=d(()=>k.value||u.value),g=y(async()=>{try{const e=v.value?await t.createUser(r.value):l.value;if(!e)throw new Error("No user selected");await t.login(e),await p.push("/")}catch(e){u.value=e instanceof Error?e.message:JSON.stringify(e)}},"login");return U(async()=>{t.initialized||await t.initialize()}),(e,s)=>(h(),_(Z,{dark:""},{default:b(()=>[o("main",q,[s[2]||(s[2]=o("h1",{class:"my-2.5 mb-7 font-normal"},"ComfyUI",-1)),o("div",F,[o("div",G,[o("label",L,f(e.$t("userSelect.newUser"))+":",1),m(i(I),{id:"new-user-input",modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=c=>r.value=c),placeholder:e.$t("userSelect.enterUsername"),onKeyup:T(g,["enter"])},null,8,["modelValue","placeholder"])]),m(i(D)),o("div",Q,[o("label",X,f(e.$t("userSelect.existingUser"))+":",1),m(i(K),{modelValue:l.value,"onUpdate:modelValue":s[1]||(s[1]=c=>l.value=c),class:"w-full","input-id":"existing-user-select",options:i(t).users,"option-label":"username",placeholder:e.$t("userSelect.selectUser"),disabled:v.value},null,8,["modelValue","options","placeholder","disabled"]),w.value?(h(),_(i(H),{key:0,severity:"error"},{default:b(()=>[M(f(w.value),1)]),_:1})):R("",!0)]),o("footer",Y,[m(i(z),{label:e.$t("userSelect.next"),onClick:g},null,8,["label"])])])])]),_:1}))}});export{vt as default};
//# sourceMappingURL=UserSelectView-taIt243_.js.map
