>=1;if(g!==0?(z&=g-1,z+=g):z=0,B++,--Y[P]==0){if(P===K)break;P=d[p+y[B]]}if(te>>7)]}function ne(S,R){S.pending_buf[S.pending++]=255&R,S.pending_buf[S.pending++]=R>>>8&255}function Y(S,R,H){S.bi_valid>m-H?(S.bi_buf|=R<>m-S.bi_valid,S.bi_valid+=H-m):(S.bi_buf|=R<>>=1,H<<=1,0<--R;);return H>>>1}function ye(S,R,H){var Z,L,X=new Array(y+1),re=0;for(Z=1;Z<=y;Z++)X[Z]=re=re+H[Z-1]<<1;for(L=0;L<=R;L++){var ee=S[2*L+1];ee!==0&&(S[2*L]=fe(X[ee]++,ee))}}function se(S){var R;for(R=0;R>1;1<=H;H--)ve(S,X,H);for(L=ae;H=S.heap[1],S.heap[1]=S.heap[S.heap_len--],ve(S,X,1),Z=S.heap[1],S.heap[--S.heap_max]=H,S.heap[--S.heap_max]=Z,X[2*L]=X[2*H]+X[2*Z],S.depth[L]=(S.depth[H]>=S.depth[Z]?S.depth[H]:S.depth[Z])+1,X[2*H+1]=X[2*Z+1]=L,S.heap[1]=L++,ve(S,X,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(pe,Ye){var _n,at,xn,je,er,io,ft=Ye.dyn_tree,Zs=Ye.max_code,Dl=Ye.stat_desc.static_tree,jl=Ye.stat_desc.has_stree,Pl=Ye.stat_desc.extra_bits,Ys=Ye.stat_desc.extra_base,kn=Ye.stat_desc.max_length,tr=0;for(je=0;je<=y;je++)pe.bl_count[je]=0;for(ft[2*pe.heap[pe.heap_max]+1]=0,_n=pe.heap_max+1;_n>=7;L>>=1)if(1&ge&&ee.dyn_ltree[2*ae]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(ae=32;ae>>3,(X=S.static_len+3+7>>>3)<=L&&(L=X)):L=X=H+5,H+4<=L&&R!==-1?D(S,R,H,Z):S.strategy===4||X===L?(Y(S,2+(Z?1:0),3),me(S,$,P)):(Y(S,4+(Z?1:0),3),function(ee,ae,ge,pe){var Ye;for(Y(ee,ae-257,5),Y(ee,ge-1,5),Y(ee,pe-4,4),Ye=0;Ye>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&R,S.pending_buf[S.l_buf+S.last_lit]=255&H,S.last_lit++,R===0?S.dyn_ltree[2*H]++:(S.matches++,R--,S.dyn_ltree[2*(b[H]+d+1)]++,S.dyn_dtree[2*T(R)]++),S.last_lit===S.lit_bufsize-1},o._tr_align=function(S){Y(S,2,3),G(S,_,$),function(R){R.bi_valid===16?(ne(R,R.bi_buf),R.bi_buf=0,R.bi_valid=0):8<=R.bi_valid&&(R.pending_buf[R.pending++]=255&R.bi_buf,R.bi_buf>>=8,R.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var l,u,c,d,p=1,h={},v=!1,f=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,l={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){g(k)})}:function(){if(i.postMessage&&!i.importScripts){var k=!0,C=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=C,k}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(k){i.postMessage(d+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){g(k.data)},function(k){c.port2.postMessage(k)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(k){var C=f.createElement("script");C.onreadystatechange=function(){g(k),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(k){setTimeout(g,0,k)},y.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var C=new Array(arguments.length-1),j=0;j"u"?s===void 0?this:s:self)}).call(this,typeof nr<"u"?nr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Il);var Mp=Il.exports;const zp=Ra(Mp),Lp=async t=>{const e=`ComfyUI workspace workflows ${vl(Date.now())}`,n=new zp,r=await(q==null?void 0:q.getSetting("twoWaySync"));for(const o of t){let s;r?s=o.parentFolderID??"":s=await Ch(o.parentFolderID??null).then(async a=>Ft(a??""));const i=n.folder(s);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const s=document.createElement("a");s.href=window.URL.createObjectURL(o),s.download=`${e}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s)})};function Wp({myWorkflowsDir:t}){return x.jsxs(He,{gap:3,children:[x.jsx(sn,{size:"md",children:"🦄 Upgrade to 2.0 - enable two way sync!"}),x.jsx("p",{children:"Your workflows will be synced to and from path:"}),x.jsx("p",{children:x.jsx("b",{children:t})}),x.jsxs("p",{children:["You can manually put workflow files into this folder using File Explorer to sync them with your workspace. You can change this path anytime in Settings ",">"," Workspace Save Directory"]}),x.jsxs("p",{children:[x.jsx("b",{children:"Please download all your workflows before enabling two way sync as a backup!"})," ","So you can manually import some workflows into your workspace in case something unexpected happens."]}),x.jsx(Te,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(V==null?void 0:V.listAll());Lp(e??[])},children:"👉 Download All My Workflows"})]})}const Up=(t,e)=>{const n=t.nodes==null?[]:t.nodes,r=e.nodes==null?[]:e.nodes;t.nodes=[],e.nodes=[];let o=JSON.stringify(t)===JSON.stringify(e);if(o){const s=(a,l)=>{const u=l.order,c=l.pos;return delete l.order,delete l.pos,a.set(l.id,JSON.stringify(l)),a.set(l.id+"_pos",c),l.order=u,l.pos=c,a},i=(a,l,u)=>Math.abs(a-l)>u;if(n.length==r.length){const a=n.reduce(s,new Map),l=r.reduce(s,new Map);for(let[u,c]of a){if(!l.has(u)){o=!1;break}if(typeof u=="string"&&u.includes("_pos")){const d=l.get(u);if(d==null||c==null||i(d[0],c[0],5)||i(d[1],c[1],5)){o=!1;break}}else if(l.get(u)!==c){o=!1;break}}}}return t.nodes=n,e.nodes=r,o},Kp=Wa.lazy(()=>mn(()=>import("./RecentFilesDrawer-sQVncBeb.js"),__vite__mapDeps([14,1,8,2,13,15,12,4]))),$p=Wa.lazy(()=>mn(()=>import("./GalleryModal-1DsUwkaj.js"),__vite__mapDeps([16,1,15,12,9,8,2,3]))),Vp=["download_progress","download_error","model_list"];function Hp(){const[t,e]=A.useState(null),[n,r]=A.useState("root"),[o,s]=A.useState(!0),[i,a]=A.useState(null),l=A.useRef(null),[u,c]=A.useState(!1),d=A.useRef(null),{showDialog:p}=La(),[h,v]=A.useState(!1);A.useRef(!1);const f=Ka(),[y,m]=Bp(null),g=A.useCallback(async()=>{var O,J;if(l.current){if((O=V==null?void 0:V.curWorkflow)!=null&&O.saveLock){f({title:"The workflow is locked and cannot be saved",status:"warning",duration:3e3});return}const M=JSON.stringify(_e.graph.serialize());await Promise.all([V==null?void 0:V.updateFlow(l.current,{json:M}),qe==null?void 0:qe.create({workflowID:l.current,json:M,isAutoSave:!1})]),(J=q==null?void 0:q.settings)!=null&&J.autoSave&&f({title:"Saved",status:"success",duration:1e3,isClosable:!0}),c(!1)}},[]),_=async()=>{l.current&&confirm("Are you sure you want to delete this workflow?")&&(await(V==null?void 0:V.delete(l.current)),C(null))},k=async()=>{var J,M,Q;if((J=q==null?void 0:q.settings)!=null&&J.autoSave){alert("You cannot discard unsaved changes when auto save is enabled");return}if(confirm("Are you sure you want to discard unsaved changes? This will revert current workflow to your last saved version. You will lose all changes made since your last save.")){const z=(M=V==null?void 0:V.curWorkflow)==null?void 0:M.id;if(z==null)return;const T=(Q=await(V==null?void 0:V.get(z)))==null?void 0:Q.json;T?(V==null||V.updateCurWorkflow({...V.curWorkflow,json:T}),await _e.loadGraphData(JSON.parse(T)),c(!1)):alert("Error: No last saved version found")}},C=O=>{const J=(O==null?void 0:O.id)??null;if(V==null||V.updateCurWorkflow(O),l.current=J,a(J),e((O==null?void 0:O.name)??""),J==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(ja()){const M=gl(J);window.location.hash=M,document.title=O.name+" - ComfyUI"}else localStorage.setItem("curFlowID",J),document.title="ComfyUI - "+O.name;O&&(V==null||V.updateLastOpenedTime(O.id))},j=async()=>{E(),localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await Uh()}catch(M){console.error("error loading db",M)}s(!1);let O=null;O=ja(),O==null&&(O=localStorage.getItem("curFlowID")),O&&I(O),!await(q==null?void 0:q.getSetting("twoWaySync"))&&ce.cache.get(ko).then(async M=>{if((M==null?void 0:M.value)!=="true"){if(await ce.workflows.count()==0){await(q==null?void 0:q.upsert({twoWaySync:!0})),await ce.cache.put({id:ko,value:"true"});return}const z=await(q==null?void 0:q.getSetting("myWorkflowsDir"));p(x.jsx(Wp,{myWorkflowsDir:z??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(q==null?void 0:q.upsert({twoWaySync:!0})),await(q==null?void 0:q.getSetting("twoWaySync"))&&(ce.cache.put({id:ko,value:"true"}),location.reload())},colorScheme:"red"}],{closeOnOverlayClick:!1})}})},E=()=>{Vp.forEach(O=>{Qs.addEventListener(O,()=>null)})},N=()=>{if(l.current==null)return!1;const O=V==null?void 0:V.curWorkflow;if(O==null)return!1;if(O.json==null)return!0;const J=_e.graph.serialize()??{};let M={};try{M=O!=null&&O.json?JSON.parse(O==null?void 0:O.json):{}}catch(z){console.error("error parsing json",z)}return!Up(J,M)},I=async(O,J)=>{if(_e.graph==null)return;const M=await(V==null?void 0:V.get(O));if(M==null){alert("Error: Workflow not found! id: "+O),C(null);return}const Q=J?await(we==null?void 0:we.get(J)):null;_e.ui.dialog.close(),Q?(m(Q),C({...M,json:Q.json}),_e.loadGraphData(JSON.parse(Q.json))):(C(M),m(null),_e.loadGraphData(JSON.parse(M.json))),r("root"),u&&c(!1)},F=async(O,J,M=!1)=>{if(O===null){C(null),_e.graph.clear();return}if(!u||M||await(q==null?void 0:q.getSetting("autoSave"))){I(O,J);return}$(O)},$=async O=>{var M,Q;const J=[O?{label:"Open in new tab",icon:x.jsx(xl,{}),onClick:()=>{jh(O)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await g(),O&&I(O)}}];((M=V==null?void 0:V.curWorkflow)==null?void 0:M.lastSavedJson)!=null?J.push({label:"Discard",colorScheme:"red",onClick:async()=>{O&&I(O)}}):J.push({label:"Delete",colorScheme:"red",onClick:async()=>{await _(),O&&I(O)}}),p(`Please save or discard your changes to "${(Q=V==null?void 0:V.curWorkflow)==null?void 0:Q.name}" before leaving, or your changes will be lost.`,J)},P=async O=>{const J=(O==null?void 0:O.json)??JSON.stringify(Sr),M=await(V==null?void 0:V.createFlow({json:J,name:O==null?void 0:O.name}));M&&await F(M.id),r("root")},B=async(O,J=!1)=>{const M=O.split("/").pop()??O;J?g():P({name:M});const Q=await fetch(Dh(O)),z=await Q.blob(),T=new File([z],M,{type:Q.headers.get("Content-Type")||""});await _e.handleFile(T),r("root")},b=async(O,J)=>{const M=await(V==null?void 0:V.get(O));if(M==null)return;const Q=await(V==null?void 0:V.createFlow({json:M.json,lastSavedJson:M.lastSavedJson,name:J||M.name,parentFolderID:M.parentFolderID,tags:M.tags}));Q&&await F(Q.id)},K=A.useCallback(O=>{if(l.current==null)return;let J=O.filename;O.subfolder!=null&&O.subfolder!==""&&(J=O.subfolder+"/"+J),Ht==null||Ht.create({workflowID:l.current,localPath:J})},[]),te=A.useCallback(()=>{r("root")},[]);return A.useEffect(()=>{j(),v(!0);const O=document.getElementById("comfy-file-input"),J=async()=>{if(O&&O.files&&O.files.length>0){const T={id:zn(),name:O.files[0].name,json:JSON.stringify(Sr),updateTime:Date.now(),createTime:Date.now()};C(T),await(V==null?void 0:V.createFlow(T))}};O==null||O.addEventListener("change",J);const M=T=>{var G,fe;const ne=((G=q==null?void 0:q.settings)==null?void 0:G.autoSave)??!0;if((fe=V==null?void 0:V.curWorkflow)!=null&&fe.saveLock)return;const Y=N();!ne&&Y&&(T.preventDefault(),T.returnValue="You have unsaved changes!",$())};window.addEventListener("beforeunload",M);const Q=T=>{var ne,Y,G,fe,ye,se;(G=(Y=(ne=T.detail)==null?void 0:ne.output)==null?void 0:Y.images)==null||G.forEach(le=>{le.type==="output"&&K(le)}),(se=(ye=(fe=T.detail)==null?void 0:fe.output)==null?void 0:ye.gifs)==null||se.forEach(le=>{le.type==="output"&&K(le)})};Qs.addEventListener("executed",Q);const z=async T=>{var fe,ye;const ne=(ye=(fe=T.dataTransfer)==null?void 0:fe.files[0])==null?void 0:ye.name,Y=_e.dragOverNode;if(Y&&Y.onDragDrop)return;if(!(await(q==null?void 0:q.getSetting("overwriteCurWorkflowWhenDroppingFileToCanvas"))??!1)&&ne){const se={id:zn(),name:ne,json:JSON.stringify(Sr),updateTime:Date.now(),createTime:Date.now()};C(se),await(V==null?void 0:V.createFlow(se))}};return _e.canvasEl.addEventListener("drop",z),()=>{window.removeEventListener("change",J),window.removeEventListener("beforeunload",M),window.removeEventListener("executed",Q),_e.canvasEl.removeEventListener("drop",z)}},[]),o?null:x.jsx(Ct.Provider,{value:{curFlowID:i,onDuplicateWorkflow:b,loadWorkflowID:F,discardUnsavedChanges:k,saveCurWorkflow:g,isDirty:u,setIsDirty:c,loadNewWorkflow:P,loadFilePath:B,setRoute:r,route:n,curVersion:y,setCurVersion:m},children:x.jsx("div",{ref:d,className:"workspace_manager",children:x.jsxs(Ma,{containerRef:d,children:[x.jsxs(jt,{style:{position:"absolute",top:0,right:0,left:0},zIndex:Eh,draggable:!1,children:[x.jsx(Np,{curFlowName:t,setCurFlowName:e}),h&&n==="recentFlows"&&x.jsx(A.Suspense,{children:x.jsx(Kp,{onClose:te,onClickNewFlow:()=>{P(),r("root")}})}),n==="gallery"&&x.jsx(A.Suspense,{children:x.jsx($p,{onclose:()=>r("root")})})]}),x.jsx(Fp,{})]})})})}const Em=Object.freeze(Object.defineProperty({__proto__:null,default:Hp},Symbol.toStringTag,{value:"Module"}));export{am as $,Na as A,jt as B,V as C,fp as D,gh as E,Wt as F,dp as G,rt as H,Tn as I,Lp as J,Xh as K,im as L,xi as M,Qh as N,Nh as O,Le as P,Yr as Q,ym as R,Fd as S,Gt as T,Qr as U,Xr as V,sp as W,Sr as X,cm as Y,Er as Z,Wh as _,Yp as a,xc as a0,Ei as a1,ki as a2,Di as a3,Ci as a4,Oi as a5,Si as a6,Ct as a7,kl as a8,Ht as a9,rm as aA,om as aB,Uc as aC,gm as aD,Bp as aE,zh as aF,hm as aG,vm as aH,ks as aI,kr as aJ,yn as aK,_m as aL,si as aM,we as aN,bm as aO,xm as aP,Op as aQ,km as aR,ot as aS,hc as aT,Em as aU,jh as aa,xl as ab,vl as ac,yt as ad,pc as ae,Eh as af,nm as ag,us as ah,um as ai,Ha as aj,fm as ak,qa as al,Mh as am,sn as an,on as ao,kc as ap,Up as aq,lm as ar,dm as as,qe as at,Xl as au,ce as av,wm as aw,xf as ax,pm as ay,mm as az,Kc as b,em as c,Xp as d,Qp as e,gn as f,no as g,Ne as h,lp as i,Ka as j,He as k,wt as l,$c as m,bt as n,vn as o,q as p,Wp as q,_f as r,tm as s,Or as t,to as u,sm as v,jo as w,Fs as x,Rs as y,pt as z};
-function __vite__mapDeps(indexes) {
- if (!__vite__mapDeps.viteFileDeps) {
- __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-RSv54KWI.js","workspace_web/input.js","workspace_web/index-pz0vT7Or.js","workspace_web/chunk-K7XRJ7NL-Vyo84f0U.js","workspace_web/IconCopy-BoJadUqc.js","workspace_web/AppIsDirtyEventListener-itM8SNk2.js","workspace_web/useDebounceFn-ld478fd0.js","workspace_web/ModelManagerTopbar-rYC0nrt7.js","workspace_web/chunk-JARCRF6W-QWMsZMLI.js","workspace_web/chunk-3RSXBRAN-crwOgWRE.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css","workspace_web/SpotlightSearch-mJn8Tnrv.js","workspace_web/IconSearch-TfsRN_aS.js","workspace_web/chunk-NTCQBYKE-ZN6CsuPY.js","workspace_web/RecentFilesDrawer-sQVncBeb.js","workspace_web/MediaPreview-GWdoyYIm.js","workspace_web/GalleryModal-1DsUwkaj.js"]
- }
- return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
-}
\ No newline at end of file
diff --git a/dist/workspace_web/AppIsDirtyEventListener-itM8SNk2.js b/dist/workspace_web/AppIsDirtyEventListener-itM8SNk2.js
deleted file mode 100644
index 71501c8..0000000
--- a/dist/workspace_web/AppIsDirtyEventListener-itM8SNk2.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as l,j as m}from"./input.js";import{app as t}from"/scripts/app.js";import{a7 as C,j as D,aq as j,n as W,T as _,ar as x,E as p,as as I,C as n,p as d,at as R}from"./App-49F9REmv.js";import{u as L}from"./useDebounceFn-ld478fd0.js";import"/scripts/api.js";function F(){const{isDirty:w,setIsDirty:v,setRoute:k,saveCurWorkflow:S}=l.useContext(C),y=l.useRef(w),[g,E]=l.useState(!1);D();const h=l.useRef(null);l.useEffect(()=>{var i,c;const s=e=>{var u;if(document.visibilityState==="hidden")return;const r=I(e);if(r)switch(e.preventDefault(),window.dispatchEvent(new CustomEvent(x,{detail:{shortcutType:r}})),r){case p.SAVE:S();break;case p.SAVE_AS:k("saveAsModal");break;case p.openSpotlightSearch:k("spotlightSearch");break}else(u=e.target)!=null&&u.matches("input, textarea")&&Object.keys(t.canvas.selected_nodes??{}).length&&f()},o=t.canvas.onAfterChange;t.graph.onAfterChange=function(){o==null||o.apply(this,arguments),f()};const a=t.graph.onConfigure;return t.graph.onConfigure=function(){a==null||a.apply(this,arguments),setTimeout(()=>{var r,u;j(t.graph.serialize(),JSON.parse(((u=(r=n)==null?void 0:r.curWorkflow)==null?void 0:u.json)??"{}"))||f()},1e3)},document.addEventListener("click",e=>{Object.keys(t.canvas.selected_nodes??{}).length&&(t.canvas.node_over!=null||t.canvas.node_capturing_input!=null||t.canvas.node_widget!=null)&&f()}),document.addEventListener("keydown",s),(c=(i=d)==null?void 0:i.settings)!=null&&c.autoSave&&d.settings.autoSaveDuration&&(h.current=setInterval(()=>{T()},d.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",s),h.current&&clearInterval(h.current)}},[]);const T=async()=>{var o,a,i,c,e;if(!((a=(o=n)==null?void 0:o.curWorkflow)!=null&&a.id))return;const s=JSON.stringify(t.graph.serialize());s!==((i=n)==null?void 0:i.curWorkflow.json)&&(await((c=n)==null?void 0:c.updateFlow(n.curWorkflow.id,{json:s})),(e=R)==null||e.create({workflowID:n.curWorkflow.id,isAutoSave:!0,json:s}),v(!1))},b=async()=>{var s,o,a,i,c,e,r;(o=(s=n)==null?void 0:s.curWorkflow)!=null&&o.saveLock||(!w&&v(!0),y.current=!0,(i=(a=d)==null?void 0:a.settings)!=null&&i.autoSave&&((e=(c=n)==null?void 0:c.curWorkflow)!=null&&e.id)&&!g&&(await((r=n)==null?void 0:r.latestVersionCheck())||E(!0)))},[f,A]=L(b,500);return g?m.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:m.jsx(_,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{F as default};
diff --git a/dist/workspace_web/GalleryModal-1DsUwkaj.js b/dist/workspace_web/GalleryModal-1DsUwkaj.js
deleted file mode 100644
index db20deb..0000000
--- a/dist/workspace_web/GalleryModal-1DsUwkaj.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as u,d as be,y as Ot,m as we,b as ut,f as A,l as dt,o as Ae,E as Gt,j as r,g as _,h as ht,p as Ut,W as Ht,i as Kt,M as Wt,N as Yt,O as Xt,Q as Zt,R as qt,S as Jt}from"./input.js";import{aj as Qt,a0 as en,h as Fe,F as v,ak as tn,al as nn,I as z,o as sn,k as Ee,B as ft,l as V,a7 as $e,am as rn,C as ne,H as Y,n as W,A as mt,ac as pt,a9 as L,i as an,an as on,G as ln}from"./App-49F9REmv.js";import{c as je,p as cn,r as rt,v as at,I as un,N as dn,a as hn,b as fn,d as mn,e as pn,M as xt,u as xn,S as gn}from"./MediaPreview-GWdoyYIm.js";import{S as vn}from"./chunk-3RSXBRAN-crwOgWRE.js";import{u as yn,C as Ve,G as Sn}from"./chunk-JARCRF6W-QWMsZMLI.js";import{app as ot}from"/scripts/app.js";import{L as Ne}from"./chunk-K7XRJ7NL-Vyo84f0U.js";import"/scripts/api.js";import"./IconSearch-TfsRN_aS.js";import"./index-pz0vT7Or.js";const gt=1/60*1e3,bn=typeof performance<"u"?()=>performance.now():()=>Date.now(),vt=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(bn()),gt);function wn(e){let t=[],s=[],n=0,a=!1,o=!1;const l=new WeakSet,i={schedule:(c,h=!1,m=!1)=>{const f=m&&a,g=f?t:s;return h&&l.add(c),g.indexOf(c)===-1&&(g.push(c),f&&a&&(n=t.length)),c},cancel:c=>{const h=s.indexOf(c);h!==-1&&s.splice(h,1),l.delete(c)},process:c=>{if(a){o=!0;return}if(a=!0,[t,s]=[s,t],s.length=0,n=t.length,n)for(let h=0;h(e[t]=wn(()=>X=!0),e),{}),kn=Z.reduce((e,t)=>{const s=le[t];return e[t]=(n,a=!1,o=!1)=>(X||In(),s.schedule(n,a,o)),e},{}),Pn=Z.reduce((e,t)=>(e[t]=le[t].cancel,e),{});Z.reduce((e,t)=>(e[t]=()=>le[t].process(B),e),{});const Cn=e=>le[e].process(B),yt=e=>{X=!1,B.delta=_e?gt:Math.max(Math.min(e-B.timestamp,jn),1),B.timestamp=e,Me=!0,Z.forEach(Cn),Me=!1,X&&(_e=!1,vt(yt))},In=()=>{X=!0,_e=!0,Me||vt(yt)},lt=()=>B;var $=e=>e?"":void 0,ke=e=>e?!0:void 0,q=(...e)=>e.filter(Boolean).join(" ");function Pe(...e){return function(s){e.some(n=>(n==null||n(s),s==null?void 0:s.defaultPrevented))}}function ee(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}var se={width:0,height:0},te=e=>e||se;function Tn(e){const{orientation:t,thumbPercents:s,thumbRects:n,isReversed:a}=e,o=y=>{var S;const E=(S=n[y])!=null?S:se;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...ee({orientation:t,vertical:{bottom:`calc(${s[y]}% - ${E.height/2}px)`},horizontal:{left:`calc(${s[y]}% - ${E.width/2}px)`}})}},l=t==="vertical"?n.reduce((y,S)=>te(y).height>te(S).height?y:S,se):n.reduce((y,S)=>te(y).width>te(S).width?y:S,se),i={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...ee({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},c={position:"absolute",...ee({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=s.length===1,m=[0,a?100-s[0]:s[0]],f=h?m:s;let g=f[0];!h&&a&&(g=100-g);const x=Math.abs(f[f.length-1]-f[0]),j={...c,...ee({orientation:t,vertical:a?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:a?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:c,innerTrackStyle:j,rootStyle:i,getThumbStyle:o}}function En(e){const{isReversed:t,direction:s,orientation:n}=e;return s==="ltr"||n==="vertical"?t:!t}function Nn(e,t,s,n){return e.addEventListener(t,s,n),()=>{e.removeEventListener(t,s,n)}}function _n(e){const t=Dn(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function St(e){return!!e.touches}function Mn(e){return St(e)&&e.touches.length>1}function Dn(e){var t;return(t=e.view)!=null?t:window}function Rn(e,t="page"){const s=e.touches[0]||e.changedTouches[0];return{x:s[`${t}X`],y:s[`${t}Y`]}}function zn(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function bt(e,t="page"){return St(e)?Rn(e,t):zn(e,t)}function An(e){return t=>{const s=_n(t);(!s||s&&t.button===0)&&e(t)}}function Fn(e,t=!1){function s(a){e(a,{point:bt(a)})}return t?An(s):s}function re(e,t,s,n){return Nn(e,t,Fn(s,t==="pointerdown"),n)}var $n=Object.defineProperty,Vn=(e,t,s)=>t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,N=(e,t,s)=>(Vn(e,typeof t!="symbol"?t+"":t,s),s),Bn=class{constructor(e,t,s){N(this,"history",[]),N(this,"startEvent",null),N(this,"lastEvent",null),N(this,"lastEventInfo",null),N(this,"handlers",{}),N(this,"removeListeners",()=>{}),N(this,"threshold",3),N(this,"win"),N(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const i=Ce(this.lastEventInfo,this.history),c=this.startEvent!==null,h=Un(i.offset,{x:0,y:0})>=this.threshold;if(!c&&!h)return;const{timestamp:m}=lt();this.history.push({...i.point,timestamp:m});const{onStart:f,onMove:g}=this.handlers;c||(f==null||f(this.lastEvent,i),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,i)}),N(this,"onPointerMove",(i,c)=>{this.lastEvent=i,this.lastEventInfo=c,kn.update(this.updatePoint,!0)}),N(this,"onPointerUp",(i,c)=>{const h=Ce(c,this.history),{onEnd:m,onSessionEnd:f}=this.handlers;f==null||f(i,h),this.end(),!(!m||!this.startEvent)&&(m==null||m(i,h))});var n;if(this.win=(n=e.view)!=null?n:window,Mn(e))return;this.handlers=t,s&&(this.threshold=s),e.stopPropagation(),e.preventDefault();const a={point:bt(e)},{timestamp:o}=lt();this.history=[{...a.point,timestamp:o}];const{onSessionStart:l}=t;l==null||l(e,Ce(a,this.history)),this.removeListeners=Gn(re(this.win,"pointermove",this.onPointerMove),re(this.win,"pointerup",this.onPointerUp),re(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Pn.update(this.updatePoint)}};function it(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ce(e,t){return{point:e.point,delta:it(e.point,t[t.length-1]),offset:it(e.point,t[0]),velocity:On(t,.1)}}var Ln=e=>e*1e3;function On(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const a=e[e.length-1];for(;s>=0&&(n=e[s],!(a.timestamp-n.timestamp>Ln(t)));)s--;if(!n)return{x:0,y:0};const o=(a.timestamp-n.timestamp)/1e3;if(o===0)return{x:0,y:0};const l={x:(a.x-n.x)/o,y:(a.y-n.y)/o};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Gn(...e){return t=>e.reduce((s,n)=>n(s),t)}function Ie(e,t){return Math.abs(e-t)}function ct(e){return"x"in e&&"y"in e}function Un(e,t){if(typeof e=="number"&&typeof t=="number")return Ie(e,t);if(ct(e)&&ct(t)){const s=Ie(e.x,t.x),n=Ie(e.y,t.y);return Math.sqrt(s**2+n**2)}return 0}function wt(e){const t=u.useRef(null);return t.current=e,t}function Hn(e,t){const{onPan:s,onPanStart:n,onPanEnd:a,onPanSessionStart:o,onPanSessionEnd:l,threshold:i}=t,c=!!(s||n||a||o||l),h=u.useRef(null),m=wt({onSessionStart:o,onSessionEnd:l,onStart:n,onMove:s,onEnd(f,g){h.current=null,a==null||a(f,g)}});u.useEffect(()=>{var f;(f=h.current)==null||f.updateHandlers(m.current)}),u.useEffect(()=>{const f=e.current;if(!f||!c)return;function g(x){h.current=new Bn(x,m.current,i)}return re(f,"pointerdown",g)},[e,c,m,i]),u.useEffect(()=>()=>{var f;(f=h.current)==null||f.end(),h.current=null},[])}function Kn(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const s=e.ownerDocument.defaultView??window,n=new s.ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const[o]=a;let l,i;if("borderBoxSize"in o){const c=o.borderBoxSize,h=Array.isArray(c)?c[0]:c;l=h.inlineSize,i=h.blockSize}else l=e.offsetWidth,i=e.offsetHeight;t({width:l,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}var Wn=globalThis!=null&&globalThis.document?u.useLayoutEffect:u.useEffect;function Yn(e,t){var s,n;if(!e||!e.parentElement)return;const a=(n=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?n:window,o=new a.MutationObserver(()=>{t()});return o.observe(e.parentElement,{childList:!0}),()=>{o.disconnect()}}function Xn({getNodes:e,observeMutation:t=!0}){const[s,n]=u.useState([]),[a,o]=u.useState(0);return Wn(()=>{const l=e(),i=l.map((c,h)=>Kn(c,m=>{n(f=>[...f.slice(0,h),m,...f.slice(h+1)])}));if(t){const c=l[0];i.push(Yn(c,()=>{o(h=>h+1)}))}return()=>{i.forEach(c=>{c==null||c()})}},[a]),s}function Zn(e){return typeof e=="object"&&e!==null&&"current"in e}function qn(e){const[t]=Xn({observeMutation:!1,getNodes(){return[Zn(e)?e.current:e]}});return t}function Jn(e){var t;const{min:s=0,max:n=100,onChange:a,value:o,defaultValue:l,isReversed:i,direction:c="ltr",orientation:h="horizontal",id:m,isDisabled:f,isReadOnly:g,onChangeStart:x,onChangeEnd:j,step:y=1,getAriaValueText:S,"aria-valuetext":E,"aria-label":F,"aria-labelledby":J,name:O,focusThumbOnChange:k=!0,...P}=e,Le=be(x),G=be(j),Oe=be(S),T=En({isReversed:i,direction:c,orientation:h}),[Et,de]=Qt({value:o,defaultValue:l??es(s,n),onChange:a}),[he,Ge]=u.useState(!1),[fe,Ue]=u.useState(!1),me=!(f||g),pe=(n-s)/10,U=y||(n-s)/100,b=je(Et,s,n),Nt=n-b+s,He=at(T?Nt:b,s,n),Q=h==="vertical",w=wt({min:s,max:n,step:y,isDisabled:f,value:b,isInteractive:me,isReversed:T,isVertical:Q,eventSource:null,focusThumbOnChange:k,orientation:h}),xe=u.useRef(null),ge=u.useRef(null),Ke=u.useRef(null),_t=u.useId(),We=m??_t,[Ye,Xe]=[`slider-thumb-${We}`,`slider-track-${We}`],Mt=u.useCallback(d=>{var p,H;if(!xe.current)return;const C=w.current;C.eventSource="pointer";const M=xe.current.getBoundingClientRect(),{clientX:ye,clientY:Vt}=(H=(p=d.touches)==null?void 0:p[0])!=null?H:d,Bt=Q?M.bottom-Vt:ye-M.left,Lt=Q?M.height:M.width;let Se=Bt/Lt;T&&(Se=1-Se);let K=cn(Se,C.min,C.max);return C.step&&(K=parseFloat(rt(K,C.min,C.step))),K=je(K,C.min,C.max),K},[Q,T,w]),D=u.useCallback(d=>{const p=w.current;p.isInteractive&&(d=parseFloat(rt(d,p.min,U)),d=je(d,p.min,p.max),de(d))},[U,de,w]),R=u.useMemo(()=>({stepUp(d=U){const p=T?b-d:b+d;D(p)},stepDown(d=U){const p=T?b+d:b-d;D(p)},reset(){D(l||0)},stepTo(d){D(d)}}),[D,T,b,U,l]),Ze=u.useCallback(d=>{const p=w.current,C={ArrowRight:()=>R.stepUp(),ArrowUp:()=>R.stepUp(),ArrowLeft:()=>R.stepDown(),ArrowDown:()=>R.stepDown(),PageUp:()=>R.stepUp(pe),PageDown:()=>R.stepDown(pe),Home:()=>D(p.min),End:()=>D(p.max)}[d.key];C&&(d.preventDefault(),d.stopPropagation(),C(d),p.eventSource="keyboard")},[R,D,pe,w]),qe=(t=Oe==null?void 0:Oe(b))!=null?t:E,ve=qn(ge),{getThumbStyle:Je,rootStyle:Qe,trackStyle:et,innerTrackStyle:tt}=u.useMemo(()=>{const d=w.current,p=ve??{width:0,height:0};return Tn({isReversed:T,orientation:d.orientation,thumbRects:[p],thumbPercents:[He]})},[T,ve,He,w]),nt=u.useCallback(()=>{w.current.focusThumbOnChange&&setTimeout(()=>{var p;return(p=ge.current)==null?void 0:p.focus()})},[w]);Ot(()=>{const d=w.current;nt(),d.eventSource==="keyboard"&&(G==null||G(d.value))},[b,G]);function st(d){const p=Mt(d);p!=null&&p!==w.current.value&&de(p)}Hn(Ke,{onPanSessionStart(d){const p=w.current;p.isInteractive&&(Ge(!0),nt(),st(d),Le==null||Le(p.value))},onPanSessionEnd(){const d=w.current;d.isInteractive&&(Ge(!1),G==null||G(d.value))},onPan(d){w.current.isInteractive&&st(d)}});const Dt=u.useCallback((d={},p=null)=>({...d,...P,ref:we(p,Ke),tabIndex:-1,"aria-disabled":ke(f),"data-focused":$(fe),style:{...d.style,...Qe}}),[P,f,fe,Qe]),Rt=u.useCallback((d={},p=null)=>({...d,ref:we(p,xe),id:Xe,"data-disabled":$(f),style:{...d.style,...et}}),[f,Xe,et]),zt=u.useCallback((d={},p=null)=>({...d,ref:p,style:{...d.style,...tt}}),[tt]),At=u.useCallback((d={},p=null)=>({...d,ref:we(p,ge),role:"slider",tabIndex:me?0:void 0,id:Ye,"data-active":$(he),"aria-valuetext":qe,"aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":b,"aria-orientation":h,"aria-disabled":ke(f),"aria-readonly":ke(g),"aria-label":F,"aria-labelledby":F?void 0:J,style:{...d.style,...Je(0)},onKeyDown:Pe(d.onKeyDown,Ze),onFocus:Pe(d.onFocus,()=>Ue(!0)),onBlur:Pe(d.onBlur,()=>Ue(!1))}),[me,Ye,he,qe,s,n,b,h,f,g,F,J,Je,Ze]),Ft=u.useCallback((d,p=null)=>{const H=!(d.valuen),C=b>=d.value,M=at(d.value,s,n),ye={position:"absolute",pointerEvents:"none",...Qn({orientation:h,vertical:{bottom:T?`${100-M}%`:`${M}%`},horizontal:{left:T?`${100-M}%`:`${M}%`}})};return{...d,ref:p,role:"presentation","aria-hidden":!0,"data-disabled":$(f),"data-invalid":$(!H),"data-highlighted":$(C),style:{...d.style,...ye}}},[f,T,n,s,h,b]),$t=u.useCallback((d={},p=null)=>({...d,ref:p,type:"hidden",value:b,name:O}),[O,b]);return{state:{value:b,isFocused:fe,isDragging:he},actions:R,getRootProps:Dt,getTrackProps:Rt,getInnerTrackProps:zt,getThumbProps:At,getMarkerProps:Ft,getInputProps:$t}}function Qn(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}function es(e,t){return t"}),[ns,ce]=ut({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jt=A((e,t)=>{var s;const n={...e,orientation:(s=e==null?void 0:e.orientation)!=null?s:"horizontal"},a=dt("Slider",n),o=Ae(n),{direction:l}=Gt();o.direction=l;const{getInputProps:i,getRootProps:c,...h}=Jn(o),m=c(),f=i({},t);return r.jsx(ts,{value:h,children:r.jsx(ns,{value:a,children:r.jsxs(_.div,{...m,className:q("chakra-slider",n.className),__css:a.container,children:[n.children,r.jsx("input",{...f})]})})})});jt.displayName="Slider";var kt=A((e,t)=>{const{getThumbProps:s}=ie(),n=ce(),a=s(e,t);return r.jsx(_.div,{...a,className:q("chakra-slider__thumb",e.className),__css:n.thumb})});kt.displayName="SliderThumb";var Pt=A((e,t)=>{const{getTrackProps:s}=ie(),n=ce(),a=s(e,t);return r.jsx(_.div,{...a,className:q("chakra-slider__track",e.className),__css:n.track})});Pt.displayName="SliderTrack";var Ct=A((e,t)=>{const{getInnerTrackProps:s}=ie(),n=ce(),a=s(e,t);return r.jsx(_.div,{...a,className:q("chakra-slider__filled-track",e.className),__css:n.filledTrack})});Ct.displayName="SliderFilledTrack";var ss=A((e,t)=>{const{getMarkerProps:s}=ie(),n=ce(),a=s(e,t);return r.jsx(_.div,{...a,className:q("chakra-slider__marker",e.className),__css:n.mark})});ss.displayName="SliderMark";var De=A(function(t,s){const n=dt("Switch",t),{spacing:a="0.5rem",children:o,...l}=Ae(t),{getIndicatorProps:i,getInputProps:c,getCheckboxProps:h,getRootProps:m,getLabelProps:f}=yn(l),g=u.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...n.container}),[n.container]),x=u.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...n.track}),[n.track]),j=u.useMemo(()=>({userSelect:"none",marginStart:a,...n.label}),[a,n.label]);return r.jsxs(_.label,{...m(),className:ht("chakra-switch",t.className),__css:g,children:[r.jsx("input",{className:"chakra-switch__input",...c({},s)}),r.jsx(_.span,{...h(),className:"chakra-switch__track",__css:x,children:r.jsx(_.span,{__css:n.thumb,className:"chakra-switch__thumb",...i()})}),o&&r.jsx(_.span,{className:"chakra-switch__label",...f(),__css:j,children:o})]})});De.displayName="Switch";function rs(e,t=[]){const s=Object.assign({},e);for(const n of t)n in s&&delete s[n];return s}var as=["h","minH","height","minHeight"],It=A((e,t)=>{const s=Ut("Textarea",e),{className:n,rows:a,...o}=Ae(e),l=en(o),i=a?rs(s,as):s;return r.jsx(_.textarea,{ref:t,rows:a,...l,className:ht("chakra-textarea",n),__css:i})});It.displayName="Textarea";var os=Fe("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),ls=Fe("pin-filled","IconPinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),is=Fe("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]);const cs=({setMediaAct:e,media:t,currentNum:s})=>{const n=l=>{const i=(s+l+t.length)%t.length;e&&e(t[i])},a={width:"100%",height:"100%"};if(t.length===0)return r.jsx("p",{children:"No images found, let's start generating 🪄"});const o=t.at(s);return o?r.jsxs(v,{justifyContent:"center",alignItems:"center",position:"relative",width:a.width,height:a.height,overflow:"hidden",children:[r.jsx("div",{style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%"},onClick:()=>{window.open(o.imageUrl)},children:tn(o.imageUrl)?r.jsx(nn,{src:o.imageUrl,alt:`image-${o.id}`,width:"100%",height:"100%",objectFit:"contain"}):r.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:o.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:r.jsx("track",{kind:"captions"})})},o.id),r.jsx(z,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:r.jsx(os,{}),onClick:()=>n(-1),position:"absolute",left:"0",zIndex:"2"}),r.jsx(z,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:r.jsx(un,{}),onClick:()=>n(1),position:"absolute",right:"0",zIndex:"2"})]}):null},us=({inputItem:e})=>r.jsxs(v,{gap:2,children:[r.jsx(v,{gap:1,alignItems:"center",flexBasis:"200px",children:e.label??e.inputName}),r.jsx(sn,{value:e.inputValue,onChange:t=>{}})]}),ds=e=>{const t=e.inputItem;return r.jsxs(v,{gap:1,direction:"column",children:[r.jsxs(v,{gap:2,children:[r.jsx(v,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsxs(dn,{width:"100%",step:e==null?void 0:e.step,value:t.inputValue,min:e==null?void 0:e.min,max:e==null?void 0:e.max,onChange:s=>{},children:[r.jsx(hn,{}),r.jsxs(fn,{children:[r.jsx(mn,{}),r.jsx(pn,{})]})]})]}),r.jsx(v,{children:r.jsxs(jt,{maxWidth:"400px",step:e==null?void 0:e.step,value:Number(t.inputValue),min:(e==null?void 0:e.min)??0,max:(e==null?void 0:e.max)??100,onChange:s=>{},children:[r.jsx(Pt,{children:r.jsx(Ct,{})}),r.jsx(kt,{})]})})]})},hs=e=>{var s;const{inputItem:t}=e;return r.jsxs(v,{gap:2,children:[r.jsx(v,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(vn,{value:t.inputValue,onChange:n=>{},children:(s=e==null?void 0:e.options)==null?void 0:s.map((n,a)=>r.jsx("option",{value:n,children:n},`select${t.nodeID}${t.inputName}${a}`))})]})},fs=e=>{const t=e.inputItem;return r.jsxs(v,{gap:1,direction:"column",children:[r.jsx(v,{children:t.label??t.inputName}),r.jsx(It,{value:t.inputValue,onChange:s=>{},rows:5})]})};var I=(e=>(e.Input="Input",e.InputSlider="InputSlider",e.Select="Select",e.Textarea="Textarea",e.Checkbox="Checkbox",e.NoSupport="NoSupport",e))(I||{});const ms=e=>r.jsxs(v,{gap:2,children:[r.jsx(v,{gap:1,alignItems:"center",flexBasis:"200px",children:e.inputItem.label??e.inputItem.inputName}),r.jsx(v,{children:"No Support"})]}),ps=e=>{const t=e.inputItem;return r.jsxs(v,{gap:2,children:[r.jsx(v,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(Ve,{defaultChecked:!!t.inputValue,onChange:s=>{var n;(n=e==null?void 0:e.updateMetaData)==null||n.call(e,{promptKey:e.promptKey,name:e.name,value:s.target.checked})}})]})},ue=u.createContext({topFields:[],calcInputList:[],showNodeName:!1,updateTopField(){}}),xs={[I.Input]:us,[I.InputSlider]:ds,[I.Select]:hs,[I.Textarea]:fs,[I.Checkbox]:ps,NoSupport:ms},gs=LiteGraph.registered_node_types;function vs(e,t){var a,o,l,i,c;const s=(a=gs[e])==null?void 0:a.nodeData,n={...((o=s==null?void 0:s.input)==null?void 0:o.required)??{},...((l=s==null?void 0:s.input)==null?void 0:l.optional)??{}}[t];return(n==null?void 0:n[0])==="STRING"?(i=n==null?void 0:n[1])!=null&&i.multiline?{type:I.Textarea}:{type:I.Input}:(n==null?void 0:n[0])==="BOOLEAN"?{type:I.Checkbox}:(n==null?void 0:n[0])==="FLOAT"?{...(n==null?void 0:n[1])??{},type:I.InputSlider}:(n==null?void 0:n[0])==="INT"?{...(n==null?void 0:n[1])??{},type:I.InputSlider}:Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(h=>typeof h=="string"))?{options:n==null?void 0:n[0],type:I.Select}:{type:I.NoSupport}}const Re=({inputItem:e})=>{const t=vs(e.classType,e.inputName),[s,n]=u.useState(!1),a=xs[t.type??"Input"],{updateTopField:o,topFields:l}=u.useContext(ue),i=e.children[0]==="negative"||e.children[0]==="positive"?`-${e.children[0]}`:"",c={...e,label:e.label??e.inputName+i};return r.jsxs(v,{alignItems:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx(z,{size:"xs",onClick:()=>o==null?void 0:o({name:e.inputName,promptKey:e.nodeID,class_type:e.classType}),variant:"ghost",icon:oe(l,{name:e.inputName,promptKey:e.nodeID,classType:e.classType})?r.jsx(ls,{size:14}):r.jsx(is,{size:14}),"aria-label":"pin"}),r.jsx("div",{style:{flex:1},children:r.jsx(a,{inputItem:c,...t})})]})};function ys(){const{topFields:e,updateTopField:t,calcInputList:s}=u.useContext(ue);return e.length===0?null:r.jsx(r.Fragment,{children:r.jsx(v,{px:2,gap:2,direction:"column",children:e==null?void 0:e.map(n=>{const a=s.find(o=>o.nodeID==n.promptKey&&o.inputName===n.name&&o.classType===n.class_type);return!n.class_type||!a?null:r.jsx(Re,{inputItem:a},`formTopField${n.promptKey}${n.name}`)})})})}function Ss(){const{topFields:e,calcInputList:t,showNodeName:s}=u.useContext(ue),n=u.useCallback(o=>{const l=[];return o.forEach(i=>{const c=l[l.length-1];!c||c[0].nodeID!==i.nodeID||c[0].classType!==i.classType?l.push([i]):c.push(i)}),l},[]);if(u.useEffect(()=>{},[s]),!s)return r.jsx(Ee,{children:t.map(o=>oe(e,{name:o.inputName,promptKey:o.nodeID,classType:o.classType})?null:r.jsx(Re,{inputItem:o},`form${o.nodeID}${o.inputName}`))});const a=n(t);return r.jsx(Ee,{children:a.map(o=>o[0]?r.jsx(bs,{title:o[0].classType+" #"+o[0].nodeID,children:r.jsx(v,{px:2,gap:1,direction:"column",children:o.map(l=>oe(e,{name:l.inputName,promptKey:l.nodeID,classType:l.classType})?null:r.jsx(Re,{inputItem:l},`form${l.nodeID}${l.inputName}`))})},o[0].nodeID):null)})}function bs({title:e,children:t}){return r.jsxs(ft,{border:"1px",borderColor:"gray.500",borderRadius:"md",p:4,children:[r.jsx(V,{size:"sm",mb:1,color:"GrayText",children:e}),r.jsx("div",{children:t})]})}let ae=[],ze=new Set;function Tt(e,t){if(!ze.has(e.nodeID))return ze.add(e.nodeID),Object.entries(e.inputs).forEach(([s,n])=>{if(Array.isArray(n)){const a=n[0];Tt(t[a],t)}}),Object.entries(e.inputs).forEach(([s,n])=>{Array.isArray(n)||ae.push({classType:e.class_type,inputName:s,inputValue:n,nodeID:e.nodeID,children:e.children||[]})}),ae}function ws(e){ae=[],ze=new Set;for(const t of Object.keys(e))e[t].nodeID=t,Object.entries(e[t].inputs).forEach(([s,n])=>{if(Array.isArray(n)){const a=n[0],o=e[a];o.children||(o.children=[]),o.children.push(s)}});for(const t of Object.keys(e))Tt(e[t],e);return ae}const oe=(e,t)=>e==null?void 0:e.some(s=>s.promptKey===(t==null?void 0:t.promptKey)&&s.name===(t==null?void 0:t.name)&&s.class_type===t.classType);function js({media:e}){const[t,s]=u.useState([]),{curFlowID:n}=u.useContext($e),[a,o]=u.useState(),[l,i]=u.useState(!0),[c,h]=u.useState(!0);u.useEffect(()=>{e?rn(`/workspace/view_media?filename=${e.localPath}`).then(x=>{o(x.prompt)}):ot.graphToPrompt(ot.graph).then(x=>{o(x.output)})},[e]),u.useEffect(()=>{if(!a)return;const x=ws(a);s(x)},[a]);const[m,f]=u.useState([]);u.useEffect(()=>{(async()=>{var x,j;if(n){const y=(j=await((x=ne)==null?void 0:x.get(n)))==null?void 0:j.topFieldsConfig;y&&(f(y),i(!1))}})()},[n]);const g=x=>{var j,y;if(oe(m,{name:x.name,promptKey:x==null?void 0:x.promptKey,classType:(x==null?void 0:x.class_type)??""})){const S=m.filter(E=>E.name!==x.name||E.promptKey!==x.promptKey);f(S),n&&((j=ne)==null||j.updateTopFields(n,{topFieldsConfig:S}))}else{const S=[...m,x];f(S),n&&((y=ne)==null||y.updateTopFields(n,{topFieldsConfig:S}))}};return r.jsx(ue.Provider,{value:{topFields:m,showNodeName:c,calcInputList:t,updateTopField:g},children:r.jsxs(v,{direction:"column",align:"stretch",gap:5,children:[r.jsx(ys,{}),r.jsxs(Y,{children:[r.jsx("p",{children:"Show all inputs"}),r.jsx(De,{isChecked:l,onChange:x=>i(!l)}),r.jsx("p",{children:"Show node names"}),r.jsx(De,{isChecked:c,onChange:x=>h(!c)})]}),l&&r.jsx(Ss,{})]})})}const ks=({media:e})=>r.jsxs(v,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[r.jsxs(v,{flexWrap:"wrap",gap:3,children:[r.jsx(v,{alignItems:"center",gap:2,children:(e==null?void 0:e.localPath)&&r.jsxs(r.Fragment,{children:[r.jsx(V,{children:e==null?void 0:e.localPath}),r.jsx(W,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e==null?void 0:e.localPath}`,download:e==null?void 0:e.localPath,children:r.jsx(z,{size:"sm",icon:r.jsx(mt,{size:19}),"aria-label":"donwload image from gallery"})})})]})}),r.jsx(v,{gap:1,alignItems:"center",color:"GrayText",children:!!(e!=null&&e.createTime)&&r.jsxs(r.Fragment,{children:[r.jsx(V,{children:"Created:"}),r.jsx(V,{children:pt((e==null?void 0:e.createTime)??0,!0)})]})})]}),r.jsx(js,{media:e??null})]}),Be=u.createContext({showAllImages:!1,curMedia:null,setCurMedia(){},setMediaList(){},setShowAllImages(){}}),Te=120;function Ps({mediaList:e}){const{curMedia:t,setCurMedia:s}=u.useContext(Be);return r.jsxs(v,{gap:3,h:"100%",children:[r.jsxs(Sn,{gridTemplateRows:e.length<=6?"1fr 20%":"1fr",flex:1,gap:2,children:[r.jsx(cs,{media:e.map(n=>({id:n.id,imageUrl:`/workspace/view_media?filename=${n.localPath}`})),currentNum:(e==null?void 0:e.findIndex(n=>n.id===(t==null?void 0:t.id)))??0,setMediaAct:n=>s((e==null?void 0:e.find(a=>a.id===n.id))??null)}),r.jsx(v,{wrap:"wrap",children:e==null?void 0:e.map(n=>r.jsx(ft,{display:"inline-block",p:1,borderRadius:"4px",width:`${Te+3}px`,height:`${Te+3}px`,cursor:"pointer",border:(t==null?void 0:t.id)===n.id?"1px solid gray":"",onClick:()=>s(n),children:r.jsx(xt,{mediaLocalPath:n.localPath,size:Te,objectFit:"contain",hideBrokenImage:!0,onBrokenLink:()=>{var a;(a=L)==null||a.delete(n.id)}})},`image-bottom-${n.id}`))})]}),r.jsx(ks,{media:t??void 0})]})}const Cs=({media:e,isSelecting:t,selectedID:s,onClickMedia:n})=>{const{curFlowID:o,loadFilePath:l}=u.useContext($e),{showDialog:i}=Ht();if(e.localPath==null||o==null)return null;const c=r.jsxs(Ne,{isExternal:!0,onClick:()=>n(e),position:"relative",children:[t&&r.jsx(Ve,{isChecked:s.includes(e.id),position:"absolute",top:2,left:2}),r.jsx(xt,{mediaLocalPath:e.localPath,size:180,onBrokenLink:()=>{var h;(h=L)==null||h.delete(e.id)},hideBrokenImage:!0,autoPlay:!0,isPreview:!0})]});return r.jsxs(Ee,{width:180,mb:2,children:[r.jsx(W,{label:pt(e.createTime,!0),children:c}),r.jsx(W,{label:e.localPath,children:r.jsx(V,{color:"GrayText",noOfLines:1,children:e.localPath})}),r.jsxs(Y,{hidden:t,gap:0,children:[r.jsx(Kt,{flexGrow:1,onClick:()=>i("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{l(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>l(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),r.jsx(W,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e.localPath}`,download:e.localPath,children:r.jsx(z,{size:"sm",variant:"ghost",icon:r.jsx(mt,{size:19}),"aria-label":"donwload image from gallery"})})}),r.jsx(W,{label:"Remove image from gallery",children:r.jsx(z,{size:"sm",variant:"ghost",icon:r.jsx(an,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var m;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&await((m=L)==null?void 0:m.delete(e.id))}})})]})]})},Is=Cs;function Ts({searchQuery:e}){const[t,s]=u.useState([]),{setCurMedia:n,setShowAllImages:a,setMediaList:o}=u.useContext(Be);u.useEffect(()=>{var i,c;e===""?(i=L)==null||i.listAll().then(h=>{s(h.slice(0,50)??[])}):(c=L)==null||c.filter(h=>{var m;return((m=h.workflowJSON)==null?void 0:m.includes(e))??!1}).then(h=>{s(h)})},[e]);const l=i=>{o([i].concat(t.filter(c=>c.id!==i.id))),n(i),a(!1)};return r.jsx(Y,{wrap:"wrap",children:t.map(i=>r.jsx(Is,{selectedID:[],media:i,isSelecting:!1,onClickMedia:l},i.id))})}function Ls({onclose:e}){const{curFlowID:t}=u.useContext($e),[s,n]=u.useState(""),[a,o]=u.useState([]),[l,i]=u.useState(!1),[c,h]=u.useState(""),[m,f]=u.useState([]),[g,x]=u.useState(),[j,y]=u.useState(""),S=xn(j,300),[E,F]=u.useState(!1),J=async()=>{var P;if(t==null)return;const k=await((P=L)==null?void 0:P.listByWorkflowID(t));f(k??[]),k!=null&&k.length&&x(k[0])};if(u.useEffect(()=>{var k;J(),t&&((k=ne)==null||k.get(t).then(P=>{P&&(n(P.name),P!=null&&P.coverMediaPath&&h(P==null?void 0:P.coverMediaPath))}))},[]),t==null)return null;const O=m.length>0&&a.length===m.length;return r.jsx(Be.Provider,{value:{curMedia:g??null,setCurMedia:x,setMediaList:f,showAllImages:E,setShowAllImages:F},children:r.jsxs(Wt,{isOpen:!0,onClose:e,blockScrollOnMount:!0,children:[r.jsx(Yt,{}),r.jsxs(Xt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[r.jsxs(Zt,{children:[r.jsxs(Y,{gap:2,mb:2,children:[r.jsxs(on,{size:"md",mr:2,children:["Gallery - ",s]}),r.jsx(gn,{searchValue:j,onUpdateSearchValue:k=>{y(k),E||F(!0)},placeholder:"Search prompt, model name, etc.",style:{width:"300px"}})]}),l&&r.jsxs(Y,{gap:3,children:[r.jsx(Ve,{isChecked:O,onChange:()=>{o(O?[]:m.map(k=>k.id))},children:"All"}),r.jsxs(V,{fontSize:16,children:[a.length," Selected"]}),r.jsx(z,{size:"sm",icon:r.jsx(ln,{size:19}),onClick:()=>i(!1),"aria-label":"cancel"})]})]}),r.jsx(qt,{}),r.jsx(Jt,{overflowY:"auto",children:E?r.jsx(Ts,{searchQuery:S}):r.jsx(Ps,{mediaList:m})})]})]})})}export{Ls as default};
diff --git a/dist/workspace_web/IconCopy-BoJadUqc.js b/dist/workspace_web/IconCopy-BoJadUqc.js
deleted file mode 100644
index dda40d2..0000000
--- a/dist/workspace_web/IconCopy-BoJadUqc.js
+++ /dev/null
@@ -1 +0,0 @@
-import{h as a}from"./App-49F9REmv.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I};
diff --git a/dist/workspace_web/IconSearch-TfsRN_aS.js b/dist/workspace_web/IconSearch-TfsRN_aS.js
deleted file mode 100644
index bd0cbb3..0000000
--- a/dist/workspace_web/IconSearch-TfsRN_aS.js
+++ /dev/null
@@ -1 +0,0 @@
-import{h as a}from"./App-49F9REmv.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I};
diff --git a/dist/workspace_web/InstallMissingModelsButton-fzyBTPg6.js b/dist/workspace_web/InstallMissingModelsButton-fzyBTPg6.js
deleted file mode 100644
index 81dabcf..0000000
--- a/dist/workspace_web/InstallMissingModelsButton-fzyBTPg6.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as o,j as e,i as C,P as F}from"./input.js";import{app as x}from"/scripts/app.js";import{aS as k,k as I,l as v,H as y,n as S,al as E,ab as b,av as A,a7 as D,aA as z,j as H,B as L,ae as T,af as P,aT as R,F as G,an as O,aH as N}from"./App-49F9REmv.js";import{G as U,i as W}from"./ModelManagerTopbar-rYC0nrt7.js";import{C as q,G as B}from"./chunk-JARCRF6W-QWMsZMLI.js";import{S as K}from"./chunk-3RSXBRAN-crwOgWRE.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";const Y="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png",$="https://images.crunchbase.com/image/upload/c_pad,h_170,w_170,f_auto,b_white,q_auto:eco,dpr_1/gtxrcmtsvpjjevozblfa";function V({model:l,selectedModelDeps:c,setSelectedModelDeps:n,foldersList:d,setFoldersList:h}){var m,t,a,g,_;const[s,u]=o.useState(),p=(a=(t=(m=x.graph.extra)==null?void 0:m[k])==null?void 0:t.deps)==null?void 0:a.models;o.useEffect(()=>{(async()=>{var f;if(p){const M=p[l.received_value];if((f=p[l.received_value])!=null&&f.downloadUrl){const w=await A.models.where({fileHash:M.fileHash}).toArray();w[0]?u({existingModel:w[0].fileName}):u(M)}}})()},[]);const j=c.map(i=>i.filename);function r(i){return i.existingModel!=null}return e.jsx(U,{p:3,shadow:"md",borderWidth:"1px",children:e.jsxs(I,{align:"start",children:[e.jsx(v,{children:l.class_type}),e.jsx(y,{ml:3,children:e.jsx(v,{color:"red.400",children:l.received_value})}),s&&r(s)&&e.jsxs(v,{children:["This model is already installed as"," ",e.jsx(v,{as:"span",color:"blue.400",fontWeight:600,children:s.existingModel})]}),s&&!r(s)&&s.fileFolder&&e.jsxs(e.Fragment,{children:[e.jsxs(y,{children:[e.jsx(q,{size:"sm",isChecked:j.includes(s.filename),onChange:i=>{i.target.checked?n([...c,p[l.received_value]]):n(c.filter(f=>f.filename!==s.filename))}},s.filename),e.jsx(S,{label:s.infoUrl,children:e.jsx(C,{size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.infoUrl??"","_blank")},leftIcon:e.jsx(E,{width:5,src:(g=s.downloadUrl)!=null&&g.includes("huggingface")?Y:$}),rightIcon:e.jsx(b,{size:20}),children:s.filename})})]}),e.jsxs(I,{children:[e.jsx(v,{width:"fit-content",children:"Install path:"}),((_=d[s.fileFolder])==null?void 0:_.length)&&e.jsx(K,{value:d[s.fileFolder].at(0),onChange:i=>{const f={...d},M=f[s.fileFolder].filter(w=>w!==i.target.value);f[s.fileFolder]=[i.target.value,...M],h(f)},children:d[s.fileFolder].map(i=>e.jsx("option",{value:i,children:i},i))})]})]}),!s&&e.jsx(C,{colorScheme:"blue",mt:5,iconSpacing:1,leftIcon:e.jsx(b,{size:20}),size:"sm",onClick:()=>{window.open(`https://civitai.com/search/models?sortBy=models_v7&query=${l.received_value}`,"_blank")},children:"Search in CivitAI"})]})})}function X({onClose:l,missingModels:c}){o.useEffect(()=>(x.canvasEl.addEventListener("click",l),()=>{x.canvasEl.removeEventListener("click",l)}),[]);const[n,d]=o.useState([]),[h,s]=o.useState({}),{setRoute:u}=o.useContext(D),p=o.useCallback(async()=>{const t=await z();t&&s(t)},[]),j=H();o.useEffect(()=>{p()},[]);const r=480,m=()=>{n.forEach(t=>{let a=t.downloadUrl;if(!a||!t.fileFolder||!h[t.fileFolder][0]){j({title:"Error",description:a?"Model install folder path is missing":"Download URL is missing",status:"error",duration:4e3,isClosable:!0});return}if(a.includes("civitai")){const g=N();g&&(a+=`?token=${g}`)}W({file_hash:t.fileHash??void 0,filename:t.filename,save_path:h[t.fileFolder][0],url:a,force_filename:!0})}),j({title:"Installing...Please open Install Models modal or python terminal to view progress.",description:n.map(t=>t.filename).join(", "),status:"info",duration:4e3,isClosable:!0}),u("installModels")};return e.jsx(F,{children:e.jsx(L,{style:{width:r},children:e.jsxs(T,{width:r,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:P,overflowY:"auto",children:[e.jsx(R,{children:e.jsx(G,{justifyContent:"space-between",alignContent:"center",children:e.jsx(O,{size:"md",mr:2,children:"Missing Models"})})}),e.jsxs(C,{width:"fit-content",colorScheme:"teal",size:"sm",onClick:m,children:["Install Selected (",n.length,")"]}),e.jsx(B,{templateColumns:"1",gap:1,marginTop:2,width:"100%",children:c.map(t=>e.jsx(V,{model:t,setSelectedModelDeps:d,selectedModelDeps:n,foldersList:h,setFoldersList:s},t.received_value))})]})})})}function le({}){const[l,c]=o.useState(!1),[n,d]=o.useState([]);return o.useEffect(()=>{const h=x.queuePrompt;x.queuePrompt=async function(){var s,u;try{await h.apply(this,arguments)}finally{if(!((u=(s=x.graph.extra)==null?void 0:s[k])==null?void 0:u.deps))return;const j=x.lastNodeErrors??{};d(Object.values(j).flatMap(r=>{var m,t;return(t=(m=r==null?void 0:r.errors)==null?void 0:m.filter(a=>(a==null?void 0:a.type)==="value_not_in_list"))==null?void 0:t.map(a=>{const{input_name:g,received_value:_}=a.extra_info;return{class_type:r.class_type,input_name:g,received_value:_}})}))}}},[]),n.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs(C,{size:"sm","aria-label":"missing models",px:2,onClick:()=>c(!0),colorScheme:"teal",children:["Install Missing (",n.length,")"]}),l&&e.jsx(X,{onClose:()=>c(!1),missingModels:n})]})}export{le as default};
diff --git a/dist/workspace_web/MediaPreview-GWdoyYIm.js b/dist/workspace_web/MediaPreview-GWdoyYIm.js
deleted file mode 100644
index b6ac8db..0000000
--- a/dist/workspace_web/MediaPreview-GWdoyYIm.js
+++ /dev/null
@@ -1 +0,0 @@
-import{d as M,r as s,j as f,I as Ee,y as Oe,e as Be,m as ae,s as C,q as se,b as Pe,f as j,g as Y,l as Ke,o as Ue,h as Me}from"./input.js";import{ao as Ge,ap as qe,h as He,B as Le,I as $e,G as ze,o as We,ak as Xe,al as Ye}from"./App-49F9REmv.js";import{I as Je}from"./IconSearch-TfsRN_aS.js";function Qe(n){const e=parseFloat(n);return typeof e!="number"||Number.isNaN(e)?0:e}function le(n,e){let r=Qe(n);const a=10**(e??10);return r=Math.round(r*a)/a,e?r.toFixed(e):r.toString()}function oe(n){if(!Number.isFinite(n))return 0;let e=1,r=0;for(;Math.round(n*e)/e!==n;)e*=10,r+=1;return r}function It(n,e,r){return(n-e)*100/(r-e)}function yt(n,e,r){return(r-e)*n+e}function Ct(n,e,r){const a=Math.round((n-e)/r)*r+e,u=oe(r);return le(a,u)}function Ze(n,e,r){return n==null?n:(r{var p;return a==null?"":(p=ue(a,o,r))!=null?p:""}),S=typeof u<"u",x=S?u:I,O=Fe(A(x),o),F=r??O,y=s.useCallback(p=>{p!==x&&(S||k(p.toString()),h==null||h(p.toString(),A(p)))},[h,S,x]),w=s.useCallback(p=>{let d=p;return b&&(d=Ze(d,i,m)),le(d,F)},[F,b,m,i]),B=s.useCallback((p=o)=>{let d;x===""?d=A(p):d=A(x)+p,d=w(d),y(d)},[w,o,y,x]),K=s.useCallback((p=o)=>{let d;x===""?d=A(-p):d=A(x)-p,d=w(d),y(d)},[w,o,y,x]),U=s.useCallback(()=>{var p;let d;a==null?d="":d=(p=ue(a,o,r))!=null?p:i,y(d)},[a,r,o,y,i]),Q=s.useCallback(p=>{var d;const ee=(d=ue(p,o,F))!=null?d:i;y(ee)},[F,o,y,i]),E=A(x);return{isOutOfRange:E>m||Ef.jsx(Ee,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),nt=n=>f.jsx(Ee,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Ae(n,e,r,a){s.useEffect(()=>{var u;if(!n.current||!a)return;const o=(u=n.current.ownerDocument.defaultView)!=null?u:window,i=Array.isArray(e)?e:[e],m=new o.MutationObserver(b=>{for(const h of b)h.type==="attributes"&&h.attributeName&&i.includes(h.attributeName)&&r(h)});return m.observe(n.current,{attributes:!0,attributeFilter:i}),()=>m.disconnect()})}function rt(n,e){const r=M(n);s.useEffect(()=>{let a=null;const u=()=>r();return e!==null&&(a=window.setInterval(u,e)),()=>{a&&window.clearInterval(a)}},[e,r])}var at=50,ke=300;function st(n,e){const[r,a]=s.useState(!1),[u,o]=s.useState(null),[i,m]=s.useState(!0),b=s.useRef(null),h=()=>clearTimeout(b.current);rt(()=>{u==="increment"&&n(),u==="decrement"&&e()},r?at:null);const I=s.useCallback(()=>{i&&n(),b.current=setTimeout(()=>{m(!1),a(!0),o("increment")},ke)},[n,i]),k=s.useCallback(()=>{i&&e(),b.current=setTimeout(()=>{m(!1),a(!0),o("decrement")},ke)},[e,i]),S=s.useCallback(()=>{m(!0),a(!1),h()},[]);return s.useEffect(()=>()=>h(),[]),{up:I,down:k,stop:S,isSpinning:r}}var ut=/^[Ee0-9+\-.]$/;function ot(n){return ut.test(n)}function lt(n,e){if(n.key==null)return!0;const r=n.ctrlKey||n.altKey||n.metaKey;return!(n.key.length===1)||r?!0:e(n.key)}function it(n={}){const{focusInputOnChange:e=!0,clampValueOnBlur:r=!0,keepWithinRange:a=!0,min:u=Number.MIN_SAFE_INTEGER,max:o=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:m,isDisabled:b,isRequired:h,isInvalid:I,pattern:k="[0-9]*(.[0-9]+)?",inputMode:S="decimal",allowMouseWheel:x,id:O,onChange:F,precision:y,name:w,"aria-describedby":B,"aria-label":K,"aria-labelledby":U,onFocus:Q,onBlur:E,onInvalid:ce,getAriaValueText:de,isValidCharacter:Z,format:p,parse:d,...ee}=n,te=M(Q),pe=M(E),V=M(ce),G=M(Z??ot),ne=M(de),l=et(n),{update:T,increment:me,decrement:fe}=l,[Ve,re]=s.useState(!1),q=!(m||b),_=s.useRef(null),H=s.useRef(null),be=s.useRef(null),ve=s.useRef(null),L=s.useCallback(t=>t.split("").filter(G).join(""),[G]),$=s.useCallback(t=>{var c;return(c=d==null?void 0:d(t))!=null?c:t},[d]),R=s.useCallback(t=>{var c;return((c=p==null?void 0:p(t))!=null?c:t).toString()},[p]);Oe(()=>{(l.valueAsNumber>o||l.valueAsNumber{if(!_.current)return;if(_.current.value!=l.value){const c=$(_.current.value);l.setValue(L(c))}},[$,L]);const z=s.useCallback((t=i)=>{q&&me(t)},[me,q,i]),W=s.useCallback((t=i)=>{q&&fe(t)},[fe,q,i]),g=st(z,W);Ae(be,"disabled",g.stop,g.isSpinning),Ae(ve,"disabled",g.stop,g.isSpinning);const he=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;const v=$(t.currentTarget.value);T(L(v)),H.current={start:t.currentTarget.selectionStart,end:t.currentTarget.selectionEnd}},[T,L,$]),ge=s.useCallback(t=>{var c,v,N;te==null||te(t),H.current&&(t.target.selectionStart=(v=H.current.start)!=null?v:(c=t.currentTarget.value)==null?void 0:c.length,t.currentTarget.selectionEnd=(N=H.current.end)!=null?N:t.currentTarget.selectionStart)},[te]),xe=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;lt(t,G)||t.preventDefault();const c=Ne(t)*i,v=t.key,P={ArrowUp:()=>z(c),ArrowDown:()=>W(c),Home:()=>T(u),End:()=>T(o)}[v];P&&(t.preventDefault(),P(t))},[G,i,z,W,T,u,o]),Ne=t=>{let c=1;return(t.metaKey||t.ctrlKey)&&(c=.1),t.shiftKey&&(c=10),c},Ie=s.useMemo(()=>{const t=ne==null?void 0:ne(l.value);if(t!=null)return t;const c=l.value.toString();return c||void 0},[l.value,ne]),ye=s.useCallback(()=>{let t=l.value;if(l.value==="")return;/^[eE]/.test(l.value.toString())?l.setValue(""):(l.valueAsNumbero&&(t=o),l.cast(t))},[l,o,u]),Ce=s.useCallback(()=>{re(!1),r&&ye()},[r,re,ye]),X=s.useCallback(()=>{e&&requestAnimationFrame(()=>{var t;(t=_.current)==null||t.focus()})},[e]),Se=s.useCallback(t=>{t.preventDefault(),g.up(),X()},[X,g]),we=s.useCallback(t=>{t.preventDefault(),g.down(),X()},[X,g]);Ge(()=>_.current,"wheel",t=>{var c,v;const P=((v=(c=_.current)==null?void 0:c.ownerDocument)!=null?v:document).activeElement===_.current;if(!x||!P)return;t.preventDefault();const D=Ne(t)*i,_e=Math.sign(t.deltaY);_e===-1?z(D):_e===1&&W(D)},{passive:!1});const Te=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMax;return{...t,ref:ae(c,be),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||Se(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMax,a,Se,g.stop,b]),De=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMin;return{...t,ref:ae(c,ve),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||we(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMin,a,we,g.stop,b]),je=s.useCallback((t={},c=null)=>{var v,N,P,D;return{name:w,inputMode:S,type:"text",pattern:k,"aria-labelledby":U,"aria-label":K,"aria-describedby":B,id:O,disabled:b,...t,readOnly:(v=t.readOnly)!=null?v:m,"aria-readonly":(N=t.readOnly)!=null?N:m,"aria-required":(P=t.required)!=null?P:h,required:(D=t.required)!=null?D:h,ref:ae(_,c),value:R(l.value),role:"spinbutton","aria-valuemin":u,"aria-valuemax":o,"aria-valuenow":Number.isNaN(l.valueAsNumber)?void 0:l.valueAsNumber,"aria-invalid":se(I??l.isOutOfRange),"aria-valuetext":Ie,autoComplete:"off",autoCorrect:"off",onChange:C(t.onChange,he),onKeyDown:C(t.onKeyDown,xe),onFocus:C(t.onFocus,ge,()=>re(!0)),onBlur:C(t.onBlur,pe,Ce)}},[w,S,k,U,K,R,B,O,b,h,m,I,l.value,l.valueAsNumber,l.isOutOfRange,u,o,Ie,he,xe,ge,pe,Ce]);return{value:R(l.value),valueAsNumber:l.valueAsNumber,isFocused:Ve,isDisabled:b,isReadOnly:m,getIncrementButtonProps:Te,getDecrementButtonProps:De,getInputProps:je,htmlProps:ee}}var[ct,J]=Pe({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[dt,ie]=Pe({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),pt=j(function(e,r){const a=Ke("NumberInput",e),u=Ue(e),o=qe(u),{htmlProps:i,...m}=it(o),b=s.useMemo(()=>m,[m]);return f.jsx(dt,{value:b,children:f.jsx(ct,{value:a,children:f.jsx(Y.div,{...i,ref:r,className:Me("chakra-numberinput",e.className),__css:{position:"relative",zIndex:0,...a.root}})})})});pt.displayName="NumberInput";var mt=j(function(e,r){const a=J();return f.jsx(Y.div,{"aria-hidden":!0,ref:r,...e,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...a.stepperGroup}})});mt.displayName="NumberInputStepper";var ft=j(function(e,r){const{getInputProps:a}=ie(),u=a(e,r),o=J();return f.jsx(Y.input,{...u,className:Me("chakra-numberinput__field",e.className),__css:{width:"100%",...o.field}})});ft.displayName="NumberInputField";var Re=Y("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),bt=j(function(e,r){var a;const u=J(),{getDecrementButtonProps:o}=ie(),i=o(e,r);return f.jsx(Re,{...i,__css:u.stepper,children:(a=e.children)!=null?a:f.jsx(tt,{})})});bt.displayName="NumberDecrementStepper";var vt=j(function(e,r){var a;const{getIncrementButtonProps:u}=ie(),o=u(e,r),i=J();return f.jsx(Re,{...o,__css:i.stepper,children:(a=e.children)!=null?a:f.jsx(nt,{})})});vt.displayName="NumberIncrementStepper";var St=He("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);const wt=(n,e)=>{const[r,a]=s.useState(n);return s.useEffect(()=>{const u=setTimeout(()=>{a(n)},e);return()=>{clearTimeout(u)}},[n,e]),r},ht={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function _t(n){const{searchValue:e,onUpdateSearchValue:r,style:a}=n,u=e!=="";return f.jsxs(Le,{style:{position:"relative",...a},mb:2,children:[f.jsx(Je,{style:ht}),u&&f.jsx($e,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:f.jsx(ze,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),f.jsx(We,{placeholder:n.placeholder??"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:o})=>r(o.value)})]})}function At({mediaLocalPath:n,size:e,isPreview:r,autoPlay:a,hideBrokenImage:u,objectFit:o,onBrokenLink:i}){const[m,b]=s.useState(!0);return s.useEffect(()=>{u&&(async()=>{try{if((await fetch(r?`/workspace/preview_media?filename=${n}`:`/workspace/view_media?filename=${n}`)).status==404){b(!1),i==null||i();return}}catch(I){console.error("Error checking media exists",I)}})()},[]),m?Xe(n)?f.jsx(Ye,{borderRadius:3,boxSize:`${e}px`,objectFit:o??"cover",src:`/workspace/view_media?filename=${n}`,alt:"workflow image renamed or moved from output folder"}):f.jsx("div",{style:{width:e+"px",height:e+"px",overflow:"hidden",position:"relative"},children:f.jsx("video",{width:e,height:e,src:`/workspace/view_media?filename=${n}`,loop:!0,autoPlay:a??!1,muted:!0,style:{objectFit:"cover",width:"100%",height:"100%"},children:f.jsx("track",{kind:"captions"})})}):null}export{St as I,At as M,pt as N,_t as S,ft as a,mt as b,Ze as c,vt as d,bt as e,yt as p,Ct as r,wt as u,It as v};
diff --git a/dist/workspace_web/ModelManagerTopbar-rYC0nrt7.js b/dist/workspace_web/ModelManagerTopbar-rYC0nrt7.js
deleted file mode 100644
index 897512f..0000000
--- a/dist/workspace_web/ModelManagerTopbar-rYC0nrt7.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import{f as q,r as m,j as n,g as $,h as Se,a6 as X,b as $e,o as Ue,l as He,i as A,U as re,P as Ve,ac as qe,N as be,ad as Ye,Q as Ce,S as ke,T as Qe,a0 as Je,M as Xe,O as Ze,R as et,_ as tt}from"./input.js";import{au as st,m as nt,av as G,aw as ae,B as oe,F as R,al as Le,l as N,n as ie,a7 as Ie,ax as ot,p as H,ae as Ee,af as it,an as Ae,o as Z,H as W,ay as Te,az as pe,k as Y,A as rt,aA as Ne,j as De,aB as at,aC as Fe,a1 as lt,a2 as ct,a3 as dt,a4 as ht,a5 as ut,aD as ft,aE as mt,aF as te,aG as pt,aH as gt}from"./App-49F9REmv.js";import{G as xt,C as yt}from"./chunk-JARCRF6W-QWMsZMLI.js";import{app as z}from"/scripts/app.js";import{api as V}from"/scripts/api.js";import{S as ee}from"./chunk-3RSXBRAN-crwOgWRE.js";var Pe=q(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:l,direction:c,align:h,className:d,shouldWrapChildren:f,...u}=e,g=m.useMemo(()=>f?m.Children.map(a,(p,x)=>n.jsx(le,{children:p},x)):a,[a,f]);return n.jsx($.div,{ref:s,className:Se("chakra-wrap",d),...u,children:n.jsx($.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:l,alignItems:h,flexDirection:c,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:g})})});Pe.displayName="Wrap";var le=q(function(e,s){const{className:o,...i}=e;return n.jsx($.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:Se("chakra-wrap__listitem",o),...i})});le.displayName="WrapItem";function ge(t){return nt(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var Oe=q(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:l,rowSpan:c,rowStart:h,...d}=e,f=st({gridArea:o,gridColumn:ge(i),gridRow:ge(c),gridColumnStart:r,gridColumnEnd:a,gridRowStart:h,gridRowEnd:l});return n.jsx($.div,{ref:s,__css:f,...d})});Oe.displayName="GridItem";function vt(t,e,s){return(t-e)*100/(s-e)}X({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});X({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var Mt=X({"0%":{left:"-40%"},"100%":{left:"100%"}}),jt=X({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function wt(t){const{value:e=0,min:s,max:o,valueText:i,getValueText:r,isIndeterminate:a,role:l="progressbar"}=t,c=vt(e,s,o);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":o,"aria-valuemin":s,"aria-valuenow":a?void 0:e,"aria-valuetext":(()=>{if(e!=null)return typeof r=="function"?r(e,c):i})(),role:l},percent:c,value:e}}var[_t,St]=$e({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bt=q((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...l}=t,c=wt({value:i,min:s,max:o,isIndeterminate:r,role:a}),d={height:"100%",...St().filledTrack};return n.jsx($.div,{ref:e,style:{width:`${c.percent}%`,...l.style},...c.bind,...l,__css:d})}),ze=q((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:l,children:c,borderRadius:h,isIndeterminate:d,"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,title:p,role:x,...j}=Ue(t),w=He("Progress",t),C=h??((s=w.track)==null?void 0:s.borderRadius),k={animation:`${jt} 1s linear infinite`},D={...!d&&a&&l&&k,...d&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${Mt} 1s ease infinite normal none running`}},b={overflow:"hidden",position:"relative",...w.track};return n.jsx($.div,{ref:e,borderRadius:C,__css:b,...j,children:n.jsxs(_t,{value:w,children:[n.jsx(bt,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,min:i,max:r,value:o,isIndeterminate:d,css:D,borderRadius:C,title:p,role:x}),c]})})});ze.displayName="Progress";function K(t){return Array.isArray?Array.isArray(t):Re(t)==="[object Array]"}const Ct=1/0;function kt(t){return t==null?"":function(e){if(typeof e=="string")return e;let s=e+"";return s=="0"&&1/e==-Ct?"-0":s}(t)}function F(t){return typeof t=="string"}function Be(t){return typeof t=="number"}function Lt(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Re(t)=="[object Boolean]"}function T(t){return t!=null}function se(t){return!t.trim().length}function Re(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const It=t=>`Missing ${t} property in key`,Et=t=>`Property 'weight' in key '${t}' must be a positive integer`,xe=Object.prototype.hasOwnProperty;class At{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=We(o);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(o=>{o.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function We(t){let e=null,s=null,o=null,i=1,r=null;if(F(t)||K(t))o=t,e=ye(t),s=ve(t);else{if(!xe.call(t,"name"))throw new Error(It("name"));const a=t.name;if(o=a,xe.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Et(a));e=ye(a),s=ve(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function ye(t){return K(t)?t:t.split(".")}function ve(t){return K(t)?t.join("."):t}var M={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(T(r))if(a[l]){const c=r[a[l]];if(!T(c))return;if(l===a.length-1&&(F(c)||Be(c)||Lt(c)))s.push(kt(c));else if(K(c)){o=!0;for(let h=0,d=c.length;h{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,F(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();F(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,o=this.size();s{let a=i.getFn?i.getFn(e):this.getFn(e,i.path);if(T(a)){if(K(a)){let l=[];const c=[{nestedArrIndex:-1,value:a}];for(;c.length;){const{nestedArrIndex:h,value:d}=c.pop();if(T(d))if(F(d)&&!se(d)){let f={v:d,i:h,n:this.norm.get(d)};l.push(f)}else K(d)&&d.forEach((f,u)=>{c.push({nestedArrIndex:u,value:f})})}o.$[r]=l}else if(F(a)&&!se(a)){let l={v:a,n:this.norm.get(a)};o.$[r]=l}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Ge(t,e,{getFn:s=M.getFn,fieldNormWeight:o=M.fieldNormWeight}={}){const i=new ce({getFn:s,fieldNormWeight:o});return i.setKeys(t.map(We)),i.setSources(e),i.create(),i}function J(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=M.distance,ignoreLocation:r=M.ignoreLocation}={}){const a=e/t.length;if(r)return a;const l=Math.abs(o-s);return i?a+l/i:l?1:a}const B=32;function Nt(t,e,s,{location:o=M.location,distance:i=M.distance,threshold:r=M.threshold,findAllMatches:a=M.findAllMatches,minMatchCharLength:l=M.minMatchCharLength,includeMatches:c=M.includeMatches,ignoreLocation:h=M.ignoreLocation}={}){if(e.length>B)throw new Error(`Pattern length exceeds max of ${B}.`);const d=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let g=r,p=u;const x=l>1||c,j=x?Array(f):[];let w;for(;(w=t.indexOf(e,p))>-1;){let b=J(e,{currentLocation:w,expectedLocation:u,distance:i,ignoreLocation:h});if(g=Math.min(b,g),p=w+d,x){let L=0;for(;L=O;v-=1){let _=v-1,S=s[t.charAt(_)];if(x&&(j[_]=+!!S),y[v]=(y[v+1]<<1|1)&S,b&&(y[v]|=(C[v+1]|C[v])<<1|1|C[v+1]),y[v]&Q&&(k=J(e,{errors:b,currentLocation:_,expectedLocation:u,distance:i,ignoreLocation:h}),k<=g)){if(g=k,p=_,p<=u)break;O=Math.max(1,2*u-p)}}if(J(e,{errors:b+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:h})>g)break;C=y}const D={isMatch:p>=0,score:Math.max(.001,k)};if(x){const b=function(L=[],I=M.minMatchCharLength){let O=[],E=-1,y=-1,v=0;for(let _=L.length;v<_;v+=1){let S=L[v];S&&E===-1?E=v:S||E===-1||(y=v-1,y-E+1>=I&&O.push([E,y]),E=-1)}return L[v-1]&&v-E>=I&&O.push([E,v-1]),O}(j,l);b.length?c&&(D.indices=b):D.isMatch=!1}return D}function Dt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Dt(u),startIndex:g})},f=this.pattern.length;if(f>B){let u=0;const g=f%B,p=f-g;for(;u{const{isMatch:w,score:C,indices:k}=Nt(e,p,x,{location:i+j,distance:r,threshold:a,findAllMatches:l,minMatchCharLength:c,includeMatches:o,ignoreLocation:h});w&&(u=!0),f+=C,w&&k&&(d=[...d,...k])});let g={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(g.indices=d),g}}const Me=[];function je(t,e){for(let s=0,o=Me.length;s{if(!T(o.indices)||!o.indices.length)return;const{indices:i,value:r}=o;let a={indices:i,value:r};o.key&&(a.key=o.key.src),o.idx>-1&&(a.refIndex=o.idx),e.matches.push(a)})}function Ot(t,e){e.score=t.score}class U{constructor(e,s={},o){if(this.options={...M,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new At(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof ce))throw new Error("Incorrect 'index' type");this._myIndex=s||Ge(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){T(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let o=0,i=this._docs.length;o{let u=1;f.matches.forEach(({key:g,norm:p,score:x})=>{const j=g?g.weight:null;u*=Math.pow(x===0&&j?Number.EPSILON:x,(j||1)*(d?1:p))}),f.score=u})}(c,{ignoreFieldNorm:l}),r&&c.sort(a),Be(s)&&s>-1&&(c=c.slice(0,s)),function(h,d,{includeMatches:f=M.includeMatches,includeScore:u=M.includeScore}={}){const g=[];return f&&g.push(Pt),u&&g.push(Ot),h.map(p=>{const{idx:x}=p,j={item:d[x],refIndex:x};return g.length&&g.forEach(w=>{w(p,j)}),j})}(c,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=je(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:l})=>{if(!T(r))return;const{isMatch:c,score:h,indices:d}=s.searchIn(r);c&&i.push({item:r,idx:a,matches:[{score:h,value:r,norm:l,indices:d}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=je(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:l})=>{if(!T(a))return;let c=[];o.forEach((h,d)=>{c.push(...this._findMatches({key:h,value:a[d],searcher:s}))}),c.length&&r.push({idx:l,item:a,matches:c})}),r}_findMatches({key:e,value:s,searcher:o}){if(!T(s))return[];let i=[];if(K(s))s.forEach(({v:r,i:a,n:l})=>{if(!T(r))return;const{isMatch:c,score:h,indices:d}=o.searchIn(r);c&&i.push({score:h,key:e,value:r,idx:a,norm:l,indices:d})});else{const{v:r,n:a}=s,{isMatch:l,score:c,indices:h}=o.searchIn(r);l&&i.push({score:c,key:e,value:r,norm:a,indices:h})}return i}}U.version="7.0.0",U.createIndex=Ge,U.parseIndex=function(t,{getFn:e=M.getFn,fieldNormWeight:s=M.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new ce({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},U.config=M;function zt({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(Pe,{children:s.map(i=>n.jsx(le,{children:n.jsx(A,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Bt={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Rt({data:t}){const[e,s]=m.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=m.useState(!t.file_hash),[r,a]=m.useState();m.useEffect(()=>{i(!t.file_hash),l()},[t.file_hash]);const l=async()=>{var d;const h=await G.models.get(t.model_name+"@"+t.model_type);if(h!=null&&(a(h),(d=h.imageUrl)!=null&&d.length&&s(h.imageUrl)),!(h!=null&&h.imageUrl)&&t.file_hash!=null)try{const f=await ae(t.file_hash),u=f.imageUrl;u&&s(u);const g={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:f.modelName??null,civitModelID:f.civitModelID,civitModelVersionID:f.civitModelVersionID,imageUrl:u??null};a(g)}catch{}t.preview&&s(t.preview)},c=h=>{const d=Bt[t.model_type];d&&(h.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),h.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),h.dataTransfer.setData("nodeType",d))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:c,children:[o?n.jsx(R,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(re,{})}):n.jsx(Le,{src:e,draggable:!1,boxSize:"100%",height:150,objectFit:"cover",borderRadius:4,cursor:(r==null?void 0:r.civitModelID)!=null?"pointer":"auto",onClick:()=>{(r==null?void 0:r.civitModelID)==null||(r==null?void 0:r.civitModelVersionID)==null||window.open(`https://civitai.com/models/${r==null?void 0:r.civitModelID}?modelVersionId=${r==null?void 0:r.civitModelVersionID}`)}}),n.jsx(N,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:n.jsxs("span",{children:[t.model_name+t.model_extension,n.jsx("br",{}),t.date.toLocaleDateString()]}),children:n.jsx(N,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:t.model_name+t.model_extension})})]})}function Wt({list:t}){return n.jsx(xt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(Oe,{children:n.jsx(Rt,{data:e})},e.model_name+e.date.getTime()))})}function Gt(){const{setRoute:t}=m.useContext(Ie);return n.jsx(n.Fragment,{children:n.jsx(A,{size:"sm",colorScheme:"teal",onClick:()=>t("installModels"),children:"Install Models"})})}const Kt=()=>{const[t,e]=m.useState(["checkpoints"]),[s,o]=m.useState([]),[i,r]=m.useState(!0);m.useEffect(()=>{a(),V.addEventListener("model_list",async c=>{l(c.detail)})},[]);const a=async()=>{const c=await ot();l(c)},l=async c=>{if(!c)return;r(!1);const h=Array.from(new Set(c.map(f=>f.model_type))),d=h.indexOf("checkpoints");d>=0&&h.splice(d,1),h.unshift("checkpoints"),e(h),o(c.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function $t(){const[t,e]=m.useState(!1),s=()=>{var a;(a=H)==null||a.getSetting("showNsfwModelThumbnail").then(l=>{e(l??!1)})};m.useEffect(()=>{s()},[]);const o=a=>{var c;const l=a.target.checked;(c=H)==null||c.upsert({showNsfwModelThumbnail:l}).then(()=>{s(),i(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},i=async()=>{const a=await G.models.toArray();for(let l=0;l{try{if(a.fileHash==null)return;const c=(await ae(a.fileHash)).imageUrl;G.models.update(a.id,{imageUrl:c??null})}catch{}};return n.jsx(yt,{isChecked:t,onChange:o,children:"Show NSFW"})}function Ut(){const t=async e=>{if(e.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const o=e.dataTransfer.getData("modelRelativePath"),i=e.dataTransfer.getData("nodeType"),r=LiteGraph.createNode(i);r.pos=[e.canvasX,e.canvasY],r.configure({widgets_values:[o]}),z.graph.add(r)};return m.useEffect(()=>(z.canvasEl.addEventListener("drop",t),()=>{z.canvasEl.removeEventListener("drop",t)}),[]),null}function Ht({onClose:t}){const[e,s]=m.useState("checkpoints"),[o,i]=m.useState(""),[r,a]=m.useState("name"),{loading:l,modelTypeList:c,modelsList:h}=Kt(),[d,f]=m.useState([]),[u,g]=m.useState([]);m.useEffect(()=>{x();async function x(){const j=await G.models.toArray();f(h.map(w=>({...w,db:j.find(C=>C.id===w.model_name+"@"+w.model_type)})))}},[h]),m.useEffect(()=>{let x=[];o.length?x=new U(d,{keys:["model_name","db.modelName"]}).search(o).map(C=>C.item):x=h.filter(j=>j.model_type===e).sort((j,w)=>r==="name"?j.model_name.localeCompare(w.model_name):w.date.getTime()-j.date.getTime()),g(x)},[e,h,o,r,d]),m.useEffect(()=>(z.canvasEl.addEventListener("click",t),()=>{z.canvasEl.removeEventListener("click",t)}),[t]);const p=440;return n.jsx(Ve,{children:n.jsxs(oe,{style:{width:p},children:[n.jsxs(Ee,{width:p,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:it,overflowY:"auto",children:[n.jsxs(R,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Ae,{size:"md",mr:2,children:"Models"}),n.jsx(Gt,{})]}),n.jsx(R,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(Z,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(R,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(W,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(ee,{value:r,size:"sm",width:"120px",onChange:x=>a(x.target.value),children:[n.jsx("option",{value:"name",children:"Name"}),n.jsx("option",{value:"date",children:"Date"})]})]}),n.jsx($t,{})]}),!o.length&&n.jsx(zt,{modelTypeList:c,setSelectedModel:s,selectedModel:e}),n.jsx(Wt,{list:u}),l&&n.jsx(R,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(re,{})})]}),n.jsx(Ut,{})]})})}const Vt=async t=>{try{const s=await(await V.fetchApi("/model_manager/install_model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text();window.dispatchEvent(new CustomEvent("model_install_message",{detail:s}))}catch(e){console.error("Failed to connect to the server:",e)}};function we(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function _e(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None");return e&&(s=s??t[0]),s}function qt(t,e=280,s){var o,i,r,a;if(t)return Te(t)?(r=_e((i=(o=t.modelVersions)==null?void 0:o.at(0))==null?void 0:i.images,s))==null?void 0:r.url:`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(a=_e(t.images,s))==null?void 0:a.url}/width=${e}/`}const ne=280;function Yt({model:t,onClickInstallModel:e,installing:s}){var u,g;const[o,i]=m.useState();m.useEffect(()=>{p();async function p(){var j;const x=await((j=H)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(qt(t,ne,x))}},[t]);const r=Te(t)?t.modelVersions:t.versions,[a,l]=m.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),c=r==null?void 0:r.find(p=>(p==null?void 0:p.name)===a),h=()=>{window.open(`https://civitai.com/models/${t.id}`)},d=m.useCallback(()=>{if(c==null){console.error("no file is find by name",a);return}e(pe(c,t.name),t)},[a]),f=(g=pe(c))==null?void 0:g.sizeKB;return n.jsxs(Ee,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(Le,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>h()}),n.jsxs(Y,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(N,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(R,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(A,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(N,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(A,{leftIcon:n.jsx(rt,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>d(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(W,{children:[n.jsx(ee,{size:"md",style:{paddingLeft:4},onChange:p=>{l(p.target.value)},children:r==null?void 0:r.map(p=>{const x=p==null?void 0:p.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},p.id):null})}),f&&n.jsx(ie,{label:we(f),children:n.jsx(N,{flexShrink:1,noOfLines:1,width:"40%",children:we(f)})})]})]})]})}function Qt({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(R,{gap:1,alignItems:"center",grow:1,children:[n.jsx(Z,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(A,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function Jt({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=m.useState(""),[a,l]=m.useState([]),[c,h]=m.useState(""),d=m.useRef(null);m.useEffect(()=>{f()},[]);const f=async()=>{const u=await Ne();u&&(["custom_nodes","config","saved_prompts"].forEach(g=>{delete u[g]}),l(Object.values(u).flatMap(g=>g)))};return n.jsx(qe,{isOpen:t,leastDestructiveRef:d,onClose:s,children:n.jsx(be,{children:n.jsxs(Ye,{children:[n.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(ke,{children:n.jsxs(Y,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(N,{children:"Model download url"}),n.jsx(Z,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>h(u.target.value),value:c})]}),n.jsx(N,{children:"Choose model install folder"}),n.jsx(ee,{placeholder:"Select option",value:i,onChange:u=>r(u.target.value),children:a.map(u=>n.jsx("option",{value:u,children:u},u))})]})}),n.jsxs(Qe,{children:[n.jsx(A,{ref:d,onClick:s,children:"Cancel"}),n.jsx(A,{onClick:()=>o(i,c),ml:3,isDisabled:c.length===0,children:"Confirm"})]})]})})})}function Xt(){const{colorMode:t}=Je(),e=De(),[s,o]=m.useState([]);return m.useEffect(()=>{V.addEventListener("download_progress",i=>{o(i.detail)}),V.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(Y,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,pt:2,children:s.map(({save_path:i,progress:r})=>n.jsxs(W,{children:[n.jsx(N,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx(ze,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(N,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]}),n.jsx(A,{variant:"outline",size:"sm",colorScheme:"red",onClick:()=>at(i),children:"Cancel"})]},i))})}function Zt(){const[t,e]=m.useState(""),{onOpen:s,onClose:o,isOpen:i}=Fe(),r=()=>{ft(t),o()};return n.jsxs(lt,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(ct,{children:n.jsx(A,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(dt,{p:5,children:[n.jsx(ht,{}),n.jsx(ut,{}),n.jsxs(Y,{spacing:4,children:[n.jsx(N,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),n.jsx(Z,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}async function es(t,e){var a,l;const s={queries:[{q:t,indexUid:"models_v7",facets:["category.name","checkpointType","fileFormats","lastVersionAtUnix","tags.name","type","user.username","version.baseModel"],attributesToHighlight:["*"],highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__",limit:80,offset:0}]};return e&&(s.queries[0].filter=[[`"type"="${e}"`]]),((l=(a=await(await fetch("https://meilisearch-v1-6.civitai.com/multi-search",{headers:{"Content-Type":"application/json",Authorization:"Bearer 102312c2b83ea0ef9ac32e7858f742721bbfd7319a957272e746f84fd1e974af"},method:"POST",body:JSON.stringify(s)})).json())==null?void 0:a.results)==null?void 0:l.at(0)).hits??[]}function ts({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=m.useState([]),[r,a]=m.useState(!1),[l,c]=m.useState(s),h=De(),[d,f]=m.useState([]),[u,g]=m.useState(e),{isOpen:p,onOpen:x,onClose:j}=Fe(),[w,C,k]=mt(),[P,Q]=m.useState({}),[D,b]=m.useState(te),L=m.useCallback(async()=>{var S;a(!0);const y=await es(u,l);i(y);const v=await Ne();v&&Q(v);const _=await((S=H)==null?void 0:S.getSetting("defaultFolders"));_&&b(_),a(!1)},[u,l]),I=(y,v)=>{var he,ue,fe,me;if(!((he=k.current)!=null&&he.id)&&!v){console.error("no url to download");return}let _=v??`https://civitai.com/api/download/models/${(ue=k.current)==null?void 0:ue.id}`,S=(fe=k.current)==null?void 0:fe.name;if(!S&&(S=_.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}h({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&f(Ke=>[...Ke,S??""]);const de=gt();de&&(_+=`?token=${de}`),Vt({file_hash:(me=k.current)==null?void 0:me.SHA256,filename:S,save_path:y,url:_}),C(void 0),j()},O=async(y,v)=>{const _=D[v.type];C(y),_==null?x():I(_)},E=async(y,v)=>{var S;const _={...D,[y]:v};await((S=H)==null?void 0:S.upsert({defaultFolders:_})),b(_)};return m.useEffect(()=>{L()},[l]),n.jsxs(n.Fragment,{children:[n.jsxs(Xe,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(be,{}),n.jsxs(Ze,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(Ce,{pb:1,children:[n.jsxs(W,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Ae,{size:"md",mr:2,children:"Models"}),n.jsx(Qt,{searchQuery:u,setSearchQuery:g,onSearch:L}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(Zt,{})]}),n.jsxs(W,{gap:2,wrap:"wrap",children:[n.jsx(A,{size:"sm",py:1,onClick:()=>{c(void 0)},isActive:l==null,children:"All"}),pt.map(y=>n.jsx(A,{size:"sm",py:1,isActive:l===y,onClick:()=>{c(y)},children:y},y)),l&&P[te[l]]&&n.jsxs(W,{ml:"auto",children:[n.jsx(N,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(ee,{value:D[l],onChange:y=>E(l,y.target.value),children:P[te[l]].map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),r&&n.jsx(re,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(et,{}),n.jsxs(ke,{overflowY:"auto",children:[n.jsx(W,{wrap:"wrap",children:o==null?void 0:o.map(y=>n.jsx(Yt,{model:y,onClickInstallModel:O,installing:d},y.id))}),n.jsx(Xt,{})]})]})]}),n.jsx(Jt,{fileSelected:!!w,isOpen:p,onClose:j,selectFolder:(y,v)=>{I(y,k.current?void 0:v)}})]})}const ss=m.lazy(()=>tt(()=>import("./InstallMissingModelsButton-fzyBTPg6.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function ns(){const{setRoute:t,route:e}=m.useContext(Ie),s=async o=>{if(o.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const r=o.dataTransfer.getData("modelRelativePath"),a=o.dataTransfer.getData("nodeType"),l=LiteGraph.createNode(a);l.pos=[o.canvasX,o.canvasY],l.configure({widgets_values:[r]}),z.graph.add(l)};return m.useEffect(()=>(z.canvasEl.addEventListener("drop",s),V.addEventListener("model_list",async o=>{var a;const i=(a=o.detail)==null?void 0:a.map(async l=>{const c=await G.models.get(l.model_name+"@"+l.model_type);if(c!=null&&c.fileHash)return c;let h={id:l.model_name+"@"+l.model_type,modelName:null,fileHash:l.file_hash??null,fileFolder:l.model_type,fileName:l.model_name+l.model_extension};if(!l.file_hash)return h;const d=await ae(l.file_hash);return h={...h,modelName:d.modelName??null,civitModelID:d.civitModelID,civitModelVersionID:d.civitModelVersionID,imageUrl:d.imageUrl??null},h}),r=(await Promise.all(i)).filter(l=>l!=null);await G.models.clear(),await G.models.bulkPut(r.filter(l=>l!=null)),window.dispatchEvent(new CustomEvent("model_list_updated"))}),()=>{z.canvasEl.removeEventListener("drop",s)}),[]),n.jsxs(Y,{style:{position:"relative"},children:[n.jsx(A,{size:"sm",colorScheme:"blue","aria-label":"My models",onClick:()=>t("modelList"),px:1,children:"Models"}),n.jsx("div",{style:{position:"absolute",top:"38px",left:"0px"},children:n.jsx(m.Suspense,{children:n.jsx(ss,{})})}),e==="modelList"&&n.jsx(Ht,{onClose:()=>t("root")}),e==="installModels"&&n.jsx(ts,{modelType:"Checkpoint",onclose:()=>t("root")})]})}const ds=Object.freeze(Object.defineProperty({__proto__:null,default:ns},Symbol.toStringTag,{value:"Module"}));export{Oe as G,ds as M,Vt as i};
-function __vite__mapDeps(indexes) {
- if (!__vite__mapDeps.viteFileDeps) {
- __vite__mapDeps.viteFileDeps = ["workspace_web/InstallMissingModelsButton-fzyBTPg6.js","workspace_web/input.js","workspace_web/App-49F9REmv.js","workspace_web/assets/App-JXePnJiV.css","workspace_web/chunk-JARCRF6W-QWMsZMLI.js","workspace_web/index-pz0vT7Or.js","workspace_web/chunk-3RSXBRAN-crwOgWRE.js"]
- }
- return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
-}
\ No newline at end of file
diff --git a/dist/workspace_web/RecentFilesDrawer-sQVncBeb.js b/dist/workspace_web/RecentFilesDrawer-sQVncBeb.js
deleted file mode 100644
index d355cdf..0000000
--- a/dist/workspace_web/RecentFilesDrawer-sQVncBeb.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import{f as ye,E as Le,j as c,Z as ma,p as dn,o as va,g as be,h as Ie,$ as ga,r as v,x as fn,M as Ze,N as Je,O as Qe,Q as et,R as tt,S as nt,W as wt,i as ee,a0 as Ot,T as ba,a1 as Ee,a2 as Sa,a3 as xa,a4 as ya,a5 as pn,a6 as Ca,a7 as P,a8 as E,a9 as wa,aa as hn,Y as F,l as ge,U as Oa,I as It,ab as Nt}from"./input.js";import{m as mn,b as Ia,a as Ma,u as vn,c as ka,d as Pa,e as ja,S as Da,M as gn,f as Va,g as Ea,h as q,H as K,T as bn,I as Z,t as Se,i as Sn,j as Me,E as it,k as ue,l as J,n as ne,o as at,p as U,R as de,q as Fa,r as $t,B as z,F as we,s as zt,v as La,w as Ra,x as ke,y as Re,z as te,A as Ta,D as xn,C as G,G as yn,J as Na,K as Mt,L as $a,N as Cn,O as za,P as pe,Q as Aa,U as _a,V as Ha,W as kt,X as Ba,Y as Wa,Z as Ua,_ as xe,$ as ht,a0 as Ga,a1 as Ya,a2 as Ka,a3 as qa,a4 as Xa,a5 as Za,a6 as Ja,a7 as Pt,a8 as wn,a9 as Qa,aa as er,ab as tr,ac as nr,ad as De,ae as ar,af as rr,ag as ir,ah as ot,ai as or}from"./App-49F9REmv.js";import{G as sr,C as Pe}from"./chunk-JARCRF6W-QWMsZMLI.js";import{V as On}from"./chunk-NTCQBYKE-ZN6CsuPY.js";import{N as lr,a as cr,I as ur,M as dr,u as fr,S as pr}from"./MediaPreview-GWdoyYIm.js";import{app as $e}from"/scripts/app.js";import{I as hr}from"./IconCopy-BoJadUqc.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";import"./IconSearch-TfsRN_aS.js";var In=ye(function(e,a){const{columns:r,spacingX:t,spacingY:i,spacing:l,minChildWidth:o,...s}=e,u=Le(),d=o?vr(o,u):gr(r);return c.jsx(sr,{ref:a,gap:l,columnGap:t,rowGap:i,templateColumns:d,...s})});In.displayName="SimpleGrid";function mr(n){return typeof n=="number"?`${n}px`:n}function vr(n,e){return mn(n,a=>{const r=ma("sizes",a,mr(a))(e);return a===null?null:`repeat(auto-fit, minmax(${r}, 1fr))`})}function gr(n){return mn(n,e=>e===null?null:`repeat(${e}, minmax(0, 1fr))`)}var Mn=ye(function(e,a){const{borderLeftWidth:r,borderBottomWidth:t,borderTopWidth:i,borderRightWidth:l,borderWidth:o,borderStyle:s,borderColor:u,...d}=dn("Divider",e),{className:f,orientation:h="horizontal",__css:p,...m}=va(e),b={vertical:{borderLeftWidth:r||l||o||"1px",height:"100%"},horizontal:{borderBottomWidth:t||i||o||"1px",width:"100%"}};return c.jsx(be.hr,{ref:a,"aria-orientation":h,...m,__css:{...d,border:"0",borderColor:u,borderStyle:s,...b[h],...p},className:Ie("chakra-divider",f)})});Mn.displayName="Divider";function br(n,e={}){const{ssr:a=!0,fallback:r}=e,{getWindow:t}=ga(),i=Array.isArray(n)?n:[n];let l=Array.isArray(r)?r:[r];l=l.filter(u=>u!=null);const[o,s]=v.useState(()=>i.map((u,d)=>({media:u,matches:a?!!l[d]:t().matchMedia(u).matches})));return v.useEffect(()=>{const u=t();s(i.map(h=>({media:h,matches:u.matchMedia(h).matches})));const d=i.map(h=>u.matchMedia(h)),f=h=>{s(p=>p.slice().map(m=>m.media===h.media?{...m,matches:h.matches}:m))};return d.forEach(h=>{typeof h.addListener=="function"?h.addListener(f):h.addEventListener("change",f)}),()=>{d.forEach(h=>{typeof h.removeListener=="function"?h.removeListener(f):h.removeEventListener("change",f)})}},[t]),o.map(u=>u.matches)}function Sr(n,e,a=Ia){let r=Object.keys(n).indexOf(e);if(r!==-1)return n[e];let t=a.indexOf(e);for(;t>=0;){const i=a[t];if(n.hasOwnProperty(i)){r=t;break}t-=1}if(r!==-1){const i=a[r];return n[i]}}function xr(n){var e,a;const r=fn(n)?n:{fallback:n??"base"},i=Le().__breakpoints.details.map(({minMaxQuery:u,breakpoint:d})=>({breakpoint:d,query:u.replace("@media screen and ","")})),l=i.map(u=>u.breakpoint===r.fallback),s=br(i.map(u=>u.query),{fallback:l,ssr:r.ssr}).findIndex(u=>u==!0);return(a=(e=i[s])==null?void 0:e.breakpoint)!=null?a:r.fallback}function yr(n,e){var a;const r=fn(e)?e:{fallback:e??"base"},t=xr(r),i=Le();if(!t)return;const l=Array.from(((a=i.__breakpoints)==null?void 0:a.keys)||[]),o=Array.isArray(n)?Object.fromEntries(Object.entries(Ma(n,l)).map(([s,u])=>[s,u])):n;return Sr(o,t,l)}var kn=ye((n,e)=>{const{title:a,children:r,className:t,...i}=n,l=Ie("chakra-menu__group__title",t),o=vn();return c.jsxs("div",{ref:e,className:"chakra-menu__group",role:"group",children:[a&&c.jsx(be.p,{className:l,...i,__css:o.groupTitle,children:a}),r]})});kn.displayName="MenuGroup";var Pn=n=>{const{className:e,title:a,...r}=n,t=ka(r);return c.jsx(kn,{title:a,className:Ie("chakra-menu__option-group",e),...t})};Pn.displayName="MenuOptionGroup";var Cr=ye((n,e)=>{const a=vn();return c.jsx(be.button,{ref:e,...n,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...a.button}})}),Te=ye((n,e)=>{const{children:a,as:r,...t}=n,i=Pa(t,e),l=r||Cr;return c.jsx(l,{...i,className:Ie("chakra-menu__menu-button",n.className),children:c.jsx(be.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:n.children})})});Te.displayName="MenuButton";var wr=n=>c.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...n,children:c.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),jt=ye((n,e)=>{const{icon:a,iconSpacing:r="0.75rem",...t}=n,i=ja(t,e);return c.jsxs(Da,{...i,className:Ie("chakra-menu__menuitem-option",t.className),children:[a!==null&&c.jsx(gn,{fontSize:"0.8em",marginEnd:r,opacity:n.isChecked?1:0,children:a||c.jsx(wr,{})}),c.jsx("span",{style:{flex:1},children:i.children})]})});jt.id="MenuItemOption";jt.displayName="MenuItemOption";var jn=ye(function(e,a){const{getHeaderProps:r}=Va(),t=Ea();return c.jsx(be.header,{...r(e,a),className:Ie("chakra-popover__header",e.className),__css:t.header})});jn.displayName="PopoverHeader";var Or=q("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),Ir=q("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),Mr=q("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),At=q("file-import","IconFileImport",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3",key:"svg-1"}]]),kr=q("file","IconFile",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}]]),Dn=q("folder-plus","IconFolderPlus",[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),Pr=q("list-check","IconListCheck",[["path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5",key:"svg-0"}],["path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5",key:"svg-1"}],["path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5",key:"svg-2"}],["path",{d:"M11 6l9 0",key:"svg-3"}],["path",{d:"M11 12l9 0",key:"svg-4"}],["path",{d:"M11 18l9 0",key:"svg-5"}]]),jr=q("lock-open","IconLockOpen",[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]]),Dr=q("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),Vr=q("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),Er=q("pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]]),Fr=q("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Lr=q("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),Vn=q("tag","IconTag",[["path",{d:"M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z",key:"svg-1"}]]),Rr=q("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]);function Tr({onclose:n}){const[e,a]=v.useState([]),r=async()=>{var i;const t=await((i=Se)==null?void 0:i.listAll());a(t??[])};return v.useEffect(()=>{r()},[]),c.jsxs(Ze,{isOpen:!0,onClose:n,children:[c.jsx(Je,{}),c.jsxs(Qe,{children:[c.jsx(et,{children:"My Tags"}),c.jsx(tt,{}),c.jsx(nt,{children:e.map(t=>c.jsxs(K,{children:[c.jsx(bn,{children:t.name}),c.jsx(Z,{onClick:async()=>{var i;await((i=Se)==null?void 0:i.delete(t.name)),r()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:c.jsx(Sn,{})})]}))})]})]})}function Nr(){const n=Me(),e=v.useRef([{title:"Save current workflow",key:it.SAVE},{title:"Save as current workflow",key:it.SAVE_AS},{title:"Open spotlight search",key:it.openSpotlightSearch}]),[a,r]=v.useState({save:"",saveAs:"",openSpotlightSearch:""}),[t,i]=v.useState(),l=async(s,u)=>{var f;s.preventDefault();let d="";if(s.ctrlKey&&(d+="Control+"),s.metaKey&&(d+="Command+"),s.shiftKey&&(d+="Shift+"),s.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt","Meta"].includes(s.key)){d+=s.key.toUpperCase();const h={...a};delete h[u],Object.values(h).includes(d)?n({title:"Shortcut key conflict",description:`The shortcut key 「${d}」 is already used, please
- modify it.`,status:"info",duration:3e3,position:"top",isClosable:!1}):(await((f=U)==null?void 0:f.upsert({shortcuts:{...a,[u]:d}})),o())}},o=()=>{var s;(s=U)==null||s.getSetting("shortcuts").then(u=>{var f;const d=u??((f=U)==null?void 0:f.defaultSettings.shortcuts);r({...a,...d})})};return v.useEffect(()=>{o()},[]),c.jsxs(ue,{children:[c.jsx(J,{children:"Keyboard Shortcut"}),e.current.map(s=>c.jsxs(K,{children:[c.jsx(J,{fontSize:"sm",w:170,children:s.title}),c.jsx(ne,{label:"Press shortcut key combinations to setup",placement:"bottom",hasArrow:!0,isOpen:t===s.key,children:c.jsx(at,{value:a[s.key],onKeyDown:u=>{l(u,s.key)},onFocus:()=>{i(s.key)},onBlur:()=>{i(void 0)},placeholder:"Press a key combination",readOnly:!0,width:"auto",flex:1})})]},s.key))]})}function $r(){const{setRefreshFolderStamp:n}=v.useContext(de),[e,a]=v.useState(!1),r=()=>{var i;(i=U)==null||i.getSetting("foldersOnTop").then(l=>{a(!!l)})},t=i=>{var o;const l=i.target.checked;(o=U)==null||o.upsert({foldersOnTop:l}).then(()=>{r(),n(Date.now())})};return v.useEffect(()=>{r()},[]),c.jsx(ue,{children:c.jsx(Pe,{isChecked:e,onChange:t,children:"Folders always on top"})})}function zr(){const[n,e]=v.useState(!1),[a,r]=v.useState(""),{showDialog:t}=wt(),i=()=>{var o,s;(o=U)==null||o.getSetting("myWorkflowsDir").then(u=>{r(u??"undefined")}),(s=U)==null||s.getSetting("twoWaySync").then(u=>{e(u??!1)})};v.useEffect(()=>{i()},[]);const l=async o=>{var u,d;if(!o.target.checked){await((u=U)==null?void 0:u.upsert({twoWaySync:o.target.checked})),i();return}const s=await((d=U)==null?void 0:d.getSetting("myWorkflowsDir"));t(c.jsx(Fa,{myWorkflowsDir:s??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{var f;await((f=U)==null?void 0:f.upsert({twoWaySync:!0})),i()},colorScheme:"red"}])};return c.jsxs(ue,{children:[c.jsx(J,{children:"Only for legacy two way sync users to get back their data. Do not disable two way sync if you have already enabled it. It may cause some unexpected issues."}),c.jsx(Pe,{isChecked:n,onChange:l,children:"Enable two way sync"})]})}function Ar({settingKey:n,text:e,defaultChecked:a=!1}){const[r,t]=v.useState(a),i=Me(),l=()=>{var o;(o=U)==null||o.getSetting(n).then(s=>{t(!!s)})};return v.useEffect(()=>{l()},[]),c.jsx(ue,{children:c.jsx(Pe,{isChecked:r,onChange:async o=>{var s;await((s=U)==null?void 0:s.upsert({[n]:o.target.checked})),l(),i({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},children:e})})}function _r(){const[n,e]=v.useState(!1),[a,r]=v.useState(!1),[t,i]=v.useState([]),[l,o]=v.useState(""),[s,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[m,b]=v.useState(!1),g=v.useRef(null),S=Me(),{showDialog:w}=wt(),y=m?"\\":"/";v.useEffect(()=>{var D;$t().then(O=>{o(O.path??""),b(O.os==="win32")}),(D=U)==null||D.getSetting("twoWaySync").then(O=>{f(O??!1)})},[]);const x=async D=>{const{dir_path:O="",dir_contents:L=[],error:_=""}=await zt(D??"");return _.includes("Operation not permitted")?(p(!0),C(),{isError:!0}):{dirList:L,dirPath:O}},j=async()=>{const{isError:D=!1,dirList:O=[]}=await x(l);D||(i(O),r(!0),u(l&&l.split(y).filter(L=>!!L)||[]))},C=()=>{r(!1),e(!1),u([])},V=async(D,O=!1,L=!1)=>{var I,R;if(O){const{path:N}=await $t();N&&await La(N,D)}await((I=U)==null?void 0:I.upsert({myWorkflowsDir:D}));const _=await((R=U)==null?void 0:R.getSetting("myWorkflowsDir"))??"";o(_),L&&p(!1),C()},M=async D=>{if(D){const{error:L=""}=await zt(D);if(L.includes("Not a directory")){S({title:"The directory address you entered is invalid, please re-enter it.",status:"warning",duration:5e3,position:"top",isClosable:!0});return}}const O=D??`${m?"":y}${s.join(y)}`;w("Do you want to copy all workflows to new directory?",[{label:"Yes",onClick:()=>{V(O,!0,!!D)}},{label:"No",onClick:()=>{V(O,!1,!!D)}}])},T=async()=>{const{dirPath:D,dirList:O}=await x("");u(D.split(y).filter(L=>!!L)),i(O)},A=async(D,O)=>{var R;let L="";D===-1&&O?L=`${m?"":y}${s.concat([O]).join(y)}`:L=`${m?"":y}${s.slice(0,D+1).join(y)}`;const{isError:_=!1,dirList:I=[]}=await x(L);_||(i(I),u(m?L.split(y):(R=L.slice(1))==null?void 0:R.split(y)))},W=c.jsxs(z,{textAlign:"end",mb:4,children:[c.jsx(at,{placeholder:"Please enter the absolute path directory address",ref:g,mt:2,mb:2}),c.jsx(ee,{colorScheme:"teal",mr:3,size:"sm",onClick:()=>{var D,O;(D=g==null?void 0:g.current)!=null&&D.value&&M((O=g==null?void 0:g.current)==null?void 0:O.value)},children:"Save"})]}),H=()=>{r(!0),e(!0)};return c.jsxs(c.Fragment,{children:[c.jsxs(z,{mb:4,children:[c.jsx(J,{mb:2,fontWeight:500,children:"My Workflows Save Directory"}),a?n?W:c.jsxs(On,{spacing:2,alignItems:"start",children:[c.jsx(ue,{spacing:"2px",direction:"row",wrap:"wrap",children:s.map((D,O)=>c.jsxs("span",{children:[O>0&&y,c.jsx(ee,{colorScheme:"teal",variant:"link",minW:1,onClick:()=>{A(O)},children:D},`${D}-${O}`)]},D))}),c.jsx(In,{columns:2,spacing:3,maxHeight:500,width:"100%",overflowY:"auto",children:t.map((D,O)=>c.jsx(ee,{size:"sm",leftIcon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:c.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),justifyContent:"start",onClick:()=>{A(-1,D)},children:D},`${D}-${O}`))}),c.jsxs(z,{w:"100%",textAlign:"end",children:[c.jsx(ee,{colorScheme:"teal",size:"sm",onClick:()=>{M()},children:"Save"}),c.jsx(ee,{size:"sm",onClick:T,mr:2,ml:2,children:"Reset"}),c.jsx(ee,{size:"sm",onClick:C,children:"Cancel"})]})]}):c.jsxs(we,{children:[c.jsx(bn,{overflowWrap:"anywhere",children:l}),c.jsx(ne,{label:d?"Choose folder":"Enable two way sync to link local folder",children:c.jsx(Z,{"aria-label":"Select folder",size:"sm",ml:2,isDisabled:!d,icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.4rem",height:"1.4srem"},children:c.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),onClick:j})}),c.jsx(ne,{label:d?"Input absolute path":"Enable two way sync to link local folder",children:c.jsx(Z,{isDisabled:!d,"aria-label":"Enter folder address",size:"sm",ml:2,icon:c.jsx(Mr,{size:19}),onClick:H,variant:"ghost"})})]})]}),c.jsxs(Ze,{isOpen:h,onClose:()=>p(!1),size:"xl",children:[c.jsx(Je,{}),c.jsxs(Qe,{children:[c.jsx(et,{children:"Kind tips"}),c.jsx(tt,{}),c.jsx(nt,{children:c.jsxs(z,{children:[navigator.userAgent.indexOf("Mac OS X")!==-1?c.jsxs(J,{fontWeight:500,children:["There is no permission to access the folder. You need to grant full disk access permission to the terminal that starts the ComfyUI program. For details, refer to the",c.jsx(ee,{colorScheme:"teal",variant:"link",as:"a",ml:2,target:"_block",href:`https://stackoverflow.com/questions/58479686/permissionerror-errno-1-operation-not-permitted-after-macos
- -catalina-update`,children:"Document"}),", or you can manually enter the absolute path of the folder in the input box below to save."]}):c.jsx(J,{fontWeight:500,children:"You do not have permission to access the folder. It is recommended that you manually enter the absolute path address of the required folder."}),W]})})]})]})]})}function En({label:n,settingKey:e}){const[a,r]=v.useState(200),t=Me(),i=s=>{if(!s.length){r(0);return}r(parseInt(s))},l=async()=>{var s;a<0&&r(0),await((s=U)==null?void 0:s.upsert({[e]:Number(a)})),t({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},o=()=>{var s;(s=U)==null||s.getSetting(e).then(u=>{r(u)})};return v.useEffect(()=>{o()},[]),c.jsxs(ue,{children:[c.jsx(J,{children:n}),c.jsx(lr,{defaultValue:200,min:0,keepWithinRange:!0,placeholder:"Enter a number",maxWidth:"300px",value:a,onChange:s=>i(s),onBlur:()=>{l()},onKeyUp:s=>{s.key==="Enter"&&l()},children:c.jsx(cr,{})})]})}function Hr(){const[n,e]=v.useState(!1),a=Me(),r=()=>{var t;(t=U)==null||t.getSetting("autoSave").then(i=>{e(!!i)})};return v.useEffect(()=>{r()},[]),c.jsxs(ue,{children:[c.jsx(Pe,{isChecked:n,onChange:async t=>{var i;await((i=U)==null?void 0:i.upsert({autoSave:t.target.checked})),r(),a({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},children:"Enable auto save workflow"}),n&&c.jsx(En,{label:"Auto save duration (auto save workflow every X seconds)",settingKey:"autoSaveDuration"})]})}function Br({onClose:n}){return c.jsx(c.Fragment,{children:c.jsxs(Ze,{isOpen:!0,onClose:n,size:"xl",children:[c.jsx(Je,{}),c.jsxs(Qe,{children:[c.jsx(et,{children:"Settings"}),c.jsx(tt,{}),c.jsx(nt,{pb:14,children:c.jsx(K,{children:c.jsxs(On,{divider:c.jsx(Ra,{borderColor:"gray.500"}),spacing:4,align:"stretch",w:"100%",children:[c.jsx(_r,{}),c.jsx(Hr,{}),c.jsx(Nr,{}),c.jsx(zr,{}),c.jsx($r,{}),c.jsx(Ar,{settingKey:"overwriteCurWorkflowWhenDroppingFileToCanvas",text:"Overwrite current workflow when drag and drop workflow file to canvas"}),c.jsx(En,{label:`Maximum number of save change history to store. This does not include
- versions that you created by "Create Version", which are always stored
- and has no limit.`,settingKey:"maximumChangelogNumber"})]})})})]})]})})}const st=16;function Wr({}){const[n,e]=v.useState(!1),[a,r]=v.useState(!1),{colorMode:t,toggleColorMode:i}=Ot();return c.jsxs(c.Fragment,{children:[c.jsxs(ke,{isLazy:!0,children:[c.jsx(Te,{as:Z,"aria-label":"Options",icon:c.jsx(Dr,{}),size:"sm",variant:"outline"}),c.jsxs(Re,{children:[c.jsx(te,{onClick:()=>r(!0),icon:c.jsx(Fr,{size:16}),fontSize:16,children:"Settings"}),c.jsx(te,{onClick:()=>e(!0),icon:c.jsx(Vn,{size:st}),fontSize:16,children:"Manage Tags"}),c.jsxs(te,{onClick:i,icon:t==="light"?c.jsx(Vr,{size:st}):c.jsx(Lr,{size:st}),fontSize:16,children:[t==="light"?"Dark":"Light"," Mode"]})]})]}),n&&c.jsx(Tr,{onclose:()=>e(!1)}),a&&c.jsx(Br,{onClose:()=>r(!1)})]})}function Ur(n){const{multipleState:e,changeMultipleState:a,selectedKeys:r,isSelectedAll:t,batchOperationCallback:i}=n,l=async()=>{var u;const s=await((u=G)==null?void 0:u.batchQuery(r))??[];Na(s)},o=r.length===0;return c.jsx(K,{spacing:2,wrap:"wrap",mb:0,children:e?c.jsxs(c.Fragment,{children:[c.jsx(Pe,{isChecked:t,onChange:s=>{i("selectAll",s.target.checked)}}),c.jsx(ne,{hasArrow:!0,label:"Download Zip",placement:"bottom",children:c.jsx(Z,{isDisabled:o,"aria-label":"Batch export",size:"sm",icon:c.jsx(Ta,{size:21}),onClick:l})}),c.jsx(ne,{hasArrow:!0,label:"Batch deletion",children:c.jsx(xn,{isDisabled:o,variant:"solid",promptMessage:`Are you sure you want to delete these ${r.length} checked workflows?`,tooltipText:"Delete selected",onDelete:async()=>{var s;await((s=G)==null?void 0:s.batchDeleteFlow(r)),i("batchDelete")}})}),r.length>0&&c.jsx(J,{fontWeight:600,children:`Selected ${r.length}`}),c.jsx(ne,{hasArrow:!0,label:"Exit multi-select",children:c.jsx(Z,{"aria-label":"Close multi-select operation",size:"sm",icon:c.jsx(yn,{}),onClick:()=>{a(!1)}})})]}):c.jsx(ne,{hasArrow:!0,label:"Select multiple",placement:"bottom-start",children:c.jsx(Z,{"aria-label":"Start multi-select operation",size:"sm",variant:"outline",icon:c.jsx(Pr,{size:21}),onClick:()=>{a(!0)}})})})}const _t=6;function Gr({setSelectedTag:n,selectedTag:e}){const[a,r]=v.useState(!1),[t,i]=v.useState([]);return v.useEffect(()=>{var l;(l=Se)==null||l.listAll().then(o=>{i(o)})},[]),c.jsxs(K,{spacing:2,wrap:"wrap",mb:0,children:[e!=null&&c.jsx(Z,{"aria-label":"Close",size:"sm",icon:c.jsx(yn,{}),onClick:()=>{n(void 0)}}),t.slice(0,a?void 0:_t).map(l=>c.jsx(ee,{variant:"solid",width:"auto",flexShrink:0,size:"sm",borderRadius:15,py:4,onClick:()=>{n(l.name)},isActive:e===l.name,children:l.name},l.name)),(t.length??0)>_t&&c.jsx(Z,{"aria-label":"Show-all-tags",size:"sm",icon:a?c.jsx(Or,{}):c.jsx(Mt,{}),onClick:()=>r(!a)})]})}function Fn({parentFolderID:n,onlyImportFile:e=!1}){const{onRefreshFilesList:a}=v.useContext(de),[r,t]=v.useState("file"),i=v.useRef(null),l=d=>{var f;t(d),d==="folder"?i.current.setAttribute("webkitdirectory",""):i.current.removeAttribute("webkitdirectory"),(f=i.current)==null||f.click()},o=async d=>{var f;if(d.type==="image/png"){const h=await za(d),p=h==null?void 0:h.workflow;if(p)return{json:p,name:d.name.replace(".png","")}}else if(d.type==="application/json"||(f=d.name)!=null&&f.endsWith(".json"))return await new Promise((h,p)=>{const m=new FileReader;m.onload=b=>{var g;try{const S=(g=b.target)==null?void 0:g.result;typeof S=="string"?h({json:S,name:d.name.replace(".json","")}):p(new Error("File content is not a string"))}catch(S){p(S)}},m.onerror=p,m.readAsText(d)});return null},s=async d=>{var h,p;const f=[d];for(;f.length>0;){const m=f.shift();if(m&&!m.isFile){const b=await((h=pe)==null?void 0:h.create({name:m.name,parentFolderID:m.parentFolderID}));if(m.children&&m.children.length){const g=[];m.children.forEach(S=>{S.isFile&&S.file?g.push(S.file):(S.parentFolderID=b==null?void 0:b.id,f.push(S))}),g.length&&await((p=G)==null?void 0:p.batchCreateFlows(g,void 0,b==null?void 0:b.id))}}}a==null||a()},u=async d=>{var h;const f=d.target.files;if(f)if(r==="folder"){const p={name:f[0].webkitRelativePath.split("/")[0],isFile:!1,children:[]};for(const m of f)if(m.name!==".DS_Store"){const b=m.webkitRelativePath.split("/");let g=p.children??[];for(let S=1;Sx.name===w);if(!y){if(y={name:w,isFile:S===b.length-1,children:S===b.length-1?void 0:[]},y.isFile){const x=await o(m);x&&(y.file=x)}g.push(y)}y&&!y.isFile&&(g=y.children)}}s(p)}else{const p=[];for(const m of f){const b=await o(m);b&&p.push(b)}p.length&&(await((h=G)==null?void 0:h.batchCreateFlows(p,void 0,n)),a&&a())}};return c.jsxs(c.Fragment,{children:[e?c.jsx(te,{onClick:d=>{d.stopPropagation(),l("file")},icon:c.jsx(At,{size:19}),children:"Import workflows"}):c.jsxs(ke,{closeOnSelect:!0,children:[c.jsx(Te,{as:ee,leftIcon:c.jsx(At,{size:18}),variant:"outline",iconSpacing:1,size:"sm",colorScheme:"teal",children:"Import"}),c.jsx(Re,{children:$a.map((d,f)=>c.jsx(te,{onClick:()=>{l(d.type)},iconSpacing:2,icon:d.type==="folder"?c.jsx(Cn,{size:18}):c.jsx(kr,{size:18}),children:d.title},f))})]}),c.jsx("input",{style:{display:"none"},ref:i,type:"file",accept:".json,image/png",multiple:!0,onChange:u,onClick:d=>{d.stopPropagation()}})]})}function Yr({folder:n,onclose:e}){const[a,r]=v.useState(n.name),[t,i]=v.useState(""),{onRefreshFilesList:l}=v.useContext(de),o=u=>{r(u.target.value),t&&i("")},s=async()=>{var f,h;const u=a.trim();if(r(u),u===n.name)return e();await((f=pe)==null?void 0:f.generateUniqueName(u,n.parentFolderID??""))!==u?i("The name is duplicated, please modify it and submit again."):(await((h=pe)==null?void 0:h.update(n.id,{name:u})),l&&l(),e())};return c.jsxs(Ze,{isOpen:!0,onClose:e,children:[c.jsx(Je,{}),c.jsxs(Qe,{children:[c.jsx(et,{children:"Edit folder name"}),c.jsx(tt,{}),c.jsx(nt,{children:c.jsxs(Aa,{isInvalid:!!t,children:[c.jsx(_a,{children:"Folder name"}),c.jsx(at,{value:a,onChange:o,autoFocus:!0,onKeyUp:u=>{u.code==="Enter"&&!t&&a&&s()}}),t&&c.jsx(Ha,{children:t})]})}),c.jsxs(ba,{children:[c.jsx(ee,{colorScheme:"teal",mr:3,onClick:s,isDisabled:!a||!!t,children:"Save"}),c.jsx(ee,{onClick:e,children:"Cancel"})]})]})]})}function Kr({menuPosition:n,isopen:e,folder:a,onClose:r}){const[t,i]=v.useState(!1),{onRefreshFilesList:l}=v.useContext(de),{showDialog:o}=wt(),s=async h=>{var p;h.stopPropagation(),await((p=pe)==null?void 0:p.create({name:"New Folder",parentFolderID:a.id})),l&&l()},u=async h=>{var p;h.stopPropagation(),await((p=G)==null?void 0:p.createFlow({json:JSON.stringify(Ba),parentFolderID:a.id})),l&&l()},d=async h=>{h.stopPropagation();const p=await Wa(a.id);o(`Do you want to delete the ${p} files inside the folder too?`,[{label:"Delete all files",colorScheme:"red",onClick:()=>{f(Ua.DELETE)}}])},f=async h=>{var p;await((p=pe)==null?void 0:p.deleteFolder(a.id,h)),r(),l&&l()};return c.jsxs(c.Fragment,{children:[c.jsx(z,{position:"absolute",top:n.y,left:n.x,children:c.jsx(ke,{isOpen:e,onClose:r,isLazy:!0,lazyBehavior:"keepMounted",children:c.jsxs(Re,{children:[c.jsx(te,{icon:c.jsx(Er,{size:19}),onClick:h=>{h.preventDefault(),h.stopPropagation(),i(!0)},children:"Rename"}),c.jsx(te,{icon:c.jsx(Sn,{size:19}),onClick:d,children:"Delete"}),c.jsx(te,{onClick:s,icon:c.jsx(Dn,{size:19}),children:"New folder"}),c.jsx(te,{onClick:u,icon:c.jsx(kt,{size:19}),children:"New file"}),c.jsx(Fn,{parentFolderID:a.id,onlyImportFile:!0})]})})}),t&&c.jsx(Yr,{folder:a,onclose:()=>i(!1)})]})}const Ht=v.memo(function({folder:e}){const[a,r]=v.useState(!1),[t,i]=v.useState(e.isCollapse??!0),[l,o]=v.useState([]),[s,u]=v.useState({x:0,y:0}),[d,f]=v.useState(!1),{colorMode:h}=Ot(),{draggingFile:p,setDraggingFile:m,refreshFolderStamp:b,onRefreshFilesList:g}=v.useContext(de),S=h==="light"?{backgroundColor:"#E2E8F0"}:{backgroundColor:"#4A5568"};v.useEffect(()=>{var x;t||(x=G)==null||x.listFolderContent(e.id,window.localStorage.getItem(ht)).then(j=>{o(j)})},[e.id,b,t]);const w=x=>{x.preventDefault(),u({x:x.clientX,y:x.clientY}),f(!0)},y=async x=>{var j,C;if(x.preventDefault(),x.stopPropagation(),!p)return r(!1);if(xe(p)){if(p.id===e.id)return r(!1);await((j=pe)==null?void 0:j.update(p.id,{parentFolderID:e.id}))}else xe(p)||await((C=G)==null?void 0:C.updateFolder(p.id,{parentFolderID:e.id}));await(g==null?void 0:g()),r(!1)};return v.useEffect(()=>{var x;!!e.isCollapse!==t&&((x=pe)==null||x.update(e.id,{isCollapse:t}))},[t]),v.useEffect(()=>{var M;const x=(M=G)==null?void 0:M.curWorkflow,j=(x==null?void 0:x.parentFolderID)+"/",C=e.id+"/";j.startsWith(C)&&i(!1)},[]),c.jsxs(ue,{children:[c.jsxs(K,{w:"100%",as:"button",py:1,onClick:()=>{i(!t)},onContextMenu:w,draggable:"true",onDragOver:x=>{x.preventDefault(),x.stopPropagation(),r(!0)},onDragLeave:x=>{x.preventDefault(),x.stopPropagation(),r(!1)},onDragStart:()=>m==null?void 0:m(e),onDrop:y,_hover:S,style:a||d?S:void 0,className:"droppable",children:[c.jsxs(K,{gap:1,children:[t?c.jsx(ur,{size:20}):c.jsx(Mt,{size:20}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:c.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})})]}),c.jsx(J,{children:e.name})]}),c.jsx(Kr,{isopen:d,menuPosition:s,onClose:()=>f(!1),folder:e}),!t&&c.jsx(ue,{ml:4,gap:0,children:c.jsx(da,{items:l})})]})});function Bt(n,e){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),a.push.apply(a,r)}return a}function k(n){for(var e=1;en.length)&&(e=n.length);for(var a=0,r=new Array(e);a=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(a[r]=n[r])}return a}var Jr=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Qr(n){var e=n.defaultInputValue,a=e===void 0?"":e,r=n.defaultMenuIsOpen,t=r===void 0?!1:r,i=n.defaultValue,l=i===void 0?null:i,o=n.inputValue,s=n.menuIsOpen,u=n.onChange,d=n.onInputChange,f=n.onMenuClose,h=n.onMenuOpen,p=n.value,m=he(n,Jr),b=v.useState(o!==void 0?o:a),g=fe(b,2),S=g[0],w=g[1],y=v.useState(s!==void 0?s:t),x=fe(y,2),j=x[0],C=x[1],V=v.useState(p!==void 0?p:l),M=fe(V,2),T=M[0],A=M[1],W=v.useCallback(function(R,N){typeof u=="function"&&u(R,N),A(R)},[u]),H=v.useCallback(function(R,N){var $;typeof d=="function"&&($=d(R,N)),w($!==void 0?$:R)},[d]),D=v.useCallback(function(){typeof h=="function"&&h(),C(!0)},[h]),O=v.useCallback(function(){typeof f=="function"&&f(),C(!1)},[f]),L=o!==void 0?o:S,_=s!==void 0?s:j,I=p!==void 0?p:T;return k(k({},m),{},{inputValue:L,menuIsOpen:_,onChange:W,onInputChange:H,onMenuClose:O,onMenuOpen:D,value:I})}function ei(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Wt(n,e){for(var a=0;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ri(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function ii(n,e){if(e&&(pn(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ri(n)}function oi(n){var e=ai();return function(){var r=Be(n),t;if(e){var i=Be(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ii(this,t)}}function si(n){if(Array.isArray(n))return mt(n)}function li(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function ci(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rn(n){return si(n)||li(n)||Ln(n)||ci()}function ui(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}const di=Math.min,fi=Math.max,We=Math.round,ze=Math.floor,Ue=n=>({x:n,y:n});function pi(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function Tn(n){return $n(n)?(n.nodeName||"").toLowerCase():"#document"}function ie(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Nn(n){var e;return(e=($n(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function $n(n){return n instanceof Node||n instanceof ie(n).Node}function vt(n){return n instanceof Element||n instanceof ie(n).Element}function Dt(n){return n instanceof HTMLElement||n instanceof ie(n).HTMLElement}function Ut(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ie(n).ShadowRoot}function zn(n){const{overflow:e,overflowX:a,overflowY:r,display:t}=Vt(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+a)&&!["inline","contents"].includes(t)}function hi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function mi(n){return["html","body","#document"].includes(Tn(n))}function Vt(n){return ie(n).getComputedStyle(n)}function vi(n){if(Tn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Ut(n)&&n.host||Nn(n);return Ut(e)?e.host:e}function An(n){const e=vi(n);return mi(e)?n.ownerDocument?n.ownerDocument.body:n.body:Dt(e)&&zn(e)?e:An(e)}function Ge(n,e,a){var r;e===void 0&&(e=[]),a===void 0&&(a=!0);const t=An(n),i=t===((r=n.ownerDocument)==null?void 0:r.body),l=ie(t);return i?e.concat(l,l.visualViewport||[],zn(t)?t:[],l.frameElement&&a?Ge(l.frameElement):[]):e.concat(t,Ge(t,[],a))}function gi(n){const e=Vt(n);let a=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const t=Dt(n),i=t?n.offsetWidth:a,l=t?n.offsetHeight:r,o=We(a)!==i||We(r)!==l;return o&&(a=i,r=l),{width:a,height:r,$:o}}function Et(n){return vt(n)?n:n.contextElement}function lt(n){const e=Et(n);if(!Dt(e))return Ue(1);const a=e.getBoundingClientRect(),{width:r,height:t,$:i}=gi(e);let l=(i?We(a.width):a.width)/r,o=(i?We(a.height):a.height)/t;return(!l||!Number.isFinite(l))&&(l=1),(!o||!Number.isFinite(o))&&(o=1),{x:l,y:o}}const bi=Ue(0);function Si(n){const e=ie(n);return!hi()||!e.visualViewport?bi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function xi(n,e,a){return e===void 0&&(e=!1),!a||e&&a!==ie(n)?!1:e}function Gt(n,e,a,r){e===void 0&&(e=!1),a===void 0&&(a=!1);const t=n.getBoundingClientRect(),i=Et(n);let l=Ue(1);e&&(r?vt(r)&&(l=lt(r)):l=lt(n));const o=xi(i,a,r)?Si(i):Ue(0);let s=(t.left+o.x)/l.x,u=(t.top+o.y)/l.y,d=t.width/l.x,f=t.height/l.y;if(i){const h=ie(i),p=r&&vt(r)?ie(r):r;let m=h.frameElement;for(;m&&r&&p!==h;){const b=lt(m),g=m.getBoundingClientRect(),S=Vt(m),w=g.left+(m.clientLeft+parseFloat(S.paddingLeft))*b.x,y=g.top+(m.clientTop+parseFloat(S.paddingTop))*b.y;s*=b.x,u*=b.y,d*=b.x,f*=b.y,s+=w,u+=y,m=ie(m).frameElement}}return pi({width:d,height:f,x:s,y:u})}function yi(n,e){let a=null,r;const t=Nn(n);function i(){clearTimeout(r),a&&a.disconnect(),a=null}function l(o,s){o===void 0&&(o=!1),s===void 0&&(s=1),i();const{left:u,top:d,width:f,height:h}=n.getBoundingClientRect();if(o||e(),!f||!h)return;const p=ze(d),m=ze(t.clientWidth-(u+f)),b=ze(t.clientHeight-(d+h)),g=ze(u),w={rootMargin:-p+"px "+-m+"px "+-b+"px "+-g+"px",threshold:fi(0,di(1,s))||1};let y=!0;function x(j){const C=j[0].intersectionRatio;if(C!==s){if(!y)return l();C?l(!1,C):r=setTimeout(()=>{l(!1,1e-7)},100)}y=!1}try{a=new IntersectionObserver(x,{...w,root:t.ownerDocument})}catch{a=new IntersectionObserver(x,w)}a.observe(n)}return l(!0),i}function Ci(n,e,a,r){r===void 0&&(r={});const{ancestorScroll:t=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,u=Et(n),d=t||i?[...u?Ge(u):[],...Ge(e)]:[];d.forEach(S=>{t&&S.addEventListener("scroll",a,{passive:!0}),i&&S.addEventListener("resize",a)});const f=u&&o?yi(u,a):null;let h=-1,p=null;l&&(p=new ResizeObserver(S=>{let[w]=S;w&&w.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{p&&p.observe(e)})),a()}),u&&!s&&p.observe(u),p.observe(e));let m,b=s?Gt(n):null;s&&g();function g(){const S=Gt(n);b&&(S.x!==b.x||S.y!==b.y||S.width!==b.width||S.height!==b.height)&&a(),b=S,m=requestAnimationFrame(g)}return a(),()=>{d.forEach(S=>{t&&S.removeEventListener("scroll",a),i&&S.removeEventListener("resize",a)}),f&&f(),p&&p.disconnect(),p=null,s&&cancelAnimationFrame(m)}}var gt=v.useLayoutEffect,wi=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],Ye=function(){};function Oi(n,e){return e?e[0]==="-"?n+e:n+"__"+e:n}function Ii(n,e){for(var a=arguments.length,r=new Array(a>2?a-2:0),t=2;t-1}function Mi(n){return rt(n)?window.innerHeight:n.clientHeight}function Hn(n){return rt(n)?window.pageYOffset:n.scrollTop}function Ke(n,e){if(rt(n)){window.scrollTo(0,e);return}n.scrollTop=e}function ki(n){var e=getComputedStyle(n),a=e.position==="absolute",r=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var t=n;t=t.parentElement;)if(e=getComputedStyle(t),!(a&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return t;return document.documentElement}function Pi(n,e,a,r){return a*((n=n/r-1)*n*n+1)+e}function Ae(n,e){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ye,t=Hn(n),i=e-t,l=10,o=0;function s(){o+=l;var u=Pi(o,t,i,a);Ke(n,u),oa.bottom?Ke(n,Math.min(e.offsetTop+e.clientHeight-n.offsetHeight+t,n.scrollHeight)):r.top-t1?a-1:0),t=1;t=m)return{placement:"bottom",maxHeight:e};if(T>=m&&!l)return i&&Ae(s,A,H),{placement:"bottom",maxHeight:e};if(!l&&T>=r||l&&V>=r){i&&Ae(s,A,H);var D=l?V-x:T-x;return{placement:"bottom",maxHeight:D}}if(t==="auto"||l){var O=e,L=l?C:M;return L>=r&&(O=Math.min(L-x-o,e)),{placement:"top",maxHeight:O}}if(t==="bottom")return i&&Ke(s,A),{placement:"bottom",maxHeight:e};break;case"top":if(C>=m)return{placement:"top",maxHeight:e};if(M>=m&&!l)return i&&Ae(s,W,H),{placement:"top",maxHeight:e};if(!l&&M>=r||l&&C>=r){var _=e;return(!l&&M>=r||l&&C>=r)&&(_=l?C-j:M-j),i&&Ae(s,W,H),{placement:"top",maxHeight:_}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(t,'".'))}return u}function zi(n){var e={bottom:"top",top:"bottom"};return n?e[n]:"bottom"}var Wn=function(e){return e==="auto"?"bottom":e},Ai=function(e,a){var r,t=e.placement,i=e.theme,l=i.borderRadius,o=i.spacing,s=i.colors;return k((r={label:"menu"},Ee(r,zi(t),"100%"),Ee(r,"position","absolute"),Ee(r,"width","100%"),Ee(r,"zIndex",1),r),a?{}:{backgroundColor:s.neutral0,borderRadius:l,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:o.menuGutter,marginTop:o.menuGutter})},Un=v.createContext(null),_i=function(e){var a=e.children,r=e.minMenuHeight,t=e.maxMenuHeight,i=e.menuPlacement,l=e.menuPosition,o=e.menuShouldScrollIntoView,s=e.theme,u=v.useContext(Un)||{},d=u.setPortalPlacement,f=v.useRef(null),h=v.useState(t),p=fe(h,2),m=p[0],b=p[1],g=v.useState(null),S=fe(g,2),w=S[0],y=S[1],x=s.spacing.controlHeight;return gt(function(){var j=f.current;if(j){var C=l==="fixed",V=o&&!C,M=$i({maxHeight:t,menuEl:j,minHeight:r,placement:i,shouldScroll:V,isFixedPosition:C,controlHeight:x});b(M.maxHeight),y(M.placement),d==null||d(M.placement)}},[t,i,l,o,r,d,x]),a({ref:f,placerProps:k(k({},e),{},{placement:w||Wn(i),maxHeight:m})})},Hi=function(e){var a=e.children,r=e.innerRef,t=e.innerProps;return P("div",E({},B(e,"menu",{menu:!0}),{ref:r},t),a)},Bi=Hi,Wi=function(e,a){var r=e.maxHeight,t=e.theme.spacing.baseUnit;return k({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},a?{}:{paddingBottom:t,paddingTop:t})},Ui=function(e){var a=e.children,r=e.innerProps,t=e.innerRef,i=e.isMulti;return P("div",E({},B(e,"menuList",{"menu-list":!0,"menu-list--is-multi":i}),{ref:t},r),a)},Gn=function(e,a){var r=e.theme,t=r.spacing.baseUnit,i=r.colors;return k({textAlign:"center"},a?{}:{color:i.neutral40,padding:"".concat(t*2,"px ").concat(t*3,"px")})},Gi=Gn,Yi=Gn,Ki=function(e){var a=e.children,r=a===void 0?"No options":a,t=e.innerProps,i=he(e,Ti);return P("div",E({},B(k(k({},i),{},{children:r,innerProps:t}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),t),r)},qi=function(e){var a=e.children,r=a===void 0?"Loading...":a,t=e.innerProps,i=he(e,Ni);return P("div",E({},B(k(k({},i),{},{children:r,innerProps:t}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),t),r)},Xi=function(e){var a=e.rect,r=e.offset,t=e.position;return{left:a.left,position:t,top:r,width:a.width,zIndex:1}},Zi=function(e){var a=e.appendTo,r=e.children,t=e.controlElement,i=e.innerProps,l=e.menuPlacement,o=e.menuPosition,s=v.useRef(null),u=v.useRef(null),d=v.useState(Wn(l)),f=fe(d,2),h=f[0],p=f[1],m=v.useMemo(function(){return{setPortalPlacement:p}},[]),b=v.useState(null),g=fe(b,2),S=g[0],w=g[1],y=v.useCallback(function(){if(t){var V=ji(t),M=o==="fixed"?0:window.pageYOffset,T=V[h]+M;(T!==(S==null?void 0:S.offset)||V.left!==(S==null?void 0:S.rect.left)||V.width!==(S==null?void 0:S.rect.width))&&w({offset:T,rect:V})}},[t,o,h,S==null?void 0:S.offset,S==null?void 0:S.rect.left,S==null?void 0:S.rect.width]);gt(function(){y()},[y]);var x=v.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),t&&s.current&&(u.current=Ci(t,s.current,y,{elementResize:"ResizeObserver"in window}))},[t,y]);gt(function(){x()},[x]);var j=v.useCallback(function(V){s.current=V,x()},[x]);if(!a&&o!=="fixed"||!S)return null;var C=P("div",E({ref:j},B(k(k({},e),{},{offset:S.offset,position:o,rect:S.rect}),"menuPortal",{"menu-portal":!0}),i),r);return P(Un.Provider,{value:m},a?wa.createPortal(C,a):C)},Ji=function(e){var a=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:a?"none":void 0,position:"relative"}},Qi=function(e){var a=e.children,r=e.innerProps,t=e.isDisabled,i=e.isRtl;return P("div",E({},B(e,"container",{"--is-disabled":t,"--is-rtl":i}),r),a)},eo=function(e,a){var r=e.theme.spacing,t=e.isMulti,i=e.hasValue,l=e.selectProps.controlShouldRenderValue;return k({alignItems:"center",display:t&&i&&l?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},a?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},to=function(e){var a=e.children,r=e.innerProps,t=e.isMulti,i=e.hasValue;return P("div",E({},B(e,"valueContainer",{"value-container":!0,"value-container--is-multi":t,"value-container--has-value":i}),r),a)},no=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},ao=function(e){var a=e.children,r=e.innerProps;return P("div",E({},B(e,"indicatorsContainer",{indicators:!0}),r),a)},Xt,ro=["size"],io=["innerProps","isRtl","size"],oo={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},Yn=function(e){var a=e.size,r=he(e,ro);return P("svg",E({height:a,width:a,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:oo},r))},Ft=function(e){return P(Yn,E({size:20},e),P("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Kn=function(e){return P(Yn,E({size:20},e),P("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},qn=function(e,a){var r=e.isFocused,t=e.theme,i=t.spacing.baseUnit,l=t.colors;return k({label:"indicatorContainer",display:"flex",transition:"color 150ms"},a?{}:{color:r?l.neutral60:l.neutral20,padding:i*2,":hover":{color:r?l.neutral80:l.neutral40}})},so=qn,lo=function(e){var a=e.children,r=e.innerProps;return P("div",E({},B(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),a||P(Kn,null))},co=qn,uo=function(e){var a=e.children,r=e.innerProps;return P("div",E({},B(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),a||P(Ft,null))},fo=function(e,a){var r=e.isDisabled,t=e.theme,i=t.spacing.baseUnit,l=t.colors;return k({label:"indicatorSeparator",alignSelf:"stretch",width:1},a?{}:{backgroundColor:r?l.neutral10:l.neutral20,marginBottom:i*2,marginTop:i*2})},po=function(e){var a=e.innerProps;return P("span",E({},a,B(e,"indicatorSeparator",{"indicator-separator":!0})))},ho=Ca(Xt||(Xt=ui([`
- 0%, 80%, 100% { opacity: 0; }
- 40% { opacity: 1; }
-`]))),mo=function(e,a){var r=e.isFocused,t=e.size,i=e.theme,l=i.colors,o=i.spacing.baseUnit;return k({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:t,lineHeight:1,marginRight:t,textAlign:"center",verticalAlign:"middle"},a?{}:{color:r?l.neutral60:l.neutral20,padding:o*2})},ct=function(e){var a=e.delay,r=e.offset;return P("span",{css:hn({animation:"".concat(ho," 1s ease-in-out ").concat(a,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},vo=function(e){var a=e.innerProps,r=e.isRtl,t=e.size,i=t===void 0?4:t,l=he(e,io);return P("div",E({},B(k(k({},l),{},{innerProps:a,isRtl:r,size:i}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),a),P(ct,{delay:0,offset:r}),P(ct,{delay:160,offset:!0}),P(ct,{delay:320,offset:!r}))},go=function(e,a){var r=e.isDisabled,t=e.isFocused,i=e.theme,l=i.colors,o=i.borderRadius,s=i.spacing;return k({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:s.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},a?{}:{backgroundColor:r?l.neutral5:l.neutral0,borderColor:r?l.neutral10:t?l.primary:l.neutral20,borderRadius:o,borderStyle:"solid",borderWidth:1,boxShadow:t?"0 0 0 1px ".concat(l.primary):void 0,"&:hover":{borderColor:t?l.primary:l.neutral30}})},bo=function(e){var a=e.children,r=e.isDisabled,t=e.isFocused,i=e.innerRef,l=e.innerProps,o=e.menuIsOpen;return P("div",E({ref:i},B(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":t,"control--menu-is-open":o}),l,{"aria-disabled":r||void 0}),a)},So=bo,xo=["data"],yo=function(e,a){var r=e.theme.spacing;return a?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},Co=function(e){var a=e.children,r=e.cx,t=e.getStyles,i=e.getClassNames,l=e.Heading,o=e.headingProps,s=e.innerProps,u=e.label,d=e.theme,f=e.selectProps;return P("div",E({},B(e,"group",{group:!0}),s),P(l,E({},o,{selectProps:f,theme:d,getStyles:t,getClassNames:i,cx:r}),u),P("div",null,a))},wo=function(e,a){var r=e.theme,t=r.colors,i=r.spacing;return k({label:"group",cursor:"default",display:"block"},a?{}:{color:t.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:i.baseUnit*3,paddingRight:i.baseUnit*3,textTransform:"uppercase"})},Oo=function(e){var a=_n(e);a.data;var r=he(a,xo);return P("div",E({},B(e,"groupHeading",{"group-heading":!0}),r))},Io=Co,Mo=["innerRef","isDisabled","isHidden","inputClassName"],ko=function(e,a){var r=e.isDisabled,t=e.value,i=e.theme,l=i.spacing,o=i.colors;return k(k({visibility:r?"hidden":"visible",transform:t?"translateZ(0)":""},Po),a?{}:{margin:l.baseUnit/2,paddingBottom:l.baseUnit/2,paddingTop:l.baseUnit/2,color:o.neutral80})},Xn={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},Po={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":k({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Xn)},jo=function(e){return k({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},Xn)},Do=function(e){var a=e.cx,r=e.value,t=_n(e),i=t.innerRef,l=t.isDisabled,o=t.isHidden,s=t.inputClassName,u=he(t,Mo);return P("div",E({},B(e,"input",{"input-container":!0}),{"data-value":r||""}),P("input",E({className:a({input:!0},s),ref:i,style:jo(o),disabled:l},u)))},Vo=Do,Eo=function(e,a){var r=e.theme,t=r.spacing,i=r.borderRadius,l=r.colors;return k({label:"multiValue",display:"flex",minWidth:0},a?{}:{backgroundColor:l.neutral10,borderRadius:i/2,margin:t.baseUnit/2})},Fo=function(e,a){var r=e.theme,t=r.borderRadius,i=r.colors,l=e.cropWithEllipsis;return k({overflow:"hidden",textOverflow:l||l===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},a?{}:{borderRadius:t/2,color:i.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},Lo=function(e,a){var r=e.theme,t=r.spacing,i=r.borderRadius,l=r.colors,o=e.isFocused;return k({alignItems:"center",display:"flex"},a?{}:{borderRadius:i/2,backgroundColor:o?l.dangerLight:void 0,paddingLeft:t.baseUnit,paddingRight:t.baseUnit,":hover":{backgroundColor:l.dangerLight,color:l.danger}})},Zn=function(e){var a=e.children,r=e.innerProps;return P("div",r,a)},Ro=Zn,To=Zn;function No(n){var e=n.children,a=n.innerProps;return P("div",E({role:"button"},a),e||P(Ft,{size:14}))}var $o=function(e){var a=e.children,r=e.components,t=e.data,i=e.innerProps,l=e.isDisabled,o=e.removeProps,s=e.selectProps,u=r.Container,d=r.Label,f=r.Remove;return P(u,{data:t,innerProps:k(k({},B(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":l})),i),selectProps:s},P(d,{data:t,innerProps:k({},B(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:s},a),P(f,{data:t,innerProps:k(k({},B(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(a||"option")},o),selectProps:s}))},zo=$o,Ao=function(e,a){var r=e.isDisabled,t=e.isFocused,i=e.isSelected,l=e.theme,o=l.spacing,s=l.colors;return k({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},a?{}:{backgroundColor:i?s.primary:t?s.primary25:"transparent",color:r?s.neutral20:i?s.neutral0:"inherit",padding:"".concat(o.baseUnit*2,"px ").concat(o.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:i?s.primary:s.primary50}})},_o=function(e){var a=e.children,r=e.isDisabled,t=e.isFocused,i=e.isSelected,l=e.innerRef,o=e.innerProps;return P("div",E({},B(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":t,"option--is-selected":i}),{ref:l,"aria-disabled":r},o),a)},Ho=_o,Bo=function(e,a){var r=e.theme,t=r.spacing,i=r.colors;return k({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},a?{}:{color:i.neutral50,marginLeft:t.baseUnit/2,marginRight:t.baseUnit/2})},Wo=function(e){var a=e.children,r=e.innerProps;return P("div",E({},B(e,"placeholder",{placeholder:!0}),r),a)},Uo=Wo,Go=function(e,a){var r=e.isDisabled,t=e.theme,i=t.spacing,l=t.colors;return k({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a?{}:{color:r?l.neutral40:l.neutral80,marginLeft:i.baseUnit/2,marginRight:i.baseUnit/2})},Yo=function(e){var a=e.children,r=e.isDisabled,t=e.innerProps;return P("div",E({},B(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),t),a)},Ko=Yo,qo={ClearIndicator:uo,Control:So,DropdownIndicator:lo,DownChevron:Kn,CrossIcon:Ft,Group:Io,GroupHeading:Oo,IndicatorsContainer:ao,IndicatorSeparator:po,Input:Vo,LoadingIndicator:vo,Menu:Bi,MenuList:Ui,MenuPortal:Zi,LoadingMessage:qi,NoOptionsMessage:Ki,MultiValue:zo,MultiValueContainer:Ro,MultiValueLabel:To,MultiValueRemove:No,Option:Ho,Placeholder:Uo,SelectContainer:Qi,SingleValue:Ko,ValueContainer:to},Xo=function(e){return k(k({},qo),e.components)},Zt=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Zo(n,e){return!!(n===e||Zt(n)&&Zt(e))}function Jo(n,e){if(n.length!==e.length)return!1;for(var a=0;a1?"s":""," ").concat(i.join(","),", selected.");case"select-option":return l?"option ".concat(t," is disabled. Select another option."):"option ".concat(t,", selected.");default:return""}},onFocus:function(e){var a=e.context,r=e.focused,t=e.options,i=e.label,l=i===void 0?"":i,o=e.selectValue,s=e.isDisabled,u=e.isSelected,d=function(m,b){return m&&m.length?"".concat(m.indexOf(b)+1," of ").concat(m.length):""};if(a==="value"&&o)return"value ".concat(l," focused, ").concat(d(o,r),".");if(a==="menu"){var f=s?" disabled":"",h="".concat(u?"selected":"focused").concat(f);return"option ".concat(l," ").concat(h,", ").concat(d(t,r),".")}return""},onFilter:function(e){var a=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(a?" for search term "+a:"",".")}},as=function(e){var a=e.ariaSelection,r=e.focusedOption,t=e.focusedValue,i=e.focusableOptions,l=e.isFocused,o=e.selectValue,s=e.selectProps,u=e.id,d=s.ariaLiveMessages,f=s.getOptionLabel,h=s.inputValue,p=s.isMulti,m=s.isOptionDisabled,b=s.isSearchable,g=s.menuIsOpen,S=s.options,w=s.screenReaderStatus,y=s.tabSelectsValue,x=s["aria-label"],j=s["aria-live"],C=v.useMemo(function(){return k(k({},ns),d||{})},[d]),V=v.useMemo(function(){var O="";if(a&&C.onChange){var L=a.option,_=a.options,I=a.removedValue,R=a.removedValues,N=a.value,$=function(ce){return Array.isArray(ce)?null:ce},se=I||L||$(N),Y=se?f(se):"",X=_||R||void 0,me=X?X.map(f):[],ve=k({isDisabled:se&&m(se,o),label:Y,labels:me},a);O=C.onChange(ve)}return O},[a,C,m,o,f]),M=v.useMemo(function(){var O="",L=r||t,_=!!(r&&o&&o.includes(r));if(L&&C.onFocus){var I={focused:L,label:f(L),isDisabled:m(L,o),isSelected:_,options:i,context:L===r?"menu":"value",selectValue:o};O=C.onFocus(I)}return O},[r,t,f,m,C,i,o]),T=v.useMemo(function(){var O="";if(g&&S.length&&C.onFilter){var L=w({count:i.length});O=C.onFilter({inputValue:h,resultsMessage:L})}return O},[i,h,g,C,S,w]),A=v.useMemo(function(){var O="";if(C.guidance){var L=t?"value":g?"menu":"input";O=C.guidance({"aria-label":x,context:L,isDisabled:r&&m(r,o),isMulti:p,isSearchable:b,tabSelectsValue:y})}return O},[x,r,t,p,m,b,g,C,o,y]),W="".concat(M," ").concat(T," ").concat(A),H=P(v.Fragment,null,P("span",{id:"aria-selection"},V),P("span",{id:"aria-context"},W)),D=(a==null?void 0:a.action)==="initial-input-focus";return P(v.Fragment,null,P(Jt,{id:u},D&&H),P(Jt,{"aria-live":j,"aria-atomic":"false","aria-relevant":"additions text"},l&&!D&&H))},rs=as,bt=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],is=new RegExp("["+bt.map(function(n){return n.letters}).join("")+"]","g"),Jn={};for(var ut=0;ut-1}},cs=["innerRef"];function us(n){var e=n.innerRef,a=he(n,cs),r=Ri(a,"onExited","in","enter","exit","appear");return P("input",E({ref:e},r,{css:hn({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var ds=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function fs(n){var e=n.isEnabled,a=n.onBottomArrive,r=n.onBottomLeave,t=n.onTopArrive,i=n.onTopLeave,l=v.useRef(!1),o=v.useRef(!1),s=v.useRef(0),u=v.useRef(null),d=v.useCallback(function(g,S){if(u.current!==null){var w=u.current,y=w.scrollTop,x=w.scrollHeight,j=w.clientHeight,C=u.current,V=S>0,M=x-j-y,T=!1;M>S&&l.current&&(r&&r(g),l.current=!1),V&&o.current&&(i&&i(g),o.current=!1),V&&S>M?(a&&!l.current&&a(g),C.scrollTop=x,T=!0,l.current=!0):!V&&-S>y&&(t&&!o.current&&t(g),C.scrollTop=0,T=!0,o.current=!0),T&&ds(g)}},[a,r,t,i]),f=v.useCallback(function(g){d(g,g.deltaY)},[d]),h=v.useCallback(function(g){s.current=g.changedTouches[0].clientY},[]),p=v.useCallback(function(g){var S=s.current-g.changedTouches[0].clientY;d(g,S)},[d]),m=v.useCallback(function(g){if(g){var S=Ei?{passive:!1}:!1;g.addEventListener("wheel",f,S),g.addEventListener("touchstart",h,S),g.addEventListener("touchmove",p,S)}},[p,h,f]),b=v.useCallback(function(g){g&&(g.removeEventListener("wheel",f,!1),g.removeEventListener("touchstart",h,!1),g.removeEventListener("touchmove",p,!1))},[p,h,f]);return v.useEffect(function(){if(e){var g=u.current;return m(g),function(){b(g)}}},[e,m,b]),function(g){u.current=g}}var en=["boxSizing","height","overflow","paddingRight","position"],tn={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function nn(n){n.preventDefault()}function an(n){n.stopPropagation()}function rn(){var n=this.scrollTop,e=this.scrollHeight,a=n+this.offsetHeight;n===0?this.scrollTop=1:a===e&&(this.scrollTop=n-1)}function on(){return"ontouchstart"in window||navigator.maxTouchPoints}var sn=!!(typeof window<"u"&&window.document&&window.document.createElement),Ve=0,Ce={capture:!1,passive:!1};function ps(n){var e=n.isEnabled,a=n.accountForScrollbars,r=a===void 0?!0:a,t=v.useRef({}),i=v.useRef(null),l=v.useCallback(function(s){if(sn){var u=document.body,d=u&&u.style;if(r&&en.forEach(function(m){var b=d&&d[m];t.current[m]=b}),r&&Ve<1){var f=parseInt(t.current.paddingRight,10)||0,h=document.body?document.body.clientWidth:0,p=window.innerWidth-h+f||0;Object.keys(tn).forEach(function(m){var b=tn[m];d&&(d[m]=b)}),d&&(d.paddingRight="".concat(p,"px"))}u&&on()&&(u.addEventListener("touchmove",nn,Ce),s&&(s.addEventListener("touchstart",rn,Ce),s.addEventListener("touchmove",an,Ce))),Ve+=1}},[r]),o=v.useCallback(function(s){if(sn){var u=document.body,d=u&&u.style;Ve=Math.max(Ve-1,0),r&&Ve<1&&en.forEach(function(f){var h=t.current[f];d&&(d[f]=h)}),u&&on()&&(u.removeEventListener("touchmove",nn,Ce),s&&(s.removeEventListener("touchstart",rn,Ce),s.removeEventListener("touchmove",an,Ce)))}},[r]);return v.useEffect(function(){if(e){var s=i.current;return l(s),function(){o(s)}}},[e,l,o]),function(s){i.current=s}}var hs=function(e){var a=e.target;return a.ownerDocument.activeElement&&a.ownerDocument.activeElement.blur()},ms={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function vs(n){var e=n.children,a=n.lockEnabled,r=n.captureEnabled,t=r===void 0?!0:r,i=n.onBottomArrive,l=n.onBottomLeave,o=n.onTopArrive,s=n.onTopLeave,u=fs({isEnabled:t,onBottomArrive:i,onBottomLeave:l,onTopArrive:o,onTopLeave:s}),d=ps({isEnabled:a}),f=function(p){u(p),d(p)};return P(v.Fragment,null,a&&P("div",{onClick:hs,css:ms}),e(f))}var gs={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},bs=function(e){var a=e.name,r=e.onFocus;return P("input",{required:!0,name:a,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:gs,value:"",onChange:function(){}})},Ss=bs,xs=function(e){return e.label},ys=function(e){return e.label},Cs=function(e){return e.value},ws=function(e){return!!e.isDisabled},Os={clearIndicator:co,container:Ji,control:go,dropdownIndicator:so,group:yo,groupHeading:wo,indicatorsContainer:no,indicatorSeparator:fo,input:ko,loadingIndicator:mo,loadingMessage:Yi,menu:Ai,menuList:Wi,menuPortal:Xi,multiValue:Eo,multiValueLabel:Fo,multiValueRemove:Lo,noOptionsMessage:Gi,option:Ao,placeholder:Bo,singleValue:Go,valueContainer:eo},Is={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Ms=4,ea=4,ks=38,Ps=ea*2,js={baseUnit:ea,controlHeight:ks,menuGutter:Ps},pt={borderRadius:Ms,colors:Is,spacing:js},Ds={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:qt(),captureMenuScroll:!qt(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:ls(),formatGroupLabel:xs,getOptionLabel:ys,getOptionValue:Cs,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:ws,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Di(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var a=e.count;return"".concat(a," result").concat(a!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function ln(n,e,a,r){var t=ra(n,e,a),i=ia(n,e,a),l=aa(n,e),o=qe(n,e);return{type:"option",data:e,isDisabled:t,isSelected:i,label:l,value:o,index:r}}function ta(n,e){return n.options.map(function(a,r){if("options"in a){var t=a.options.map(function(l,o){return ln(n,l,e,o)}).filter(function(l){return cn(n,l)});return t.length>0?{type:"group",data:a,options:t,index:r}:void 0}var i=ln(n,a,e,r);return cn(n,i)?i:void 0}).filter(Fi)}function na(n){return n.reduce(function(e,a){return a.type==="group"?e.push.apply(e,Rn(a.options.map(function(r){return r.data}))):e.push(a.data),e},[])}function Vs(n,e){return na(ta(n,e))}function cn(n,e){var a=n.inputValue,r=a===void 0?"":a,t=e.data,i=e.isSelected,l=e.label,o=e.value;return(!sa(n)||!i)&&oa(n,{label:l,value:o,data:t},r)}function Es(n,e){var a=n.focusedValue,r=n.selectValue,t=r.indexOf(a);if(t>-1){var i=e.indexOf(a);if(i>-1)return a;if(t-1?a:e[0]}var aa=function(e,a){return e.getOptionLabel(a)},qe=function(e,a){return e.getOptionValue(a)};function ra(n,e,a){return typeof n.isOptionDisabled=="function"?n.isOptionDisabled(e,a):!1}function ia(n,e,a){if(a.indexOf(e)>-1)return!0;if(typeof n.isOptionSelected=="function")return n.isOptionSelected(e,a);var r=qe(n,e);return a.some(function(t){return qe(n,t)===r})}function oa(n,e,a){return n.filterOption?n.filterOption(e,a):!0}var sa=function(e){var a=e.hideSelectedOptions,r=e.isMulti;return a===void 0?r:a},Ls=1,la=function(n){ni(a,n);var e=oi(a);function a(r){var t;if(ei(this,a),t=e.call(this,r),t.state={ariaSelection:null,focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0},t.blockOptionHover=!1,t.isComposing=!1,t.commonProps=void 0,t.initialTouchX=0,t.initialTouchY=0,t.instancePrefix="",t.openAfterFocus=!1,t.scrollToFocusedOptionOnUpdate=!1,t.userIsDragging=void 0,t.controlRef=null,t.getControlRef=function(o){t.controlRef=o},t.focusedOptionRef=null,t.getFocusedOptionRef=function(o){t.focusedOptionRef=o},t.menuListRef=null,t.getMenuListRef=function(o){t.menuListRef=o},t.inputRef=null,t.getInputRef=function(o){t.inputRef=o},t.focus=t.focusInput,t.blur=t.blurInput,t.onChange=function(o,s){var u=t.props,d=u.onChange,f=u.name;s.name=f,t.ariaOnChange(o,s),d(o,s)},t.setValue=function(o,s,u){var d=t.props,f=d.closeMenuOnSelect,h=d.isMulti,p=d.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:p}),f&&(t.setState({inputIsHiddenAfterUpdate:!h}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(o,{action:s,option:u})},t.selectOption=function(o){var s=t.props,u=s.blurInputOnSelect,d=s.isMulti,f=s.name,h=t.state.selectValue,p=d&&t.isOptionSelected(o,h),m=t.isOptionDisabled(o,h);if(p){var b=t.getOptionValue(o);t.setValue(h.filter(function(g){return t.getOptionValue(g)!==b}),"deselect-option",o)}else if(!m)d?t.setValue([].concat(Rn(h),[o]),"select-option",o):t.setValue(o,"select-option");else{t.ariaOnChange(o,{action:"select-option",option:o,name:f});return}u&&t.blurInput()},t.removeValue=function(o){var s=t.props.isMulti,u=t.state.selectValue,d=t.getOptionValue(o),f=u.filter(function(p){return t.getOptionValue(p)!==d}),h=He(s,f,f[0]||null);t.onChange(h,{action:"remove-value",removedValue:o}),t.focusInput()},t.clearValue=function(){var o=t.state.selectValue;t.onChange(He(t.props.isMulti,[],null),{action:"clear",removedValues:o})},t.popValue=function(){var o=t.props.isMulti,s=t.state.selectValue,u=s[s.length-1],d=s.slice(0,s.length-1),f=He(o,d,d[0]||null);t.onChange(f,{action:"pop-value",removedValue:u})},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var o=arguments.length,s=new Array(o),u=0;uh||f>h}},t.onTouchEnd=function(o){t.userIsDragging||(t.controlRef&&!t.controlRef.contains(o.target)&&t.menuListRef&&!t.menuListRef.contains(o.target)&&t.blurInput(),t.initialTouchX=0,t.initialTouchY=0)},t.onControlTouchEnd=function(o){t.userIsDragging||t.onControlMouseDown(o)},t.onClearIndicatorTouchEnd=function(o){t.userIsDragging||t.onClearIndicatorMouseDown(o)},t.onDropdownIndicatorTouchEnd=function(o){t.userIsDragging||t.onDropdownIndicatorMouseDown(o)},t.handleInputChange=function(o){var s=t.props.inputValue,u=o.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(u,{action:"input-change",prevInputValue:s}),t.props.menuIsOpen||t.onMenuOpen()},t.onInputFocus=function(o){t.props.onFocus&&t.props.onFocus(o),t.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(t.openAfterFocus||t.props.openMenuOnFocus)&&t.openMenu("first"),t.openAfterFocus=!1},t.onInputBlur=function(o){var s=t.props.inputValue;if(t.menuListRef&&t.menuListRef.contains(document.activeElement)){t.inputRef.focus();return}t.props.onBlur&&t.props.onBlur(o),t.onInputChange("",{action:"input-blur",prevInputValue:s}),t.onMenuClose(),t.setState({focusedValue:null,isFocused:!1})},t.onOptionHover=function(o){t.blockOptionHover||t.state.focusedOption===o||t.setState({focusedOption:o})},t.shouldHideSelectedOptions=function(){return sa(t.props)},t.onValueInputFocus=function(o){o.preventDefault(),o.stopPropagation(),t.focus()},t.onKeyDown=function(o){var s=t.props,u=s.isMulti,d=s.backspaceRemovesValue,f=s.escapeClearsValue,h=s.inputValue,p=s.isClearable,m=s.isDisabled,b=s.menuIsOpen,g=s.onKeyDown,S=s.tabSelectsValue,w=s.openMenuOnFocus,y=t.state,x=y.focusedOption,j=y.focusedValue,C=y.selectValue;if(!m&&!(typeof g=="function"&&(g(o),o.defaultPrevented))){switch(t.blockOptionHover=!0,o.key){case"ArrowLeft":if(!u||h)return;t.focusValue("previous");break;case"ArrowRight":if(!u||h)return;t.focusValue("next");break;case"Delete":case"Backspace":if(h)return;if(j)t.removeValue(j);else{if(!d)return;u?t.popValue():p&&t.clearValue()}break;case"Tab":if(t.isComposing||o.shiftKey||!b||!S||!x||w&&t.isOptionSelected(x,C))return;t.selectOption(x);break;case"Enter":if(o.keyCode===229)break;if(b){if(!x||t.isComposing)return;t.selectOption(x);break}return;case"Escape":b?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:h}),t.onMenuClose()):p&&f&&t.clearValue();break;case" ":if(h)return;if(!b){t.openMenu("first");break}if(!x)return;t.selectOption(x);break;case"ArrowUp":b?t.focusOption("up"):t.openMenu("last");break;case"ArrowDown":b?t.focusOption("down"):t.openMenu("first");break;case"PageUp":if(!b)return;t.focusOption("pageup");break;case"PageDown":if(!b)return;t.focusOption("pagedown");break;case"Home":if(!b)return;t.focusOption("first");break;case"End":if(!b)return;t.focusOption("last");break;default:return}o.preventDefault()}},t.instancePrefix="react-select-"+(t.props.instanceId||++Ls),t.state.selectValue=Yt(r.value),r.menuIsOpen&&t.state.selectValue.length){var i=t.buildFocusableOptions(),l=i.indexOf(t.state.selectValue[0]);t.state.focusedOption=i[l]}return t}return ti(a,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Kt(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(t){var i=this.props,l=i.isDisabled,o=i.menuIsOpen,s=this.state.isFocused;(s&&!l&&t.isDisabled||s&&o&&!t.menuIsOpen)&&this.focusInput(),s&&l&&!t.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!s&&!l&&t.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Kt(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(t,i){this.props.onInputChange(t,i)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(t){var i=this,l=this.state,o=l.selectValue,s=l.isFocused,u=this.buildFocusableOptions(),d=t==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(o[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(s&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d]},function(){return i.onMenuOpen()})}},{key:"focusValue",value:function(t){var i=this.state,l=i.selectValue,o=i.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var s=l.indexOf(o);o||(s=-1);var u=l.length-1,d=-1;if(l.length){switch(t){case"previous":s===0?d=0:s===-1?d=u:d=s-1;break;case"next":s>-1&&s0&&arguments[0]!==void 0?arguments[0]:"first",i=this.props.pageSize,l=this.state.focusedOption,o=this.getFocusableOptions();if(o.length){var s=0,u=o.indexOf(l);l||(u=-1),t==="up"?s=u>0?u-1:o.length-1:t==="down"?s=(u+1)%o.length:t==="pageup"?(s=u-i,s<0&&(s=0)):t==="pagedown"?(s=u+i,s>o.length-1&&(s=o.length-1)):t==="last"&&(s=o.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:o[s],focusedValue:null})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(pt):k(k({},pt),this.props.theme):pt}},{key:"getCommonProps",value:function(){var t=this.clearValue,i=this.cx,l=this.getStyles,o=this.getClassNames,s=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,h=f.isMulti,p=f.isRtl,m=f.options,b=this.hasValue();return{clearValue:t,cx:i,getStyles:l,getClassNames:o,getValue:s,hasValue:b,isMulti:h,isRtl:p,options:m,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var t=this.state.selectValue;return t.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var t=this.props,i=t.isClearable,l=t.isMulti;return i===void 0?l:i}},{key:"isOptionDisabled",value:function(t,i){return ra(this.props,t,i)}},{key:"isOptionSelected",value:function(t,i){return ia(this.props,t,i)}},{key:"filterOption",value:function(t,i){return oa(this.props,t,i)}},{key:"formatOptionLabel",value:function(t,i){if(typeof this.props.formatOptionLabel=="function"){var l=this.props.inputValue,o=this.state.selectValue;return this.props.formatOptionLabel(t,{context:i,inputValue:l,selectValue:o})}else return this.getOptionLabel(t)}},{key:"formatGroupLabel",value:function(t){return this.props.formatGroupLabel(t)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var t=this.props,i=t.isDisabled,l=t.isSearchable,o=t.inputId,s=t.inputValue,u=t.tabIndex,d=t.form,f=t.menuIsOpen,h=t.required,p=this.getComponents(),m=p.Input,b=this.state,g=b.inputIsHidden,S=b.ariaSelection,w=this.commonProps,y=o||this.getElementId("input"),x=k(k(k({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":h,role:"combobox"},f&&{"aria-controls":this.getElementId("listbox"),"aria-owns":this.getElementId("listbox")}),!l&&{"aria-readonly":!0}),this.hasValue()?(S==null?void 0:S.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return l?v.createElement(m,E({},w,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:y,innerRef:this.getInputRef,isDisabled:i,isHidden:g,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:s},x)):v.createElement(us,E({id:y,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Ye,onFocus:this.onInputFocus,disabled:i,tabIndex:u,inputMode:"none",form:d,value:""},x))}},{key:"renderPlaceholderOrValue",value:function(){var t=this,i=this.getComponents(),l=i.MultiValue,o=i.MultiValueContainer,s=i.MultiValueLabel,u=i.MultiValueRemove,d=i.SingleValue,f=i.Placeholder,h=this.commonProps,p=this.props,m=p.controlShouldRenderValue,b=p.isDisabled,g=p.isMulti,S=p.inputValue,w=p.placeholder,y=this.state,x=y.selectValue,j=y.focusedValue,C=y.isFocused;if(!this.hasValue()||!m)return S?null:v.createElement(f,E({},h,{key:"placeholder",isDisabled:b,isFocused:C,innerProps:{id:this.getElementId("placeholder")}}),w);if(g)return x.map(function(M,T){var A=M===j,W="".concat(t.getOptionLabel(M),"-").concat(t.getOptionValue(M));return v.createElement(l,E({},h,{components:{Container:o,Label:s,Remove:u},isFocused:A,isDisabled:b,key:W,index:T,removeProps:{onClick:function(){return t.removeValue(M)},onTouchEnd:function(){return t.removeValue(M)},onMouseDown:function(D){D.preventDefault()}},data:M}),t.formatOptionLabel(M,"value"))});if(S)return null;var V=x[0];return v.createElement(d,E({},h,{data:V,isDisabled:b}),this.formatOptionLabel(V,"value"))}},{key:"renderClearIndicator",value:function(){var t=this.getComponents(),i=t.ClearIndicator,l=this.commonProps,o=this.props,s=o.isDisabled,u=o.isLoading,d=this.state.isFocused;if(!this.isClearable()||!i||s||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return v.createElement(i,E({},l,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var t=this.getComponents(),i=t.LoadingIndicator,l=this.commonProps,o=this.props,s=o.isDisabled,u=o.isLoading,d=this.state.isFocused;if(!i||!u)return null;var f={"aria-hidden":"true"};return v.createElement(i,E({},l,{innerProps:f,isDisabled:s,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var t=this.getComponents(),i=t.DropdownIndicator,l=t.IndicatorSeparator;if(!i||!l)return null;var o=this.commonProps,s=this.props.isDisabled,u=this.state.isFocused;return v.createElement(l,E({},o,{isDisabled:s,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var t=this.getComponents(),i=t.DropdownIndicator;if(!i)return null;var l=this.commonProps,o=this.props.isDisabled,s=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return v.createElement(i,E({},l,{innerProps:u,isDisabled:o,isFocused:s}))}},{key:"renderMenu",value:function(){var t=this,i=this.getComponents(),l=i.Group,o=i.GroupHeading,s=i.Menu,u=i.MenuList,d=i.MenuPortal,f=i.LoadingMessage,h=i.NoOptionsMessage,p=i.Option,m=this.commonProps,b=this.state.focusedOption,g=this.props,S=g.captureMenuScroll,w=g.inputValue,y=g.isLoading,x=g.loadingMessage,j=g.minMenuHeight,C=g.maxMenuHeight,V=g.menuIsOpen,M=g.menuPlacement,T=g.menuPosition,A=g.menuPortalTarget,W=g.menuShouldBlockScroll,H=g.menuShouldScrollIntoView,D=g.noOptionsMessage,O=g.onMenuScrollToTop,L=g.onMenuScrollToBottom;if(!V)return null;var _=function(X,me){var ve=X.type,le=X.data,ce=X.isDisabled,je=X.isSelected,Ne=X.label,fa=X.value,Lt=b===le,Rt=ce?void 0:function(){return t.onOptionHover(le)},pa=ce?void 0:function(){return t.selectOption(le)},Tt="".concat(t.getElementId("option"),"-").concat(me),ha={id:Tt,onClick:pa,onMouseMove:Rt,onMouseOver:Rt,tabIndex:-1};return v.createElement(p,E({},m,{innerProps:ha,data:le,isDisabled:ce,isSelected:je,key:Tt,label:Ne,type:ve,value:fa,isFocused:Lt,innerRef:Lt?t.getFocusedOptionRef:void 0}),t.formatOptionLabel(X.data,"menu"))},I;if(this.hasOptions())I=this.getCategorizedOptions().map(function(Y){if(Y.type==="group"){var X=Y.data,me=Y.options,ve=Y.index,le="".concat(t.getElementId("group"),"-").concat(ve),ce="".concat(le,"-heading");return v.createElement(l,E({},m,{key:le,data:X,options:me,Heading:o,headingProps:{id:ce,data:Y.data},label:t.formatGroupLabel(Y.data)}),Y.options.map(function(je){return _(je,"".concat(ve,"-").concat(je.index))}))}else if(Y.type==="option")return _(Y,"".concat(Y.index))});else if(y){var R=x({inputValue:w});if(R===null)return null;I=v.createElement(f,m,R)}else{var N=D({inputValue:w});if(N===null)return null;I=v.createElement(h,m,N)}var $={minMenuHeight:j,maxMenuHeight:C,menuPlacement:M,menuPosition:T,menuShouldScrollIntoView:H},se=v.createElement(_i,E({},m,$),function(Y){var X=Y.ref,me=Y.placerProps,ve=me.placement,le=me.maxHeight;return v.createElement(s,E({},m,$,{innerRef:X,innerProps:{onMouseDown:t.onMenuMouseDown,onMouseMove:t.onMenuMouseMove,id:t.getElementId("listbox")},isLoading:y,placement:ve}),v.createElement(vs,{captureEnabled:S,onTopArrive:O,onBottomArrive:L,lockEnabled:W},function(ce){return v.createElement(u,E({},m,{innerRef:function(Ne){t.getMenuListRef(Ne),ce(Ne)},isLoading:y,maxHeight:le,focusedOption:b}),I)}))});return A||T==="fixed"?v.createElement(d,E({},m,{appendTo:A,controlElement:this.controlRef,menuPlacement:M,menuPosition:T}),se):se}},{key:"renderFormField",value:function(){var t=this,i=this.props,l=i.delimiter,o=i.isDisabled,s=i.isMulti,u=i.name,d=i.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!o)return v.createElement(Ss,{name:u,onFocus:this.onValueInputFocus});if(!(!u||o))if(s)if(l){var h=f.map(function(b){return t.getOptionValue(b)}).join(l);return v.createElement("input",{name:u,type:"hidden",value:h})}else{var p=f.length>0?f.map(function(b,g){return v.createElement("input",{key:"i-".concat(g),name:u,type:"hidden",value:t.getOptionValue(b)})}):v.createElement("input",{name:u,type:"hidden",value:""});return v.createElement("div",null,p)}else{var m=f[0]?this.getOptionValue(f[0]):"";return v.createElement("input",{name:u,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var t=this.commonProps,i=this.state,l=i.ariaSelection,o=i.focusedOption,s=i.focusedValue,u=i.isFocused,d=i.selectValue,f=this.getFocusableOptions();return v.createElement(rs,E({},t,{id:this.getElementId("live-region"),ariaSelection:l,focusedOption:o,focusedValue:s,isFocused:u,selectValue:d,focusableOptions:f}))}},{key:"render",value:function(){var t=this.getComponents(),i=t.Control,l=t.IndicatorsContainer,o=t.SelectContainer,s=t.ValueContainer,u=this.props,d=u.className,f=u.id,h=u.isDisabled,p=u.menuIsOpen,m=this.state.isFocused,b=this.commonProps=this.getCommonProps();return v.createElement(o,E({},b,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:h,isFocused:m}),this.renderLiveRegion(),v.createElement(i,E({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:h,isFocused:m,menuIsOpen:p}),v.createElement(s,E({},b,{isDisabled:h}),this.renderPlaceholderOrValue(),this.renderInput()),v.createElement(l,E({},b,{isDisabled:h}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(t,i){var l=i.prevProps,o=i.clearFocusValueOnUpdate,s=i.inputIsHiddenAfterUpdate,u=i.ariaSelection,d=i.isFocused,f=i.prevWasFocused,h=t.options,p=t.value,m=t.menuIsOpen,b=t.inputValue,g=t.isMulti,S=Yt(p),w={};if(l&&(p!==l.value||h!==l.options||m!==l.menuIsOpen||b!==l.inputValue)){var y=m?Vs(t,S):[],x=o?Es(i,S):null,j=Fs(i,y);w={selectValue:S,focusedOption:j,focusedValue:x,clearFocusValueOnUpdate:!1}}var C=s!=null&&t!==l?{inputIsHidden:s,inputIsHiddenAfterUpdate:void 0}:{},V=u,M=d&&f;return d&&!M&&(V={value:He(g,S,S[0]||null),options:S,action:"initial-input-focus"},M=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(V=null),k(k(k({},w),C),{},{prevProps:t,ariaSelection:V,prevWasFocused:M})}}]),a}(v.Component);la.defaultProps=Ds;var Rs=v.forwardRef(function(n,e){var a=Qr(n);return v.createElement(la,E({ref:e},a))}),Ts=Rs,Ns=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"];function St(){return St=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(a[t]=n[t]);return a}var ca=function(e){e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme;var a=$s(e,Ns);return St({},a)},zs=function(e){var a=typeof e=="string";return a&&["sm","md","lg"].includes(e)},As=function(e){return zs(e)?e:e==="xs"?"sm":e==="xl"?"lg":"md"},oe=function(e){var a=Le(),r=As(a.components.Input.defaultProps.size),t=e??r,i=yr(typeof t=="string"?[t]:t,{fallback:"md"})||r;return i};function Oe(){return Oe=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(a[t]=n[t]);return a}var Gs=function(e){var a=e.className,r=e.cx,t=e.children,i=e.innerRef,l=e.innerProps,o=e.isDisabled,s=e.isFocused,u=e.menuIsOpen,d=e.selectProps,f=d.chakraStyles,h=d.size,p=d.variant,m=d.focusBorderColor,b=d.errorBorderColor,g=d.isInvalid,S=d.isReadOnly,w=oe(h),y=ge("Input",{size:w,variant:p,focusBorderColor:m,errorBorderColor:b}),x=y.field,j=x.height,C=x.h,V=Us(x,Ws),M=j||C,T=ae({},V,{position:"relative",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",padding:0,overflow:"hidden",height:"auto",minH:M},o?{pointerEvents:"none"}:{}),A=f!=null&&f.control?f.control(T,e):T;return F.createElement(z,ae({ref:i,className:r({control:!0,"control--is-disabled":o,"control--is-focused":s,"control--menu-is-open":u},a),sx:A},l,{"data-focus":s?!0:void 0,"data-focus-visible":s?!0:void 0,"data-invalid":g?!0:void 0,"data-disabled":o?!0:void 0,"data-readonly":S?!0:void 0}),t)},Ys=function(e){var a=e.className,r=e.cx,t=e.selectProps,i=t.chakraStyles,l=t.useBasicStyles,o=t.variant,s=ae({opacity:1},l||o!=="outline"?{display:"none"}:{}),u=i!=null&&i.indicatorSeparator?i.indicatorSeparator(s,e):s;return F.createElement(Mn,{className:r({"indicator-separator":!0},a),sx:u,orientation:"vertical"})},Ks=function(e){return F.createElement(It,ae({role:"presentation",focusable:"false","aria-hidden":"true"},e),F.createElement("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}))},qs=function(e){var a=e.children,r=e.className,t=e.cx,i=e.innerProps,l=e.selectProps,o=l.chakraStyles,s=l.useBasicStyles,u=l.size,d=l.focusBorderColor,f=l.errorBorderColor,h=l.variant,p=oe(u),m=ge("Input",{size:p,variant:h,focusBorderColor:d,errorBorderColor:f}),b={sm:"16px",md:"20px",lg:"24px"},g=b[p],S=ae({},m.addon,{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",borderRadius:0,borderWidth:0,fontSize:g},s&&{background:"transparent",padding:0,width:6,marginRight:2,marginLeft:1,cursor:"inherit"}),w=o!=null&&o.dropdownIndicator?o.dropdownIndicator(S,e):S,y={height:"1em",width:"1em"},x=o!=null&&o.downChevron?o.downChevron(y,e):y;return F.createElement(z,ae({},i,{className:t({indicator:!0,"dropdown-indicator":!0},r),sx:w}),a||F.createElement(Ks,{sx:x}))},Xs=function(e){return F.createElement(It,ae({focusable:"false","aria-hidden":!0},e),F.createElement("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}))},Zs=function(e){var a=e.children,r=e.className,t=e.cx,i=e.innerProps,l=e.selectProps,o=l.chakraStyles,s=l.size,u=oe(s),d=dn("CloseButton",{size:u}),f=ae({},d,{marginX:1,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer"}),h=o!=null&&o.clearIndicator?o.clearIndicator(f,e):f,p={width:"1em",height:"1em"},m=o!=null&&o.crossIcon?o.crossIcon(p,e):p;return F.createElement(z,ae({role:"button",className:t({indicator:!0,"clear-indicator":!0},r),sx:h,"aria-label":"Clear selected options"},i),a||F.createElement(Xs,{sx:m}))},Js=function(e){var a=e.className,r=e.cx,t=e.innerProps,i=e.selectProps,l=i.chakraStyles,o=i.size,s=e.color,u=e.emptyColor,d=e.speed,f=e.thickness,h=e.spinnerSize,p=oe(o),m={sm:"xs",md:"sm",lg:"md"},b=m[p],g={marginRight:3},S=l!=null&&l.loadingIndicator?l.loadingIndicator(g,e):g;return F.createElement(Oa,ae({className:r({indicator:!0,"loading-indicator":!0},a),sx:S},t,{size:h||b,color:s,emptyColor:u,speed:d,thickness:f}))};const Qs=Gs;var el=["innerRef","isDisabled","isHidden","inputClassName"];function Fe(){return Fe=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(a[t]=n[t]);return a}var nl=function(e){var a=e.className,r=e.cx,t=e.value,i=e.selectProps,l=i.chakraStyles,o=i.isReadOnly,s=ca(e),u=s.innerRef,d=s.isDisabled,f=s.isHidden,h=s.inputClassName,p=tl(s,el),m={gridArea:"1 / 2",minW:"2px",border:0,margin:0,outline:0,padding:0},b={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content",color:"inherit",marginX:"0.125rem",paddingY:"0.125rem",visibility:d?"hidden":"visible",transform:t?"translateZ(0)":"",_after:Fe({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre",padding:0},m)},g=l!=null&&l.inputContainer?l.inputContainer(b,e):b,S=Fe({background:0,opacity:f?0:1,width:"100%"},m),w=l!=null&&l.input?l.input(S,e):S;return F.createElement(z,{className:r({"input-container":!0},a),"data-value":t||"",sx:g},F.createElement(be.input,Fe({className:r({input:!0},h),ref:u,sx:w,disabled:d,readOnly:o?!0:void 0},p)))};const al=nl;var rl=["data"];function il(n,e){if(n==null)return{};var a={},r=Object.keys(n),t,i;for(i=0;i=0)&&(a[t]=n[t]);return a}function Q(){return Q=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(a[t]=n[t]);return a}var El=function(e){var a,r=e.components,t=r===void 0?{}:r;e.theme;var i=e.size,l=e.colorScheme,o=l===void 0?"gray":l,s=e.isDisabled,u=e.isInvalid,d=e.isReadOnly,f=e.required,h=e.isRequired,p=e.inputId,m=e.tagVariant,b=e.selectedOptionStyle,g=b===void 0?"color":b,S=e.selectedOptionColorScheme,w=e.selectedOptionColor,y=e.variant,x=e.focusBorderColor,j=e.errorBorderColor,C=e.chakraStyles,V=C===void 0?{}:C,M=e.onFocus,T=e.onBlur,A=e.menuIsOpen,W=Vl(e,Dl),H=Le(),D=H.components.Input.defaultProps.variant,O=Ga({id:p,isDisabled:s,isInvalid:u,isRequired:h,isReadOnly:d,onFocus:M,onBlur:T}),L=A??(O.readOnly?!1:void 0),_=g,I=["color","check"];I.includes(g)||(_="color");var R=S||w||"blue";typeof R!="string"&&(R="blue");var N=Xe({components:Xe({},jl,t),colorScheme:o,size:i,tagVariant:m,selectedOptionStyle:_,selectedOptionColorScheme:R,variant:y??D,chakraStyles:V,focusBorderColor:x,errorBorderColor:j,onFocus:O.onFocus,onBlur:O.onBlur,isDisabled:O.disabled,isInvalid:!!O["aria-invalid"],inputId:O.id,isReadOnly:O.readOnly,required:f??O.required,menuIsOpen:L},W,{"aria-invalid":(a=W["aria-invalid"])!=null?a:O["aria-invalid"]});return N};const Fl=El;function Ct(){return Ct=Object.assign?Object.assign.bind():function(n){for(var e=1;e({value:m,label:m})))??[],[o,s]=v.useState(l),u=async()=>{var m,b;await((m=Se)==null?void 0:m.put({name:t,workflowIDs:[],updateTime:Date.now()})),await((b=Se)==null?void 0:b.listAll().then(g=>r(g??[]))),i("")},d=async()=>{var b;const m=await((b=Se)==null?void 0:b.listAll());r(m??[])};if(Se==null)return alert("Error: TagsTable is not loaded"),null;const f=a.map(m=>({value:m.name,label:m.name})),h=37*5;return c.jsxs(Ya,{isLazy:!0,onOpen:d,closeOnBlur:!1,placement:"auto",children:[c.jsx(Ka,{children:c.jsx(te,{icon:c.jsx(Vn,{}),children:"Add Tag"})}),c.jsxs(qa,{children:[c.jsx(Xa,{}),c.jsx(Za,{}),c.jsx(jn,{children:c.jsx("b",{children:n.name})}),c.jsxs(Ja,{children:[c.jsx(Rl,{isMulti:!0,name:"tags",options:f,menuIsOpen:!0,value:o,onChange:async m=>{var b;s(m),await((b=G)==null?void 0:b.updateMetaInfo(n.id,{tags:m.map(g=>g.value)})),await(e==null?void 0:e())},chakraStyles:{dropdownIndicator:m=>({...m,p:0,w:"30px"}),menuList:m=>({...m,shadow:"none",pt:0})},placeholder:"Select tags",closeMenuOnSelect:!1,maxMenuHeight:h}),c.jsxs(K,{gap:4,mt:Math.min(h,Math.max(a.length,3)*37),children:[c.jsx(at,{placeholder:"New tag name",size:"sm",mt:6,mb:6,variant:"flushed",value:t,onChange:m=>{i(m.target.value.trim())}}),c.jsx(ee,{iconSpacing:1,leftIcon:c.jsx(kt,{size:16}),colorScheme:"teal",variant:"solid",size:"xs",px:5,isDisabled:t.length===0,onClick:u,children:"New Tag"})]})]})]})]})}function Nl({workflow:n}){const e=v.useRef(null),a=Me(),{onDuplicateWorkflow:r}=v.useContext(Pt),[t,i]=v.useState(n.saveLock??!1),l=async()=>{var u;const s=!t;i(s),await((u=G)==null?void 0:u.updateMetaInfo(n.id,{saveLock:s})),a({title:`${s?"Locked":"Unlocked"} successfully`,status:"success",duration:2e3})},o=async s=>{const u=s.target.files;if(!u)return;const d=new FormData;Array.from(u).forEach((f,h)=>{d.append(`images[${h}]`,f,f.name)}),d.append("subfolder","workspace_manager"),await fetch("/workspace/images/save",{method:"POST",body:d}),Array.from(u).forEach(f=>{var h;(h=Qa)==null||h.create({workflowID:n.id,localPath:`workspace_manager/${f.name}`})})};return c.jsxs(c.Fragment,{children:[c.jsxs(ke,{isLazy:!0,closeOnSelect:!1,children:[c.jsx(Te,{border:0,as:Z,"aria-label":"Options",icon:c.jsx(Ir,{size:20}),size:"sm",variant:"outline"}),c.jsxs(Re,{zIndex:101,children:[c.jsx(te,{icon:c.jsx(hr,{}),onClick:()=>r&&r(n.id),children:"Duplicate"}),c.jsx(Tl,{workflow:n}),c.jsx(ne,{hasArrow:!0,label:t?"Unlock workflow, allow modifying":"Lock workflow, prevent modifying",placement:"bottom",children:c.jsx(te,{icon:t?c.jsx(wn,{}):c.jsx(jr,{}),onClick:l,children:t?"Unlock":"Lock"})}),c.jsx(te,{icon:c.jsx(Rr,{}),onClick:()=>{var s;(s=e.current)==null||s.click()},children:"Upload Thumbnail Image"})]})]}),c.jsx("input",{style:{display:"none"},ref:e,type:"file",accept:".json,image/png",multiple:!0,onChange:o,onClick:s=>{s.stopPropagation()}})]})}function $l({workflow:n}){const{onDeleteFlow:e}=v.useContext(de);return c.jsxs(we,{width:"90px",justifyContent:"flex-end",children:[c.jsx(ne,{label:"Open in new tab",children:c.jsx(Z,{"aria-label":"Open in new tab",size:"sm",variant:"ghost",onClick:()=>er(n.id),icon:c.jsx(tr,{color:"#718096",size:23})})}),c.jsx(xn,{promptMessage:"Are you sure you want to delete this workflow?",onDelete:()=>{e&&e(n.id)}}),c.jsx(Nl,{workflow:n})]})}const un=v.memo(function({workflow:e}){var p,m;const{colorMode:a}=Ot(),{setDraggingFile:r,isMultiSelecting:t,onMultiSelectFlow:i,multiSelectedFlowsID:l}=v.useContext(de),o=l&&l.length>0&&l.includes(e.id),{curFlowID:s,loadWorkflowID:u}=v.useContext(Pt),d=s===e.id,f=a==="light"?"gray.200":"#4A5568",h=c.jsx(z,{flexShrink:1,flexGrow:1,backgroundColor:d?"teal.200":void 0,color:d&&!t?"#333":void 0,draggable:!t,onDragStart:()=>r==null?void 0:r(e),borderRadius:6,px:1,py:"3px",onClick:()=>{!t&&u(e.id)},_hover:{bg:f},children:c.jsxs(K,{children:[(((p=e.coverMediaPath)==null?void 0:p.length)||((m=e.latestImage)==null?void 0:m.length))&&c.jsx(dr,{mediaLocalPath:e.coverMediaPath??e.latestImage??"",size:60,hideBrokenImage:!0,isPreview:!0}),c.jsxs(ue,{textAlign:"left",gap:0,children:[c.jsxs(we,{alignItems:"center",children:[c.jsx(J,{fontWeight:"500",noOfLines:2,style:{display:"inline-block"},children:e.name??"untitled"}),e.saveLock&&c.jsx(wn,{size:18,style:{display:"inline-block"}})]}),c.jsxs(J,{color:"GrayText",ml:2,fontSize:"sm",children:["Updated: ",nr(e.updateTime)]})]})]})});return c.jsx(K,{w:"100%",mb:1,justify:"space-between",children:t?c.jsx(Pe,{isChecked:o,spacing:4,onChange:b=>{i&&i(e.id,b.target.checked)},children:h}):c.jsxs(c.Fragment,{children:[h,c.jsx($l,{workflow:e})]})})});function da({items:n}){var h;const[e,a]=v.useState(!1),r=n.filter(xe),t=n.filter(p=>!xe(p)),i=(h=t[0])==null?void 0:h.parentFolderID,[l,o]=v.useState(!1),{onRefreshFilesList:s,draggingFile:u,refreshFolderStamp:d}=v.useContext(de),f=async p=>{var m,b;if(p.preventDefault(),p.stopPropagation(),!u)return o(!1);if(xe(u)){if(u.id===i)return o(!1);await((m=pe)==null?void 0:m.update(u.id,{parentFolderID:i}))}else await((b=G)==null?void 0:b.updateFolder(u.id,{parentFolderID:i}));await(s==null?void 0:s()),o(!1)};return v.useEffect(()=>{var p;(p=U)==null||p.getSetting("foldersOnTop").then(m=>{a(m??!1)})},[d]),c.jsxs(c.Fragment,{children:[e&&r.map(p=>c.jsx(Ht,{folder:p},p.id)),c.jsx(z,{border:l?"2px dashed #718096":"2px dashed transparent",onDragOver:p=>{p.preventDefault(),p.stopPropagation(),o(!0)},onDragLeave:p=>{p.preventDefault(),p.stopPropagation(),o(!1)},onDrop:f,className:"droppable",children:e?t.map(p=>c.jsx(un,{workflow:p},p.id)):n.map(p=>xe(p)?c.jsx(Ht,{folder:p},p.id):c.jsx(un,{workflow:p},p.id))})]})}function ql({onClose:n,onClickNewFlow:e}){const[a,r]=v.useState([]),t=v.useRef([]),i=v.useRef([]),{loadWorkflowID:l,curFlowID:o}=v.useContext(Pt),[s,u]=v.useState(),[d,f]=v.useState(!1),[h,p]=v.useState([]),[m,b]=v.useState(0),[g,S]=v.useState(""),w=fr(g,400),y=v.useRef(null),[x,j]=v.useState(null),C=v.useRef(window.localStorage.getItem(ht)??De.RECENTLY_MODIFIED),V=async()=>{var I,R;t.current=await((I=G)==null?void 0:I.listFolderContent())??[],i.current=await((R=G)==null?void 0:R.listAll())??[],T(),b(Date.now())},M=!!s||!!w,T=()=>{if(M){const I=i.current.filter(R=>{var se;let N=!0,$=!0;return s&&(N=!!((se=R.tags)!=null&&se.includes(s))),w&&($=!!R.name.toLocaleLowerCase().includes(w.toLocaleLowerCase())),N&&$});r(ot(I,C.current))}else r(ot(t.current,C.current))},A=I=>{r(ot(a,I)),C.current=I,window.localStorage.setItem(ht,I),!M&&b(Date.now())};v.useEffect(()=>{T()},[w,s]);const W=v.useCallback(async I=>{var R,N,$;await((R=G)==null?void 0:R.deleteFlow(I)),(($=(N=G)==null?void 0:N.curWorkflow)==null?void 0:$.id)===I&&await(l==null?void 0:l(null)),await V()},[s,w]);v.useEffect(()=>{V();const I=async R=>{var N;if(y.current){const $=await((N=G)==null?void 0:N.get(y.current));$&&$.json&&or($.json,[R.canvasX,R.canvasY])}};return $e.canvasEl.addEventListener("drop",I),$e.canvasEl.addEventListener("click",n),()=>{$e.canvasEl.removeEventListener("drop",I),$e.canvasEl.removeEventListener("click",n)}},[]);const H=v.useCallback((I,R)=>{p(N=>{const $=[...N];return R?$.push(I):$.splice($.indexOf(I),1),$})},[]),D=(I,R)=>{var N;switch(I){case"batchDelete":o&&((N=G)==null||N.get(o).then($=>{$||l==null||l(null)})),V(),f(!1),p([]);return;case"selectAll":p(R?i.current.map($=>$.id):[]);return}},O=I=>{j(I),xe(I)||(y.current=I.id)},L=I=>{S(I)},_=450;return c.jsx(de.Provider,{value:{onRefreshFilesList:V,draggingFile:x??void 0,setDraggingFile:O,isMultiSelecting:d,onMultiSelectFlow:H,multiSelectedFlowsID:h,onDeleteFlow:W,refreshFolderStamp:m,setRefreshFolderStamp:b},children:c.jsx(z,{style:{width:_},children:c.jsxs(ar,{width:_,height:"100vh",pl:2,pr:2,pt:4,gap:4,position:"absolute",top:0,left:0,shadow:"xl",zIndex:rr,children:[c.jsxs(we,{alignItems:"center",justifyContent:"space-between",children:[c.jsxs(K,{gap:4,children:[c.jsx(K,{gap:2,children:c.jsx(J,{fontSize:19,fontWeight:600,children:"🦄Workspace"})}),c.jsx(Fn,{}),c.jsx(ne,{label:"Open workspace save directory",children:c.jsx(Z,{"aria-label":"Open workspace save directory",size:"sm",icon:c.jsx(Cn,{}),variant:"outline",colorScheme:"teal",onClick:()=>ir()})}),c.jsx(ne,{label:"New workflow",children:c.jsx(Z,{"aria-label":"New workflow",size:"sm",icon:c.jsx(kt,{}),variant:"outline",colorScheme:"teal",onClick:e})})]}),c.jsx(K,{alignItems:"center",children:c.jsx(Wr,{})})]}),c.jsxs(we,{direction:"column",h:"calc(100% - 64px)",children:[c.jsx(Gr,{selectedTag:s,setSelectedTag:u}),c.jsxs(K,{mb:2,mt:2,p:0,justifyContent:"space-between",children:[c.jsxs(K,{children:[i.current.length>0?c.jsx(Ur,{multipleState:d,changeMultipleState:I=>{f(I),!I&&p([])},selectedKeys:h,isSelectedAll:h.length===i.current.length,batchOperationCallback:D}):c.jsx(z,{}),!d&&c.jsx(ne,{hasArrow:!0,label:"New folder",placement:"bottom-start",children:c.jsx(Z,{size:"sm",variant:"outline",icon:c.jsx(Dn,{size:21}),onClick:async()=>{var I;await((I=pe)==null?void 0:I.create({name:"New Folder"})),V()},"aria-label":"new folder button"})})]}),c.jsxs(ke,{closeOnSelect:!0,children:[c.jsx(Te,{as:ee,variant:"ghost",size:"xs",pr:0,rightIcon:c.jsx(Mt,{size:"16"}),children:c.jsxs(K,{children:[c.jsx(J,{children:"Sort by:"}),c.jsx(J,{display:"inline-block",children:C.current})]})}),c.jsx(Re,{children:c.jsx(Pn,{value:C.current,type:"radio",onChange:I=>A(I),children:[De.RECENTLY_MODIFIED,De.OLDEST_MODIFIED,De.AZ,De.ZA].map((I,R)=>c.jsx(jt,{value:I,children:I},R))})})]})]}),c.jsx(pr,{searchValue:g,onUpdateSearchValue:L}),c.jsx(we,{overflowY:"auto",overflowX:"hidden",direction:"column",children:c.jsx(da,{items:a})})]})]})})})}export{ql as default};
diff --git a/dist/workspace_web/ShareDialog-RSv54KWI.js b/dist/workspace_web/ShareDialog-RSv54KWI.js
deleted file mode 100644
index 6204924..0000000
--- a/dist/workspace_web/ShareDialog-RSv54KWI.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as a,m as he,x as ae,b as fe,f as re,j as e,g as Q,h as pe,n as y,s as M,q as Y,l as ge,o as me,H as ve,ae as we,i as A,M as be,N as ke,O as xe,Q as ye,S as Ce}from"./input.js";import{aK as je,h as Se,B as Ie,K as De,ae as Pe,H as J,l as X,ac as Re,ab as ie,j as _e,p as ne,k as le,aL as Fe,o as Me,F as Ee,aM as Ne,C as q,aN as U,aO as Le,aP as We,aQ as Te,T as Oe,aR as Ve}from"./App-49F9REmv.js";import{app as He}from"/scripts/app.js";import{t as Ke}from"./index-pz0vT7Or.js";import{L as Be}from"./chunk-K7XRJ7NL-Vyo84f0U.js";import{I as qe}from"./IconCopy-BoJadUqc.js";import"/scripts/api.js";function Ae(t){return t&&ae(t)&&ae(t.target)}function $e(t={}){const{onChange:p,value:c,defaultValue:s,name:d,isDisabled:h,isFocusable:u,isNative:g,...f}=t,[w,C]=a.useState(s||""),b=typeof c<"u",j=b?c:w,k=a.useRef(null),S=a.useCallback(()=>{const n=k.current;if(!n)return;let i="input:not(:disabled):checked";const I=n.querySelector(i);if(I){I.focus();return}i="input:not(:disabled)";const o=n.querySelector(i);o==null||o.focus()},[]),m=`radio-${a.useId()}`,N=d||m,R=a.useCallback(n=>{const i=Ae(n)?n.target.value:n;b||C(i),p==null||p(String(i))},[p,b]),H=a.useCallback((n={},i=null)=>({...n,ref:he(i,k),role:"radiogroup"}),[]),_=a.useCallback((n={},i=null)=>({...n,ref:i,name:N,[g?"checked":"isChecked"]:j!=null?n.value===j:void 0,onChange(o){R(o)},"data-radiogroup":!0}),[g,N,R,j]);return{getRootProps:H,getRadioProps:_,name:N,ref:k,focus:S,setValue:C,value:j,onChange:R,isDisabled:h,isFocusable:u,htmlProps:f}}var[Ge,ce]=fe({name:"RadioGroupContext",strict:!1}),de=re((t,p)=>{const{colorScheme:c,size:s,variant:d,children:h,className:u,isDisabled:g,isFocusable:f,...w}=t,{value:C,onChange:b,getRootProps:j,name:k,htmlProps:S}=$e(w),E=a.useMemo(()=>({name:k,size:s,onChange:b,colorScheme:c,value:C,variant:d,isDisabled:g,isFocusable:f}),[k,s,b,c,C,d,g,f]);return e.jsx(Ge,{value:E,children:e.jsx(Q.div,{...j(S,p),className:pe("chakra-radio-group",u),children:h})})});de.displayName="RadioGroup";var ze={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function Ue(t={}){const{defaultChecked:p,isChecked:c,isFocusable:s,isDisabled:d,isReadOnly:h,isRequired:u,onChange:g,isInvalid:f,name:w,value:C,id:b,"data-radiogroup":j,"aria-describedby":k,...S}=t,E=`radio-${a.useId()}`,m=je(),R=!!ce()||!!j;let _=!!m&&!R?m.id:E;_=b??_;const n=d??(m==null?void 0:m.isDisabled),i=h??(m==null?void 0:m.isReadOnly),I=u??(m==null?void 0:m.isRequired),o=f??(m==null?void 0:m.isInvalid),[l,P]=a.useState(!1),[v,D]=a.useState(!1),[x,L]=a.useState(!1),[W,T]=a.useState(!1),[$,G]=a.useState(!!p),K=typeof c<"u",F=K?c:$;a.useEffect(()=>Ke(P),[]);const O=a.useCallback(r=>{if(i||n){r.preventDefault();return}K||G(r.target.checked),g==null||g(r)},[K,n,i,g]),B=a.useCallback(r=>{r.key===" "&&T(!0)},[T]),z=a.useCallback(r=>{r.key===" "&&T(!1)},[T]),ee=a.useCallback((r={},V=null)=>({...r,ref:V,"data-active":y(W),"data-hover":y(x),"data-disabled":y(n),"data-invalid":y(o),"data-checked":y(F),"data-focus":y(v),"data-focus-visible":y(v&&l),"data-readonly":y(i),"aria-hidden":!0,onMouseDown:M(r.onMouseDown,()=>T(!0)),onMouseUp:M(r.onMouseUp,()=>T(!1)),onMouseEnter:M(r.onMouseEnter,()=>L(!0)),onMouseLeave:M(r.onMouseLeave,()=>L(!1))}),[W,x,n,o,F,v,i,l]),{onFocus:oe,onBlur:se}=m??{},ue=a.useCallback((r={},V=null)=>{const te=n&&!s;return{...r,id:_,ref:V,type:"radio",name:w,value:C,onChange:M(r.onChange,O),onBlur:M(se,r.onBlur,()=>D(!1)),onFocus:M(oe,r.onFocus,()=>D(!0)),onKeyDown:M(r.onKeyDown,B),onKeyUp:M(r.onKeyUp,z),checked:F,disabled:te,readOnly:i,required:I,"aria-invalid":Y(o),"aria-disabled":Y(te),"aria-required":Y(I),"data-readonly":y(i),"aria-describedby":k,style:ze}},[n,s,_,w,C,O,se,oe,B,z,F,i,I,o,k]);return{state:{isInvalid:o,isFocused:v,isChecked:F,isActive:W,isHovered:x,isDisabled:n,isReadOnly:i,isRequired:I},getCheckboxProps:ee,getRadioProps:ee,getInputProps:ue,getLabelProps:(r={},V=null)=>({...r,ref:V,onMouseDown:M(r.onMouseDown,Qe),"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(o)}),getRootProps:(r,V=null)=>({...r,ref:V,"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(o)}),htmlProps:S}}function Qe(t){t.preventDefault(),t.stopPropagation()}function Je(t,p){const c={},s={};for(const[d,h]of Object.entries(t))p.includes(d)?c[d]=h:s[d]=h;return[c,s]}var Z=re((t,p)=>{var c;const s=ce(),{onChange:d,value:h}=t,u=ge("Radio",{...s,...t}),g=me(t),{spacing:f="0.5rem",children:w,isDisabled:C=s==null?void 0:s.isDisabled,isFocusable:b=s==null?void 0:s.isFocusable,inputProps:j,...k}=g;let S=t.isChecked;(s==null?void 0:s.value)!=null&&h!=null&&(S=s.value===h);let E=d;s!=null&&s.onChange&&h!=null&&(E=ve(s.onChange,d));const m=(c=t==null?void 0:t.name)!=null?c:s==null?void 0:s.name,{getInputProps:N,getCheckboxProps:R,getLabelProps:H,getRootProps:_,htmlProps:n}=Ue({...k,isChecked:S,isFocusable:b,isDisabled:C,onChange:E,name:m}),[i,I]=Je(n,we),o=R(I),l=N(j,p),P=H(),v=Object.assign({},i,_()),D={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...u.container},x={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...u.control},L={userSelect:"none",marginStart:f,...u.label};return e.jsxs(Q.label,{className:"chakra-radio",...v,__css:D,children:[e.jsx("input",{className:"chakra-radio__input",...l}),e.jsx(Q.span,{className:"chakra-radio__control",...o,__css:x}),w&&e.jsx(Q.span,{className:"chakra-radio__label",...P,__css:L,children:w})]})});Z.displayName="Radio";var Ye=Se("cloud","IconCloud",[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]]);function Xe({options:t,value:p,onChange:c}){const[s,d]=a.useState(!1),h=a.useRef(null),u=t.find(f=>f.value===p);a.useEffect(()=>{const f=w=>{h.current&&!h.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[h]);const g=()=>d(!s);return e.jsxs(Ie,{position:"relative",children:[e.jsx(A,{onClick:g,rightIcon:e.jsx(De,{}),leftIcon:u==null?void 0:u.icon,children:u==null?void 0:u.label}),s&&e.jsx(Pe,{gap:4,ref:h,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:t.map(f=>e.jsx(A,{onClick:()=>{d(!1),c(f.value)},leftIcon:f.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:f.label},f.label))})]})}function Ze({version:t,cloudHost:p,cloudWorkflowID:c}){const s=t,d=e.jsxs(J,{spacing:4,alignItems:"center",children:[e.jsx(X,{children:s.name}),e.jsx(X,{color:"GrayText",children:Re(s.createTime,!1)}),s.cloudID&&c&&e.jsx("a",{href:p+"/workflow/"+c+"/"+s.cloudID,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsx(A,{size:"xs",colorScheme:"teal",variant:"outline",leftIcon:e.jsx(Ye,{}),rightIcon:e.jsx(ie,{size:18}),children:"Shared"})})]});return t.cloudID?e.jsx(e.Fragment,{children:d}):e.jsx(Z,{value:s.id,mb:5,children:d},s.id)}function ho({onClose:t}){var i,I;const[p,c]=a.useState("v"+eo()),[s,d]=a.useState([]),[h,u]=a.useState(!1),[g,f]=a.useState(""),[w,C]=a.useState("PRIVATE"),[b,j]=a.useState("new_version"),k=a.useRef(""),[S,E]=a.useState(),m=_e(),N=async o=>{var L,W;const l=o.data;if(o.origin!==k.current||l.type!=="share_workflow_success")return;const P=l.localWorkflowID,v=l.localVersionID,D=l.version.id,x=l.version.workflowID;x&&P&&await((L=q)==null?void 0:L.updateMetaInfo(P,{cloudID:x,cloudOrigin:o.origin,privacy:w})),v&&D&&await((W=U)==null?void 0:W.update(v,{cloudID:D,cloudOrigin:o.origin})),R(),window.open(k.current+"/workflow/"+x+"/"+D,"_blank"),u(!1)};a.useEffect(()=>(R(),window.addEventListener("message",N),()=>{window.removeEventListener("message",N)}),[]);const R=async()=>{var P,v,D;const o=await((P=ne)==null?void 0:P.getSetting("cloudHost"));o&&(f(o),k.current=o);const l=((v=q)==null?void 0:v.curWorkflow)??void 0;E(l),l!=null&&l.cloudID&&l.cloudOrigin&&Te(l).then(x=>{C(x)}),(D=U)==null||D.listByWorkflowID(l.id).then(x=>{d(x)})},H=o=>{navigator.clipboard.writeText(o).then(()=>{m({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(l=>{console.error("Failed to copy text: ",l)})},_=async()=>{var G,K,F;u(!0);const o=Le(32),l=await((G=ne)==null?void 0:G.getSetting("cloudHost"));let P,v;try{if(P=We(),b==="new_version"?v=await((K=U)==null?void 0:K.add({workflowID:S.id,name:p,createTime:Date.now(),json:JSON.stringify(He.graph.serialize())})):v=await((F=U)==null?void 0:F.get(b)),!v){alert(`Failed to find version: ${b}, please try again.`),u(!1);return}}catch(O){console.error(O),u(!1),alert("Failed to share workflow, please try again.");return}const D=window.location.protocol,x=window.location.host,L=`${D}//${x}`,W=l+`/share_workflow_confirm/${o}?redirectUrl=${L}`,T=window.open(W,"Share Workflow","width=800,height=800"),$=O=>{var B;if(O.origin===l&&O.data==="child_ready"){const z=(B=q)==null?void 0:B.curWorkflow;T.postMessage({workflow:z,version:v,nodeDefs:P,privacy:w},l),window.removeEventListener("message",$)}};window.addEventListener("message",$)},n=(I=(i=q)==null?void 0:i.curWorkflow)==null?void 0:I.cloudID;return e.jsxs(be,{isOpen:!0,onClose:t,size:"lg",children:[e.jsx(ke,{}),e.jsxs(xe,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(ye,{children:['Share "',S==null?void 0:S.name,'"']}),e.jsxs(Ce,{pb:10,children:[e.jsxs(le,{gap:5,children:[n==null?e.jsx(Xe,{options:Fe,value:w,onChange:o=>{C(o)}}):e.jsx(Oe,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(Ve,{privacy:w,showEmoji:!0})}),n&&e.jsxs(J,{spacing:2,color:"teal.400",children:[e.jsxs(Be,{href:g+"/workflow/"+n,isExternal:!0,children:[g+"/workflow/"+n," ",e.jsx(ie,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx(A,{width:"180px",size:"sm",leftIcon:e.jsx(qe,{}),onClick:()=>{var o,l;H(g+"/workflow/"+((l=(o=q)==null?void 0:o.curWorkflow)==null?void 0:l.cloudID))},children:"Copy link"})]}),e.jsx(X,{children:"Choose a version to share:"}),e.jsx(de,{gap:4,onChange:o=>{j(o)},value:b,children:e.jsxs(le,{children:[e.jsxs(J,{mb:5,alignItems:"center",children:[e.jsx(Z,{value:"new_version"},"new_version"),e.jsx(Me,{value:p,width:"60%",onFocus:()=>{j("new_version")},onChange:o=>{c(o.target.value)}}),e.jsx(Ee,{color:"green",children:e.jsx(Ne,{colorScheme:"purple",children:"New version"})})]}),s.slice(0,4).map(o=>e.jsx(Ze,{version:o,cloudHost:g,cloudWorkflowID:n??null},o.id))]})})]}),e.jsx(J,{justifyContent:"flex-end",mt:16,children:e.jsx(A,{colorScheme:"teal",onClick:_,isDisabled:h,children:h?"Sharing":"Share"})})]})]})]})}function eo(){const t=new Date,p=t.getFullYear(),c=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${p}-${c}-${s}`}export{ho as default};
diff --git a/dist/workspace_web/SpotlightSearch-mJn8Tnrv.js b/dist/workspace_web/SpotlightSearch-mJn8Tnrv.js
deleted file mode 100644
index c2d2da5..0000000
--- a/dist/workspace_web/SpotlightSearch-mJn8Tnrv.js
+++ /dev/null
@@ -1 +0,0 @@
-import{b as $,f as j,l as q,o as Q,h as K,r as m,j as n,g as M,a0 as X,M as Z,O as ee,U as te,i as ne}from"./input.js";import{aI as se,au as re,a7 as ae,aE as T,ar as D,H as oe,o as ie,l as O,ac as ce,C as le,ad as ue,aJ as N,E as pe,p as A}from"./App-49F9REmv.js";import{u as de}from"./useDebounceFn-ld478fd0.js";import{I as he}from"./IconSearch-TfsRN_aS.js";import{V as me}from"./chunk-NTCQBYKE-ZN6CsuPY.js";import"/scripts/app.js";import"/scripts/api.js";var[ge,Se]=$({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),P=j(function(a,u){const r=q("Input",a),{children:c,className:l,...I}=Q(a),y=K("chakra-input__group",l),t={},x=se(c),o=r.field;x.forEach(s=>{var p,f;r&&(o&&s.type.id==="InputLeftElement"&&(t.paddingStart=(p=o.height)!=null?p:o.h),o&&s.type.id==="InputRightElement"&&(t.paddingEnd=(f=o.height)!=null?f:o.h),s.type.id==="InputRightAddon"&&(t.borderEndRadius=0),s.type.id==="InputLeftAddon"&&(t.borderStartRadius=0))});const S=x.map(s=>{var p,f;const b=re({size:((p=s.props)==null?void 0:p.size)||a.size,variant:((f=s.props)==null?void 0:f.variant)||a.variant});return s.type.id!=="Input"?m.cloneElement(s,b):m.cloneElement(s,Object.assign(b,t,s.props))});return n.jsx(M.div,{className:y,ref:u,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...I,children:n.jsx(ge,{value:r,children:S})})});P.displayName="InputGroup";var fe=M("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),C=j(function(a,u){var r,c;const{placement:l="left",...I}=a,y=Se(),t=y.field,o={[l==="left"?"insetStart":"insetEnd"]:"0",width:(r=t==null?void 0:t.height)!=null?r:t==null?void 0:t.h,height:(c=t==null?void 0:t.height)!=null?c:t==null?void 0:t.h,fontSize:t==null?void 0:t.fontSize,...y.element};return n.jsx(fe,{ref:u,__css:o,...I})});C.id="InputElement";C.displayName="InputElement";var U=j(function(a,u){const{className:r,...c}=a,l=K("chakra-input__left-element",r);return n.jsx(C,{ref:u,placement:"left",className:l,...c})});U.id="InputLeftElement";U.displayName="InputLeftElement";var z=j(function(a,u){const{className:r,...c}=a,l=K("chakra-input__right-element",r);return n.jsx(C,{ref:u,placement:"right",className:l,...c})});z.id="InputRightElement";z.displayName="InputRightElement";function Le(){const{colorMode:g}=X(),{loadWorkflowID:a,setRoute:u}=m.useContext(ae),[r,c]=m.useState([]),[l,I,y]=T(""),t=m.useRef([]),[x,o,S]=T([]),[s,p]=m.useState(!1),[f,b,L]=T(0),E=m.useRef({lastPressedKey:"",spotlightSearchShortcutFirstKey:"",spotlightSearchShortcutLastKey:""}),F=()=>{u("root")},_=e=>{a(e.id),F()},H=()=>{const e=r.filter(i=>!!i.name.toLocaleLowerCase().includes(y.current.toLocaleLowerCase()));o(e),b(0),p(!1)},[V,B]=de(H,300),W=e=>{I(e.target.value),e.target.value?(V(),!s&&p(!0)):(p(!1),B(),o(t.current))},Y=()=>s?null:l&&x.length===0?n.jsx(O,{ml:2,children:"No matching results"}):n.jsx(n.Fragment,{children:x.map((e,i)=>n.jsxs(ne,{colorScheme:"teal",variant:"ghost",size:"sm",justifyContent:"start",px:2,color:g==="light"?"#1A202C":"rgba(255, 255, 255, 0.92)",onClick:()=>{_(e)},minH:"26px",isActive:i===f,children:[e.name,e.updateTime&&n.jsxs(O,{color:g==="light"?"GrayText":"rgb(255, 255, 255, 0.6)",ml:2,fontSize:"sm",children:["Updated: ",ce(e.updateTime)]})]},e.id))}),J=async()=>{var k;const e=h=>h.map(v=>({type:"workflow",updateTime:(v==null?void 0:v.updateTime)??Date.now(),id:v.id,name:v.name.replace(/\.json$/,"")}))??[],i=await((k=le)==null?void 0:k.listAll(ue.RECENTLY_OPENED))??[];c(e(i));const d=e(i.slice(0,20));t.current=d,o(d)},w=e=>{b(i=>{const d=i+e;return d<0?S.current.length-1:d>S.current.length-1?0:d})};return m.useEffect(()=>{var k;J(),(k=A)==null||k.getSetting("shortcuts").then(h=>{var G;const R=(h.openSpotlightSearch??((G=A)==null?void 0:G.defaultSettings.shortcuts.openSpotlightSearch)).split("+");E.current.spotlightSearchShortcutFirstKey=R[0]==="Command"?"Meta":R[0],E.current.spotlightSearchShortcutLastKey=R[R.length-1]});const e=h=>{h.key===E.current.spotlightSearchShortcutFirstKey&&E.current.lastPressedKey===E.current.spotlightSearchShortcutLastKey&&L.current>0&&S.current[L.current]&&_(S.current[L.current])},i=h=>{E.current.lastPressedKey=h.key.toUpperCase()},d=h=>{switch(h.detail.shortcutType){case pe.openSpotlightSearch:w(1);break;case N.ArrowDown:w(1);break;case N.ArrowUp:w(-1);break;case N.Enter:_(S.current[L.current]);break}};return document.addEventListener("keyup",e),document.addEventListener("keydown",i),window.addEventListener(D,d),()=>{document.removeEventListener("keyup",e),document.removeEventListener("keydown",i),window.removeEventListener(D,d)}},[]),n.jsx(Z,{isOpen:!0,onClose:F,size:"xl",children:n.jsxs(ee,{bg:g==="light"?"rgba(255, 255, 255, 0.8)":"rgb(45, 55, 72, 0.8)",backdropFilter:"auto",backdropBlur:"8px",children:[n.jsxs(oe,{spacing:1,px:4,py:2,borderBottom:"1px",borderColor:"gray.400",children:[n.jsx(he,{size:20}),n.jsxs(P,{children:[n.jsx(ie,{value:l,onChange:W,autoFocus:!0,variant:"unstyled",fontSize:18}),s&&n.jsx(z,{h:"27px",children:n.jsx(te,{size:"sm"})})]})]}),n.jsx(me,{spacing:1,align:"stretch",px:2,py:2,maxHeight:"calc(100vh - 200px)",overflowY:"auto",children:Y()})]})})}export{Le as default};
diff --git a/dist/workspace_web/chunk-3RSXBRAN-crwOgWRE.js b/dist/workspace_web/chunk-3RSXBRAN-crwOgWRE.js
deleted file mode 100644
index 6c39c3c..0000000
--- a/dist/workspace_web/chunk-3RSXBRAN-crwOgWRE.js
+++ /dev/null
@@ -1 +0,0 @@
-import{f as x,j as l,g as i,h as b,l as C,o as E,n as I,r as f,ae as P}from"./input.js";import{a0 as z}from"./App-49F9REmv.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S};
diff --git a/dist/workspace_web/chunk-JARCRF6W-QWMsZMLI.js b/dist/workspace_web/chunk-JARCRF6W-QWMsZMLI.js
deleted file mode 100644
index 748042f..0000000
--- a/dist/workspace_web/chunk-JARCRF6W-QWMsZMLI.js
+++ /dev/null
@@ -1 +0,0 @@
-import{b as de,r as o,j as u,g as I,d as $,e as z,y as ue,n,s as m,m as te,a6 as W,f as ae,l as fe,o as me,H as he,h as ke}from"./input.js";import{ap as be}from"./App-49F9REmv.js";import{t as pe}from"./index-pz0vT7Or.js";var[Ne,ve]=de({name:"CheckboxGroupContext",strict:!1});function Ce(s){const[l,t]=o.useState(s),[a,f]=o.useState(!1);return s!==l&&(f(!0),t(s)),a}function ye(s){return u.jsx(I.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...s,children:u.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function ge(s){return u.jsx(I.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...s,children:u.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function xe(s){const{isIndeterminate:l,isChecked:t,...a}=s,f=l?ge:ye;return t||l?u.jsx(I.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:u.jsx(f,{...a})}):null}var Ie={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function we(s,l=[]){const t=Object.assign({},s);for(const a of l)a in t&&delete t[a];return t}function Se(s={}){const l=be(s),{isDisabled:t,isReadOnly:a,isRequired:f,isInvalid:r,id:b,onBlur:P,onFocus:A,"aria-describedby":C}=l,{defaultChecked:y,isChecked:g,isFocusable:D,onChange:R,isIndeterminate:c,name:x,value:M,tabIndex:N=void 0,"aria-label":_,"aria-labelledby":j,"aria-invalid":p,...q}=s,F=we(q,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),E=$(R),K=$(P),L=$(A),[w,T]=o.useState(!1),[v,U]=o.useState(!1),[B,X]=o.useState(!1),[G,S]=o.useState(!1);o.useEffect(()=>pe(T),[]);const h=o.useRef(null),[J,ne]=o.useState(!0),[oe,H]=o.useState(!!y),V=g!==void 0,i=V?g:oe,Q=o.useCallback(e=>{if(a||t){e.preventDefault();return}V||H(i?e.target.checked:c?!0:e.target.checked),E==null||E(e)},[a,t,i,V,c,E]);z(()=>{h.current&&(h.current.indeterminate=!!c)},[c]),ue(()=>{t&&U(!1)},[t,U]),z(()=>{const e=h.current;if(!(e!=null&&e.form))return;const d=()=>{H(!!y)};return e.form.addEventListener("reset",d),()=>{var k;return(k=e.form)==null?void 0:k.removeEventListener("reset",d)}},[]);const Y=t&&!D,Z=o.useCallback(e=>{e.key===" "&&S(!0)},[S]),ee=o.useCallback(e=>{e.key===" "&&S(!1)},[S]);z(()=>{if(!h.current)return;h.current.checked!==i&&H(h.current.checked)},[h.current]);const se=o.useCallback((e={},d=null)=>{const k=O=>{v&&O.preventDefault(),S(!0)};return{...e,ref:d,"data-active":n(G),"data-hover":n(B),"data-checked":n(i),"data-focus":n(v),"data-focus-visible":n(v&&w),"data-indeterminate":n(c),"data-disabled":n(t),"data-invalid":n(r),"data-readonly":n(a),"aria-hidden":!0,onMouseDown:m(e.onMouseDown,k),onMouseUp:m(e.onMouseUp,()=>S(!1)),onMouseEnter:m(e.onMouseEnter,()=>X(!0)),onMouseLeave:m(e.onMouseLeave,()=>X(!1))}},[G,i,t,v,w,B,c,r,a]),re=o.useCallback((e={},d=null)=>({...e,ref:d,"data-active":n(G),"data-hover":n(B),"data-checked":n(i),"data-focus":n(v),"data-focus-visible":n(v&&w),"data-indeterminate":n(c),"data-disabled":n(t),"data-invalid":n(r),"data-readonly":n(a)}),[G,i,t,v,w,B,c,r,a]),ie=o.useCallback((e={},d=null)=>({...F,...e,ref:te(d,k=>{k&&ne(k.tagName==="LABEL")}),onClick:m(e.onClick,()=>{var k;J||((k=h.current)==null||k.click(),requestAnimationFrame(()=>{var O;(O=h.current)==null||O.focus({preventScroll:!0})}))}),"data-disabled":n(t),"data-checked":n(i),"data-invalid":n(r)}),[F,t,i,r,J]),le=o.useCallback((e={},d=null)=>({...e,ref:te(h,d),type:"checkbox",name:x,value:M,id:b,tabIndex:N,onChange:m(e.onChange,Q),onBlur:m(e.onBlur,K,()=>U(!1)),onFocus:m(e.onFocus,L,()=>U(!0)),onKeyDown:m(e.onKeyDown,Z),onKeyUp:m(e.onKeyUp,ee),required:f,checked:i,disabled:Y,readOnly:a,"aria-label":_,"aria-labelledby":j,"aria-invalid":p?!!p:r,"aria-describedby":C,"aria-disabled":t,style:Ie}),[x,M,b,Q,K,L,Z,ee,f,i,Y,a,_,j,p,r,C,t,N]),ce=o.useCallback((e={},d=null)=>({...e,ref:d,onMouseDown:m(e.onMouseDown,Pe),"data-disabled":n(t),"data-checked":n(i),"data-invalid":n(r)}),[i,t,r]);return{state:{isInvalid:r,isFocused:v,isChecked:i,isActive:G,isHovered:B,isIndeterminate:c,isDisabled:t,isReadOnly:a,isRequired:f},getRootProps:ie,getCheckboxProps:se,getIndicatorProps:re,getInputProps:le,getLabelProps:ce,htmlProps:F}}function Pe(s){s.preventDefault(),s.stopPropagation()}var Ae={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},De={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Re=W({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),_e=W({from:{opacity:0},to:{opacity:1}}),je=W({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Fe=ae(function(l,t){const a=ve(),f={...a,...l},r=fe("Checkbox",f),b=me(l),{spacing:P="0.5rem",className:A,children:C,iconColor:y,iconSize:g,icon:D=u.jsx(xe,{}),isChecked:R,isDisabled:c=a==null?void 0:a.isDisabled,onChange:x,inputProps:M,...N}=b;let _=R;a!=null&&a.value&&b.value&&(_=a.value.includes(b.value));let j=x;a!=null&&a.onChange&&b.value&&(j=he(a.onChange,x));const{state:p,getInputProps:q,getCheckboxProps:F,getLabelProps:E,getRootProps:K}=Se({...N,isDisabled:c,isChecked:_,onChange:j}),L=Ce(p.isChecked),w=o.useMemo(()=>({animation:L?p.isIndeterminate?`${_e} 20ms linear, ${je} 200ms linear`:`${Re} 200ms linear`:void 0,fontSize:g,color:y,...r.icon}),[y,g,L,p.isIndeterminate,r.icon]),T=o.cloneElement(D,{__css:w,isIndeterminate:p.isIndeterminate,isChecked:p.isChecked});return u.jsxs(I.label,{__css:{...De,...r.container},className:ke("chakra-checkbox",A),...K(),children:[u.jsx("input",{className:"chakra-checkbox__input",...q(M,t)}),u.jsx(I.span,{__css:{...Ae,...r.control},className:"chakra-checkbox__control",...F(),children:T}),C&&u.jsx(I.span,{className:"chakra-checkbox__label",...E(),__css:{marginStart:P,...r.label},children:C})]})});Fe.displayName="Checkbox";var Ee=ae(function(l,t){const{templateAreas:a,gap:f,rowGap:r,columnGap:b,column:P,row:A,autoFlow:C,autoRows:y,templateRows:g,autoColumns:D,templateColumns:R,...c}=l,x={display:"grid",gridTemplateAreas:a,gridGap:f,gridRowGap:r,gridColumnGap:b,gridAutoColumns:D,gridColumn:P,gridRow:A,gridAutoFlow:C,gridAutoRows:y,gridTemplateRows:g,gridTemplateColumns:R};return u.jsx(I.div,{ref:t,__css:x,...c})});Ee.displayName="Grid";export{Fe as C,Ee as G,Se as u};
diff --git a/dist/workspace_web/chunk-NTCQBYKE-ZN6CsuPY.js b/dist/workspace_web/chunk-NTCQBYKE-ZN6CsuPY.js
deleted file mode 100644
index c9881c6..0000000
--- a/dist/workspace_web/chunk-NTCQBYKE-ZN6CsuPY.js
+++ /dev/null
@@ -1 +0,0 @@
-import{k as t}from"./App-49F9REmv.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V};
diff --git a/dist/workspace_web/input.js b/dist/workspace_web/input.js
index aaf00b3..a6e4293 100644
--- a/dist/workspace_web/input.js
+++ b/dist/workspace_web/input.js
@@ -679,10 +679,10 @@ Error generating stack: `+i.message+`
}
${fB}
- `}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App-49F9REmv.js").then(e=>e.aU),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HD,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{$B as $,IB as A,zB as B,DB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Dp as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,zp as U,Pb as V,LB as W,is as X,Ar as Y,wB as Z,Jk as _,MB as a,Iu as a0,vL as a1,rL as a2,mL as a3,Wf as a4,Ra as a5,wP as a6,SB as a7,Hn as a8,Uh as a9,xP as aa,xB as ab,lB as ac,uB as ad,_B as ae,mn as b,RB as c,d3 as d,ka as e,pt as f,_e as g,Be as h,Dx as i,E as j,EB as k,eS as l,Bf as m,Rv as n,Ou as o,Nu as p,kB as q,S as r,$i as s,Xf as t,VP as u,hw as v,TB as w,Kt as x,Cg as y,mO as z};
+ `}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App-olu4rPJF.js").then(e=>e.aU),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HD,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{$B as $,IB as A,zB as B,DB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Dp as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,zp as U,Pb as V,LB as W,is as X,Ar as Y,wB as Z,Jk as _,MB as a,Iu as a0,vL as a1,rL as a2,mL as a3,Wf as a4,Ra as a5,wP as a6,SB as a7,Hn as a8,Uh as a9,xP as aa,xB as ab,lB as ac,uB as ad,_B as ae,mn as b,RB as c,d3 as d,ka as e,pt as f,_e as g,Be as h,Dx as i,E as j,EB as k,eS as l,Bf as m,Rv as n,Ou as o,Nu as p,kB as q,S as r,$i as s,Xf as t,VP as u,hw as v,TB as w,Kt as x,Cg as y,mO as z};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
- __vite__mapDeps.viteFileDeps = ["workspace_web/App-49F9REmv.js","workspace_web/assets/App-JXePnJiV.css"]
+ __vite__mapDeps.viteFileDeps = ["workspace_web/App-olu4rPJF.js","workspace_web/assets/App-JXePnJiV.css"]
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
\ No newline at end of file
diff --git a/ui/src/RecentFilesDrawer/WorkflowListItem.tsx b/ui/src/RecentFilesDrawer/WorkflowListItem.tsx
index 19ae610..a158664 100644
--- a/ui/src/RecentFilesDrawer/WorkflowListItem.tsx
+++ b/ui/src/RecentFilesDrawer/WorkflowListItem.tsx
@@ -9,7 +9,7 @@ import {
} from "@chakra-ui/react";
import { IconLock } from "@tabler/icons-react";
import { formatTimestamp } from "../utils";
-import { memo, ChangeEvent, useContext } from "react";
+import { memo, ChangeEvent, useContext, useState } from "react";
import { RecentFilesContext, WorkspaceContext } from "../WorkspaceContext";
import { Workflow } from "../types/dbTypes";
import MediaPreview from "../components/MediaPreview";
@@ -33,7 +33,7 @@ export default memo(function WorkflowListItem({ workflow }: Props) {
const { curFlowID, loadWorkflowID } = useContext(WorkspaceContext);
const isSelected = curFlowID === workflow.id;
const hoverBgColor = colorMode === "light" ? "gray.200" : "#4A5568";
-
+ const [isHovering, setIsHovering] = useState(false);
const basicInfoComp = (
+ setIsHovering(true)}
+ onMouseLeave={() => setIsHovering(false)}
+ >
{isMultiSelecting ? (
{basicInfoComp}
-
+ {isHovering && }
>
)}