Files
Stackq/.svelte-kit/output/client/_app/immutable/chunks/iABcLwh6.js
T

134 lines
122 KiB
JavaScript

var ha=Object.defineProperty;var fa=Object.getPrototypeOf;var pa=Reflect.get;var Ci=r=>{throw TypeError(r)};var ga=(r,e,t)=>e in r?ha(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e,t)=>ga(r,typeof e!="symbol"?e+"":e,t),Gr=(r,e,t)=>e.has(r)||Ci("Cannot "+t);var a=(r,e,t)=>(Gr(r,e,"read from private field"),t?t.call(r):e.get(r)),h=(r,e,t)=>e.has(r)?Ci("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),E=(r,e,t,n)=>(Gr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),N=(r,e,t)=>(Gr(r,e,"access private method"),t);var Ti=(r,e,t)=>pa(fa(r),t,e);import"./Bzak7iHL.js";import{i as mt,j as Zi,k as ba,l as $i,g as u,aa as va,H as ma,n as Oi,s as _i,o as Hr,J as Gn,$ as ya,aU as wa,p as xi,a3 as Sa,a7 as $r,bi as Ca,a9 as Ta,d as Oa,b2 as _a,aT as xs,bj as xa,x as es,bk as Ea,bl as Aa,y as Ia,Q as Ei,bm as Je,a4 as eo,a6 as to,bn as Jr,bo as Pa,aR as ka,a5 as Ra,a0 as Na,I as U,ai as no,F as T,bp as Ai,aB as Mt,a_ as Fa,aZ as Ii,a$ as Ma,au as La,av as Ne,ad as Da,aX as Ua,u as A,bh as jn,A as G,c as q,f as L,a as O,G as H,h as I,T as $,r as P,b as J,aY as ja,bq as ro,C as F,br as qa,bs as Ba,D as te,E as pe,az as me}from"./Dexp9pM5.js";import{c as Ye}from"./25AjRaeI.js";import{p as _,r as ae,s as he,b as so}from"./jOLfEXYH.js";import{s as V,a as Qe,c as qn,r as Yr,d as Pi,f as ki,e as Ka,g as Hn}from"./BKSreT2u.js";import{i as Wa,B as za,b as Va,g as x,j as Ga,t as Ha,k as Ja,l as Ya,n as Er,c as $e,o as Es,p as kt,q as io,h as Bn,m as Te,r as yt,u as oo,s as Xa,v as Qa,L as ye,I as vt,a as Za,e as $a}from"./61AlszRR.js";import{B as ec,i as se,_ as tc}from"./CRDN6Mh7.js";import{c as nc,m as rc,u as sc,s as tt}from"./DZmckTjd.js";import{o as Q}from"./agKGoZF1.js";import{B as Xr}from"./B12dZE2q.js";import{e as ic}from"./BC20z61P.js";const oc=Symbol("NaN");function ac(r,e,t){mt&&Zi();var n=new ec(r),s=!ba();$i(()=>{var i=e();i!==i&&(i=oc),s&&i!==null&&typeof i=="object"&&(i={}),n.ensure(i,t)})}function qt(r,e){return e}function cc(r,e,t){for(var n=[],s=e.length,i,o=e.length,c=0;c<s;c++){let f=e[c];to(f,()=>{if(i){if(i.pending.delete(f),i.done.add(f),i.pending.size===0){var v=r.outrogroups;ts(xs(i.done)),v.delete(i),v.size===0&&(r.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=n.length===0&&t!==null;if(l){var d=t,b=d.parentNode;ka(b),b.append(d),r.items.clear()}ts(e,!l)}else i={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(i)}function ts(r,e=!0){for(var t=0;t<r.length;t++)Ra(r[t],e)}var Ri;function Bt(r,e,t,n,s,i=null){var o=r,c=new Map;mt&&Zi();var l=null,d=Oa(()=>{var S=t();return _a(S)?S:S==null?[]:xs(S)}),b,f=!0;function v(){p.fallback=l,lc(p,b,o,e,n),l!==null&&(b.length===0?(l.f&Je)===0?eo(l):(l.f^=Je,Kt(l,null,o)):to(l,()=>{l=null}))}var m=$i(()=>{b=u(d);var S=b.length;let B=!1;if(mt){var M=va(o)===ma;M!==(S===0)&&(o=Oi(),_i(o),Hr(!1),B=!0)}for(var R=new Set,D=Sa,k=Ta(),z=0;z<S;z+=1){mt&&Gn.nodeType===ya&&Gn.data===wa&&(o=Gn,B=!0,Hr(!1));var j=b[z],W=n(j,z),K=f?null:c.get(W);K?(K.v&&xi(K.v,j),K.i&&xi(K.i,z),k&&D.unskip_effect(K.e)):(K=uc(c,f?o:Ri??(Ri=Ei()),j,W,z,s,e,t),f||(K.e.f|=Je),c.set(W,K)),R.add(W)}if(S===0&&i&&!l&&(f?l=$r(()=>i(o)):(l=$r(()=>i(Ri??(Ri=Ei()))),l.f|=Je)),S>R.size&&Ca(),mt&&S>0&&_i(Oi()),!f)if(k){for(const[ue,fe]of c)R.has(ue)||D.skip_effect(fe.e);D.oncommit(v),D.ondiscard(()=>{})}else v();B&&Hr(!0),u(d)}),p={effect:m,items:c,outrogroups:null,fallback:l};f=!1,mt&&(o=Gn)}function Lt(r){for(;r!==null&&(r.f&Pa)===0;)r=r.next;return r}function lc(r,e,t,n,s){var K;var i=e.length,o=r.items,c=Lt(r.effect.first),l,d=null,b=[],f=[],v,m,p,S;for(S=0;S<i;S+=1){if(v=e[S],m=s(v,S),p=o.get(m).e,r.outrogroups!==null)for(const ue of r.outrogroups)ue.pending.delete(p),ue.done.delete(p);if((p.f&Je)!==0)if(p.f^=Je,p===c)Kt(p,null,t);else{var B=d?d.next:c;p===r.effect.last&&(r.effect.last=p.prev),p.prev&&(p.prev.next=p.next),p.next&&(p.next.prev=p.prev),Be(r,d,p),Be(r,p,B),Kt(p,B,t),d=p,b=[],f=[],c=Lt(d.next);continue}if((p.f&Jr)!==0&&eo(p),p!==c){if(l!==void 0&&l.has(p)){if(b.length<f.length){var M=f[0],R;d=M.prev;var D=b[0],k=b[b.length-1];for(R=0;R<b.length;R+=1)Kt(b[R],M,t);for(R=0;R<f.length;R+=1)l.delete(f[R]);Be(r,D.prev,k.next),Be(r,d,D),Be(r,k,M),c=M,d=k,S-=1,b=[],f=[]}else l.delete(p),Kt(p,c,t),Be(r,p.prev,p.next),Be(r,p,d===null?r.effect.first:d.next),Be(r,d,p),d=p;continue}for(b=[],f=[];c!==null&&c!==p;)(l??(l=new Set)).add(c),f.push(c),c=Lt(c.next);if(c===null)continue}(p.f&Je)===0&&b.push(p),d=p,c=Lt(p.next)}if(r.outrogroups!==null){for(const ue of r.outrogroups)ue.pending.size===0&&(ts(xs(ue.done)),(K=r.outrogroups)==null||K.delete(ue));r.outrogroups.size===0&&(r.outrogroups=null)}if(c!==null||l!==void 0){var z=[];if(l!==void 0)for(p of l)(p.f&Jr)===0&&z.push(p);for(;c!==null;)(c.f&Jr)===0&&c!==r.fallback&&z.push(c),c=Lt(c.next);var j=z.length;if(j>0){var W=null;cc(r,z,W)}}}function uc(r,e,t,n,s,i,o,c){var l=(o&Ea)!==0?(o&Aa)===0?Ia(t,!1,!1):es(t):null,d=(o&xa)!==0?es(s):null;return{v:l,i:d,e:$r(()=>(i(e,l??t,d??s,c),()=>{r.delete(n)}))}}function Kt(r,e,t){if(r.nodes)for(var n=r.nodes.start,s=r.nodes.end,i=e&&(e.f&Je)===0?e.nodes.start:t;n!==null;){var o=Na(n);if(i.before(n),n===s)return;n=o}}function Be(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function pt(r){let e=U(no(r));return{[za]:!0,[Wa]:!0,get current(){return u(e)},set current(t){T(e,t,!0)}}}pt.from=Va;pt.with=x;pt.flatten=Ga;pt.readonly=Ha;pt.isBox=Ja;pt.isWritableBox=Ya;const dc=typeof window<"u"?window:void 0;function hc(r){let e=r.activeElement;for(;e!=null&&e.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}var we,Se,Oe,cr,ge,Wt,Qn;const Ds=class Ds extends Map{constructor(t){super();h(this,ge);h(this,we,new Map);h(this,Se,U(0));h(this,Oe,U(0));h(this,cr,Ai||-1);if(t){for(var[n,s]of t)super.set(n,s);a(this,Oe).v=super.size}}has(t){var n=a(this,we),s=n.get(t);if(s===void 0){var i=super.get(t);if(i!==void 0)s=N(this,ge,Wt).call(this,0),n.set(t,s);else return u(a(this,Se)),!1}return u(s),!0}forEach(t,n){N(this,ge,Qn).call(this),super.forEach(t,n)}get(t){var n=a(this,we),s=n.get(t);if(s===void 0){var i=super.get(t);if(i!==void 0)s=N(this,ge,Wt).call(this,0),n.set(t,s);else{u(a(this,Se));return}}return u(s),super.get(t)}set(t,n){var f;var s=a(this,we),i=s.get(t),o=super.get(t),c=super.set(t,n),l=a(this,Se);if(i===void 0)i=N(this,ge,Wt).call(this,0),s.set(t,i),T(a(this,Oe),super.size),Mt(l);else if(o!==n){Mt(i);var d=l.reactions===null?null:new Set(l.reactions),b=d===null||!((f=i.reactions)!=null&&f.every(v=>d.has(v)));b&&Mt(l)}return c}delete(t){var n=a(this,we),s=n.get(t),i=super.delete(t);return s!==void 0&&(n.delete(t),T(a(this,Oe),super.size),T(s,-1),Mt(a(this,Se))),i}clear(){if(super.size!==0){super.clear();var t=a(this,we);T(a(this,Oe),0);for(var n of t.values())T(n,-1);Mt(a(this,Se)),t.clear()}}keys(){return u(a(this,Se)),super.keys()}values(){return N(this,ge,Qn).call(this),super.values()}entries(){return N(this,ge,Qn).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return u(a(this,Oe)),super.size}};we=new WeakMap,Se=new WeakMap,Oe=new WeakMap,cr=new WeakMap,ge=new WeakSet,Wt=function(t){return Ai===a(this,cr)?U(t):es(t)},Qn=function(){u(a(this,Se));var t=a(this,we);if(a(this,Oe).v!==t.size){for(var n of Ti(Ds.prototype,this,"keys").call(this))if(!t.has(n)){var s=N(this,ge,Wt).call(this,0);t.set(n,s)}}for([,s]of a(this,we))u(s)};let ns=Ds;var St,Gt;class fc{constructor(e={}){h(this,St);h(this,Gt);const{window:t=dc,document:n=t==null?void 0:t.document}=e;t!==void 0&&(E(this,St,n),E(this,Gt,nc(s=>{const i=Q(t,"focusin",s),o=Q(t,"focusout",s);return()=>{i(),o()}})))}get current(){var e;return(e=a(this,Gt))==null||e.call(this),a(this,St)?hc(a(this,St)):null}}St=new WeakMap,Gt=new WeakMap;new fc;var Ht,_e;class Kn{constructor(e){h(this,Ht);h(this,_e);E(this,Ht,e),E(this,_e,Symbol(e))}get key(){return a(this,_e)}exists(){return Fa(a(this,_e))}get(){const e=Ii(a(this,_e));if(e===void 0)throw new Error(`Context "${a(this,Ht)}" not found`);return e}getOr(e){const t=Ii(a(this,_e));return t===void 0?e:t}set(e){return Ma(a(this,_e),e)}}Ht=new WeakMap,_e=new WeakMap;function pc(r,e){switch(r){case"post":Ne(e);break;case"pre":La(e);break}}function ao(r,e,t,n={}){const{lazy:s=!1}=n;let i=!s,o=Array.isArray(r)?[]:void 0;pc(e,()=>{const c=Array.isArray(r)?r.map(d=>d()):r();if(!i){i=!0,o=c;return}const l=Da(()=>t(c,o));return o=c,l})}function oe(r,e,t){ao(r,"post",e,t)}function gc(r,e,t){ao(r,"pre",e,t)}oe.pre=gc;function Nt(r){Ne(()=>()=>{r()})}function bc(r,e){return setTimeout(e,r)}function ke(r){Ua().then(r)}const vc=1,mc=9,yc=11;function rs(r){return Er(r)&&r.nodeType===vc&&typeof r.nodeName=="string"}function co(r){return Er(r)&&r.nodeType===mc}function wc(r){var e;return Er(r)&&((e=r.constructor)==null?void 0:e.name)==="VisualViewport"}function Sc(r){return Er(r)&&r.nodeType!==void 0}function lo(r){return Sc(r)&&r.nodeType===yc&&"host"in r}function Cc(r,e){var n;if(!r||!e||!rs(r)||!rs(e))return!1;const t=(n=e.getRootNode)==null?void 0:n.call(e);if(r===e||r.contains(e))return!0;if(t&&lo(t)){let s=e;for(;s;){if(r===s)return!0;s=s.parentNode||s.host}}return!1}function Wn(r){return co(r)?r:wc(r)?r.document:(r==null?void 0:r.ownerDocument)??document}function uo(r){var e;return lo(r)?uo(r.host):co(r)?r.defaultView??window:rs(r)?((e=r.ownerDocument)==null?void 0:e.defaultView)??window:window}function Tc(r){let e=r.activeElement;for(;e!=null&&e.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}var Jt;class As{constructor(e){y(this,"element");h(this,Jt,A(()=>this.element.current?this.element.current.getRootNode()??document:document));y(this,"getDocument",()=>Wn(this.root));y(this,"getWindow",()=>this.getDocument().defaultView??window);y(this,"getActiveElement",()=>Tc(this.root));y(this,"isActiveElement",e=>e===this.getActiveElement());y(this,"querySelector",e=>this.root?this.root.querySelector(e):null);y(this,"querySelectorAll",e=>this.root?this.root.querySelectorAll(e):[]);y(this,"setTimeout",(e,t)=>this.getWindow().setTimeout(e,t));y(this,"clearTimeout",e=>this.getWindow().clearTimeout(e));typeof e=="function"?this.element=x(e):this.element=e}get root(){return u(a(this,Jt))}set root(e){T(a(this,Jt),e)}getElementById(e){return this.root.getElementById(e)}}Jt=new WeakMap;const Vt="ArrowDown",Is="ArrowLeft",Ps="ArrowRight",nr="ArrowUp",ho="End",ks="Enter",Oc="Escape",fo="Home",_c="PageDown",xc="PageUp",Ar=" ",Ec="Tab";function Ac(r){return window.getComputedStyle(r).getPropertyValue("direction")}function Ic(r="ltr",e="horizontal"){return{horizontal:r==="rtl"?Is:Ps,vertical:Vt}[e]}function Pc(r="ltr",e="horizontal"){return{horizontal:r==="rtl"?Ps:Is,vertical:nr}[e]}function kc(r="ltr",e="horizontal"){return["ltr","rtl"].includes(r)||(r="ltr"),["horizontal","vertical"].includes(e)||(e="horizontal"),{nextKey:Ic(r,e),prevKey:Pc(r,e)}}const po=typeof document<"u",Ni=Rc();function Rc(){var r,e;return po&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function Fe(r){return r instanceof HTMLElement}function ss(r){return r instanceof Element}function go(r){return r instanceof Element||r instanceof SVGElement}function rd(r){return r!==null}function Nc(r){return r instanceof HTMLInputElement&&"select"in r}var ne,xe;class Fc{constructor(e){h(this,ne);h(this,xe,pt(null));E(this,ne,e)}getCandidateNodes(){return a(this,ne).rootNode.current?a(this,ne).candidateSelector?Array.from(a(this,ne).rootNode.current.querySelectorAll(a(this,ne).candidateSelector)):a(this,ne).candidateAttr?Array.from(a(this,ne).rootNode.current.querySelectorAll(`[${a(this,ne).candidateAttr}]:not([data-disabled])`)):[]:[]}focusFirstCandidate(){var t;const e=this.getCandidateNodes();e.length&&((t=e[0])==null||t.focus())}handleKeydown(e,t,n=!1){var p,S;const s=a(this,ne).rootNode.current;if(!s||!e)return;const i=this.getCandidateNodes();if(!i.length)return;const o=i.indexOf(e),c=Ac(s),{nextKey:l,prevKey:d}=kc(c,a(this,ne).orientation.current),b=a(this,ne).loop.current,f={[l]:o+1,[d]:o-1,[fo]:0,[ho]:i.length-1};if(n){const B=l===Vt?Ps:Vt,M=d===nr?Is:nr;f[B]=o+1,f[M]=o-1}let v=f[t.key];if(v===void 0)return;t.preventDefault(),v<0&&b?v=i.length-1:v===i.length&&b&&(v=0);const m=i[v];if(m)return m.focus(),a(this,xe).current=m.id,(S=(p=a(this,ne)).onCandidateFocus)==null||S.call(p,m),m}getTabIndex(e){const t=this.getCandidateNodes(),n=a(this,xe).current!==null;return e&&!n&&t[0]===e?(a(this,xe).current=e.id,0):(e==null?void 0:e.id)===a(this,xe).current?0:-1}setCurrentTabStopId(e){a(this,xe).current=e}focusCurrentTabStop(){var n;const e=a(this,xe).current;if(!e)return;const t=(n=a(this,ne).rootNode.current)==null?void 0:n.querySelector(`#${e}`);!t||!Fe(t)||t.focus()}}ne=new WeakMap,xe=new WeakMap;var Ct,rt,Re,is,Zn;class Mc{constructor(e){h(this,Re);h(this,Ct);h(this,rt,null);E(this,Ct,e),Nt(()=>N(this,Re,is).call(this))}run(e){N(this,Re,is).call(this);const t=a(this,Ct).ref.current;if(t){if(typeof t.getAnimations!="function"){N(this,Re,Zn).call(this,e);return}E(this,rt,window.requestAnimationFrame(()=>{const n=t.getAnimations();if(n.length===0){N(this,Re,Zn).call(this,e);return}Promise.allSettled(n.map(s=>s.finished)).then(()=>{N(this,Re,Zn).call(this,e)})}))}}}Ct=new WeakMap,rt=new WeakMap,Re=new WeakSet,is=function(){a(this,rt)&&(window.cancelAnimationFrame(a(this,rt)),E(this,rt,null))},Zn=function(e){const t=()=>{e()};a(this,Ct).afterTick?ke(t):t()};var Ce,Yt,Xt,st;class os{constructor(e){h(this,Ce);h(this,Yt);h(this,Xt);h(this,st,U(!1));E(this,Ce,e),T(a(this,st),e.open.current,!0),E(this,Yt,e.enabled??!0),E(this,Xt,new Mc({ref:a(this,Ce).ref,afterTick:a(this,Ce).open})),oe(()=>a(this,Ce).open.current,t=>{t&&T(a(this,st),!0),a(this,Yt)&&a(this,Xt).run(()=>{var n,s;t===a(this,Ce).open.current&&(a(this,Ce).open.current||T(a(this,st),!1),(s=(n=a(this,Ce)).onComplete)==null||s.call(n))})})}get shouldRender(){return u(a(this,st))}}Ce=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,st=new WeakMap;function Y(){}const Lc=io({component:"dialog",parts:["content","trigger","overlay","title","description","close","cancel","action"]}),ht=new Kn("Dialog.Root | AlertDialog.Root");var Qt,Zt,$t,en,tn,nn,rn,sn,on,an,cn;const Us=class Us{constructor(e,t){y(this,"opts");h(this,Qt,U(null));h(this,Zt,U(null));h(this,$t,U(null));h(this,en,U(null));h(this,tn,U(void 0));h(this,nn,U(void 0));h(this,rn,U(void 0));h(this,sn,U(void 0));h(this,on,U(null));h(this,an,U(0));y(this,"depth");y(this,"parent");y(this,"contentPresence");y(this,"overlayPresence");y(this,"getBitsAttr",e=>Lc.getAttr(e,this.opts.variant.current));h(this,cn,A(()=>({"data-state":Es(this.opts.open.current)})));this.opts=e,this.parent=t,this.depth=t?t.depth+1:0,this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.contentPresence=new os({ref:x(()=>this.contentNode),open:this.opts.open,enabled:!0,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new os({ref:x(()=>this.overlayNode),open:this.opts.open,enabled:!0}),oe(()=>this.opts.open.current,n=>{this.parent&&(n?this.parent.incrementNested():this.parent.decrementNested())},{lazy:!0}),Nt(()=>{var n;this.opts.open.current&&((n=this.parent)==null||n.decrementNested())})}static create(e){const t=ht.getOr(null);return ht.set(new Us(e,t))}get triggerNode(){return u(a(this,Qt))}set triggerNode(e){T(a(this,Qt),e,!0)}get contentNode(){return u(a(this,Zt))}set contentNode(e){T(a(this,Zt),e,!0)}get overlayNode(){return u(a(this,$t))}set overlayNode(e){T(a(this,$t),e,!0)}get descriptionNode(){return u(a(this,en))}set descriptionNode(e){T(a(this,en),e,!0)}get contentId(){return u(a(this,tn))}set contentId(e){T(a(this,tn),e,!0)}get titleId(){return u(a(this,nn))}set titleId(e){T(a(this,nn),e,!0)}get triggerId(){return u(a(this,rn))}set triggerId(e){T(a(this,rn),e,!0)}get descriptionId(){return u(a(this,sn))}set descriptionId(e){T(a(this,sn),e,!0)}get cancelNode(){return u(a(this,on))}set cancelNode(e){T(a(this,on),e,!0)}get nestedOpenCount(){return u(a(this,an))}set nestedOpenCount(e){T(a(this,an),e,!0)}handleOpen(){this.opts.open.current||(this.opts.open.current=!0)}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}incrementNested(){var e;this.nestedOpenCount++,(e=this.parent)==null||e.incrementNested()}decrementNested(){var e;this.nestedOpenCount!==0&&(this.nestedOpenCount--,(e=this.parent)==null||e.decrementNested())}get sharedProps(){return u(a(this,cn))}set sharedProps(e){T(a(this,cn),e)}};Qt=new WeakMap,Zt=new WeakMap,$t=new WeakMap,en=new WeakMap,tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,sn=new WeakMap,on=new WeakMap,an=new WeakMap,cn=new WeakMap;let as=Us;var ln;const js=class js{constructor(e,t){y(this,"opts");y(this,"root");y(this,"attachment");h(this,ln,A(()=>({id:this.opts.id.current,[this.root.getBitsAttr(this.opts.variant.current)]:"",onclick:this.onclick,onkeydown:this.onkeydown,disabled:this.opts.disabled.current?!0:void 0,tabindex:0,...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=$e(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}static create(e){return new js(e,ht.get())}onclick(e){this.opts.disabled.current||e.button>0||this.root.handleClose()}onkeydown(e){this.opts.disabled.current||(e.key===Ar||e.key===ks)&&(e.preventDefault(),this.root.handleClose())}get props(){return u(a(this,ln))}set props(e){T(a(this,ln),e)}};ln=new WeakMap;let cs=js;var un;const qs=class qs{constructor(e,t){y(this,"opts");y(this,"root");y(this,"attachment");h(this,un,A(()=>({id:this.opts.id.current,role:"heading","aria-level":this.opts.level.current,[this.root.getBitsAttr("title")]:"",...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.root.titleId=this.opts.id.current,this.attachment=$e(this.opts.ref),oe.pre(()=>this.opts.id.current,n=>{this.root.titleId=n})}static create(e){return new qs(e,ht.get())}get props(){return u(a(this,un))}set props(e){T(a(this,un),e)}};un=new WeakMap;let ls=qs;var dn;const Bs=class Bs{constructor(e,t){y(this,"opts");y(this,"root");y(this,"attachment");h(this,dn,A(()=>({id:this.opts.id.current,[this.root.getBitsAttr("description")]:"",...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.root.descriptionId=this.opts.id.current,this.attachment=$e(this.opts.ref,n=>{this.root.descriptionNode=n}),oe.pre(()=>this.opts.id.current,n=>{this.root.descriptionId=n})}static create(e){return new Bs(e,ht.get())}get props(){return u(a(this,dn))}set props(e){T(a(this,dn),e)}};dn=new WeakMap;let us=Bs;var hn,fn;const Ks=class Ks{constructor(e,t){y(this,"opts");y(this,"root");y(this,"attachment");h(this,hn,A(()=>({open:this.root.opts.open.current})));h(this,fn,A(()=>({id:this.opts.id.current,role:this.root.opts.variant.current==="alert-dialog"?"alertdialog":"dialog","aria-modal":"true","aria-describedby":this.root.descriptionId,"aria-labelledby":this.root.titleId,[this.root.getBitsAttr("content")]:"",style:{pointerEvents:"auto",outline:this.root.opts.variant.current==="alert-dialog"?"none":void 0,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount,contain:"layout style"},tabindex:this.root.opts.variant.current==="alert-dialog"?-1:void 0,"data-nested-open":kt(this.root.nestedOpenCount>0),"data-nested":kt(this.root.parent!==null),...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=$e(this.opts.ref,n=>{this.root.contentNode=n,this.root.contentId=n==null?void 0:n.id})}static create(e){return new Ks(e,ht.get())}get snippetProps(){return u(a(this,hn))}set snippetProps(e){T(a(this,hn),e)}get props(){return u(a(this,fn))}set props(e){T(a(this,fn),e)}get shouldRender(){return this.root.contentPresence.shouldRender}};hn=new WeakMap,fn=new WeakMap;let ds=Ks;var pn,gn;const Ws=class Ws{constructor(e,t){y(this,"opts");y(this,"root");y(this,"attachment");h(this,pn,A(()=>({open:this.root.opts.open.current})));h(this,gn,A(()=>({id:this.opts.id.current,[this.root.getBitsAttr("overlay")]:"",style:{pointerEvents:"auto","--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount},"data-nested-open":kt(this.root.nestedOpenCount>0),"data-nested":kt(this.root.parent!==null),...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=$e(this.opts.ref,n=>this.root.overlayNode=n)}static create(e){return new Ws(e,ht.get())}get snippetProps(){return u(a(this,pn))}set snippetProps(e){T(a(this,pn),e)}get props(){return u(a(this,gn))}set props(e){T(a(this,gn),e)}get shouldRender(){return this.root.overlayPresence.shouldRender}};pn=new WeakMap,gn=new WeakMap;let hs=Ws;var Dc=J("<div><!></div>");function Uc(r,e){const t=jn();G(e,!0);let n=_(e,"id",19,()=>Bn(t)),s=_(e,"ref",15,null),i=_(e,"level",3,2),o=ae(e,["$$slots","$$events","$$legacy","id","ref","child","children","level"]);const c=ls.create({id:x(()=>n()),level:x(()=>i()),ref:x(()=>s(),m=>s(m))}),l=A(()=>Te(o,c.props));var d=q(),b=L(d);{var f=m=>{var p=q(),S=L(p);V(S,()=>e.child,()=>({props:u(l)})),O(m,p)},v=m=>{var p=Dc();Qe(p,()=>({...u(l)}));var S=I(p);V(S,()=>e.children??$),P(p),O(m,p)};se(b,m=>{e.child?m(f):m(v,!1)})}O(r,d),H()}function jc(r,e){var t=q(),n=L(t);ac(n,()=>e.children,s=>{var i=q(),o=L(i);V(o,()=>e.children??$),O(s,i)}),O(r,t)}const qc=new Kn("BitsConfig");function Bc(){const r=new Kc(null,{});return qc.getOr(r).opts}class Kc{constructor(e,t){y(this,"opts");const n=Wc(e,t);this.opts={defaultPortalTo:n(s=>s.defaultPortalTo),defaultLocale:n(s=>s.defaultLocale)}}}function Wc(r,e){return t=>x(()=>{var i,o;const s=(i=t(e))==null?void 0:i.current;if(s!==void 0)return s;if(r!==null)return(o=t(r.opts))==null?void 0:o.current})}function zc(r,e){return t=>{const n=Bc();return x(()=>{const s=t();if(s!==void 0)return s;const i=r(n).current;return i!==void 0?i:e})}}const Vc=zc(r=>r.defaultPortalTo,"body");function Gc(r,e){G(e,!0);const t=Vc(()=>e.to),n=ja();let s=A(i);function i(){if(!po||e.disabled)return null;let f=null;return typeof t.current=="string"?f=document.querySelector(t.current):f=t.current,f}let o;function c(){o&&(sc(o),o=null)}oe([()=>u(s),()=>e.disabled],([f,v])=>{if(!f||v){c();return}return o=rc(jc,{target:f,props:{children:e.children},context:n}),()=>{c()}});var l=q(),d=L(l);{var b=f=>{var v=q(),m=L(v);V(m,()=>e.children??$),O(f,v)};se(d,f=>{e.disabled&&f(b)})}O(r,l),H()}class Hc{constructor(e,t={bubbles:!0,cancelable:!0}){y(this,"eventName");y(this,"options");this.eventName=e,this.options=t}createEvent(e){return new CustomEvent(this.eventName,{...this.options,detail:e})}dispatch(e,t){const n=this.createEvent(t);return e.dispatchEvent(n),n}listen(e,t,n){const s=i=>{t(i)};return Q(e,this.eventName,s,n)}}function Fi(r,e=500){let t=null;const n=(...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{r(...s)},e)};return n.destroy=()=>{t!==null&&(clearTimeout(t),t=null)},n}function bo(r,e){return r===e||r.contains(e)}function vo(r){return(r==null?void 0:r.ownerDocument)??document}function Jc(r,e){const{clientX:t,clientY:n}=r,s=e.getBoundingClientRect();return t<s.left||t>s.right||n<s.top||n>s.bottom}const Yc=[ks,Ar],Xc=[Vt,xc,fo],mo=[nr,_c,ho],Qc=[...Xc,...mo];function Mi(r){return r.pointerType==="mouse"}function Zc(r,{select:e=!1}={}){if(!r||!r.focus)return;const t=Wn(r);if(t.activeElement===r)return;const n=t.activeElement;r.focus({preventScroll:!0}),r!==n&&Nc(r)&&e&&r.select()}function $c(r,{select:e=!1}={},t){const n=t();for(const s of r)if(Zc(s,{select:e}),t()!==n)return!0}let Dt=U(!1);const de=class de{constructor(){Ne(()=>(de._refs===0&&(de._cleanup=ro(()=>{const e=[],t=s=>{T(Dt,!1)},n=s=>{T(Dt,!0)};return e.push(Q(document,"pointerdown",t,{capture:!0}),Q(document,"pointermove",t,{capture:!0}),Q(document,"keydown",n,{capture:!0})),yt(...e)})),de._refs++,()=>{var e;de._refs--,de._refs===0&&(T(Dt,!1),(e=de._cleanup)==null||e.call(de))}))}get current(){return u(Dt)}set current(e){T(Dt,e,!0)}};y(de,"_refs",0),y(de,"_cleanup");let fs=de;/*!
* tabbable 6.4.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/var yo=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],rr=yo.join(","),wo=typeof Element>"u",ft=wo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,sr=!wo&&Element.prototype.getRootNode?function(r){var e;return r==null||(e=r.getRootNode)===null||e===void 0?void 0:e.call(r)}:function(r){return r==null?void 0:r.ownerDocument},ir=function(e,t){var n;t===void 0&&(t=!0);var s=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),i=s===""||s==="true",o=i||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ir(e.parentNode));return o},el=function(e){var t,n=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return n===""||n==="true"},So=function(e,t,n){if(ir(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(rr));return t&&ft.call(e,rr)&&s.unshift(e),s=s.filter(n),s},or=function(e,t,n){for(var s=[],i=Array.from(e);i.length;){var o=i.shift();if(!ir(o,!1))if(o.tagName==="SLOT"){var c=o.assignedElements(),l=c.length?c:o.children,d=or(l,!0,n);n.flatten?s.push.apply(s,d):s.push({scopeParent:o,candidates:d})}else{var b=ft.call(o,rr);b&&n.filter(o)&&(t||!e.includes(o))&&s.push(o);var f=o.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(o),v=!ir(f,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(o));if(f&&v){var m=or(f===!0?o.children:f.children,!0,n);n.flatten?s.push.apply(s,m):s.push({scopeParent:o,candidates:m})}else i.unshift.apply(i,o.children)}}return s},Co=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},To=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||el(e))&&!Co(e)?0:e.tabIndex},tl=function(e,t){var n=To(e);return n<0&&t&&!Co(e)?0:n},nl=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Oo=function(e){return e.tagName==="INPUT"},rl=function(e){return Oo(e)&&e.type==="hidden"},sl=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},il=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},ol=function(e){if(!e.name)return!0;var t=e.form||sr(e),n=function(c){return t.querySelectorAll('input[type="radio"][name="'+c+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=n(window.CSS.escape(e.name));else try{s=n(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var i=il(s,e.form);return!i||i===e},al=function(e){return Oo(e)&&e.type==="radio"},cl=function(e){return al(e)&&!ol(e)},ll=function(e){var t,n=e&&sr(e),s=(t=n)===null||t===void 0?void 0:t.host,i=!1;if(n&&n!==e){var o,c,l;for(i=!!((o=s)!==null&&o!==void 0&&(c=o.ownerDocument)!==null&&c!==void 0&&c.contains(s)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&s;){var d,b,f;n=sr(s),s=(d=n)===null||d===void 0?void 0:d.host,i=!!((b=s)!==null&&b!==void 0&&(f=b.ownerDocument)!==null&&f!==void 0&&f.contains(s))}}return i},Li=function(e){var t=e.getBoundingClientRect(),n=t.width,s=t.height;return n===0&&s===0},ul=function(e,t){var n=t.displayCheck,s=t.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var o=ft.call(e,"details>summary:first-of-type"),c=o?e.parentElement:e;if(ft.call(c,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof s=="function"){for(var l=e;e;){var d=e.parentElement,b=sr(e);if(d&&!d.shadowRoot&&s(d)===!0)return Li(e);e.assignedSlot?e=e.assignedSlot:!d&&b!==e.ownerDocument?e=b.host:e=d}e=l}if(ll(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Li(e);return!1},dl=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var s=t.children.item(n);if(s.tagName==="LEGEND")return ft.call(t,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}t=t.parentElement}return!1},ar=function(e,t){return!(t.disabled||rl(t)||ul(t,e)||sl(t)||dl(t))},ps=function(e,t){return!(cl(t)||To(t)<0||!ar(e,t))},hl=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},_o=function(e){var t=[],n=[];return e.forEach(function(s,i){var o=!!s.scopeParent,c=o?s.scopeParent:s,l=tl(c,o),d=o?_o(s.candidates):c;l===0?o?t.push.apply(t,d):t.push(c):n.push({documentOrder:i,tabIndex:l,item:s,isScope:o,content:d})}),n.sort(nl).reduce(function(s,i){return i.isScope?s.push.apply(s,i.content):s.push(i.content),s},[]).concat(t)},xo=function(e,t){t=t||{};var n;return t.getShadowRoot?n=or([e],t.includeContainer,{filter:ps.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:hl}):n=So(e,t.includeContainer,ps.bind(null,t)),_o(n)},Eo=function(e,t){t=t||{};var n;return t.getShadowRoot?n=or([e],t.includeContainer,{filter:ar.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=So(e,t.includeContainer,ar.bind(null,t)),n},Rs=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ft.call(e,rr)===!1?!1:ps(t,e)},fl=yo.concat("iframe:not([inert]):not([inert] *)").join(","),Ao=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ft.call(e,fl)===!1?!1:ar(t,e)};function zt(){return{getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"}}function pl(r,e){if(!Rs(r,zt()))return gl(r,e);const t=Wn(r),n=xo(t.body,zt());e==="prev"&&n.reverse();const s=n.indexOf(r);return s===-1?t.body:n.slice(s+1)[0]}function gl(r,e){const t=Wn(r);if(!Ao(r,zt()))return t.body;const n=Eo(t.body,zt());e==="prev"&&n.reverse();const s=n.indexOf(r);return s===-1?t.body:n.slice(s+1).find(o=>Rs(o,zt()))??t.body}function Io(r,e,t){const n=e.toLowerCase();if(n.endsWith(" ")){const f=n.slice(0,-1);if(r.filter(S=>S.toLowerCase().startsWith(f)).length<=1)return Io(r,f,t);const m=t==null?void 0:t.toLowerCase();if(m&&m.startsWith(f)&&m.charAt(f.length)===" "&&e.trim()===f)return t;const p=r.filter(S=>S.toLowerCase().startsWith(n));if(p.length>0){const S=t?r.indexOf(t):-1;return Di(p,Math.max(S,0)).find(R=>R!==t)||t}}const i=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,o=i.toLowerCase(),c=t?r.indexOf(t):-1;let l=Di(r,Math.max(c,0));i.length===1&&(l=l.filter(f=>f!==t));const b=l.find(f=>f==null?void 0:f.toLowerCase().startsWith(o));return b!==t?b:void 0}function Di(r,e){return r.map((t,n)=>r[(e+n)%r.length])}const bl={afterMs:1e4,onChange:Y};function Po(r,e){const{afterMs:t,onChange:n,getWindow:s}={...bl,...e};let i=null,o=U(no(r));function c(){return s().setTimeout(()=>{T(o,r,!0),n==null||n(r)},t)}return Ne(()=>()=>{i&&s().clearTimeout(i)}),x(()=>u(o),l=>{T(o,l,!0),n==null||n(l),i&&s().clearTimeout(i),i=c()})}var Ee,Ae,lr,ur;class vl{constructor(e){h(this,Ee);h(this,Ae);h(this,lr,A(()=>a(this,Ee).onMatch?a(this,Ee).onMatch:e=>e.focus()));h(this,ur,A(()=>a(this,Ee).getCurrentItem?a(this,Ee).getCurrentItem:a(this,Ee).getActiveElement));E(this,Ee,e),E(this,Ae,Po("",{afterMs:1e3,getWindow:e.getWindow})),this.handleTypeaheadSearch=this.handleTypeaheadSearch.bind(this),this.resetTypeahead=this.resetTypeahead.bind(this)}handleTypeaheadSearch(e,t){var l,d;if(!t.length)return;a(this,Ae).current=a(this,Ae).current+e;const n=u(a(this,ur))(),s=((d=(l=t.find(b=>b===n))==null?void 0:l.textContent)==null?void 0:d.trim())??"",i=t.map(b=>{var f;return((f=b.textContent)==null?void 0:f.trim())??""}),o=Io(i,a(this,Ae).current,s),c=t.find(b=>{var f;return((f=b.textContent)==null?void 0:f.trim())===o});return c&&u(a(this,lr))(c),c}resetTypeahead(){a(this,Ae).current=""}get search(){return a(this,Ae).current}}Ee=new WeakMap,Ae=new WeakMap,lr=new WeakMap,ur=new WeakMap;var it,bn,Tt,We,Ze,gs,bs;class ml{constructor(e){h(this,Ze);h(this,it);h(this,bn);h(this,Tt);h(this,We,U(null));E(this,it,e),E(this,bn,A(()=>a(this,it).enabled())),E(this,Tt,Po(!1,{afterMs:e.transitTimeout??300,onChange:t=>{var n,s;u(a(this,bn))&&((s=(n=a(this,it)).setIsPointerInTransit)==null||s.call(n,t))},getWindow:()=>uo(a(this,it).triggerNode())})),oe([e.triggerNode,e.contentNode,e.enabled],([t,n,s])=>{if(!t||!n||!s)return;const i=c=>{N(this,Ze,bs).call(this,c,n)},o=c=>{N(this,Ze,bs).call(this,c,t)};return yt(Q(t,"pointerleave",i),Q(n,"pointerleave",o))}),oe(()=>u(a(this,We)),()=>{const t=s=>{var d,b;if(!u(a(this,We)))return;const i=s.target;if(!ss(i))return;const o={x:s.clientX,y:s.clientY},c=((d=e.triggerNode())==null?void 0:d.contains(i))||((b=e.contentNode())==null?void 0:b.contains(i)),l=!Cl(o,u(a(this,We)));c?N(this,Ze,gs).call(this):l&&(N(this,Ze,gs).call(this),e.onPointerExit())},n=Wn(e.triggerNode()??e.contentNode());if(n)return Q(n,"pointermove",t)})}}it=new WeakMap,bn=new WeakMap,Tt=new WeakMap,We=new WeakMap,Ze=new WeakSet,gs=function(){T(a(this,We),null),a(this,Tt).current=!1},bs=function(e,t){const n=e.currentTarget;if(!Fe(n))return;const s={x:e.clientX,y:e.clientY},i=yl(s,n.getBoundingClientRect()),o=wl(s,i),c=Sl(t.getBoundingClientRect()),l=Tl([...o,...c]);T(a(this,We),l,!0),a(this,Tt).current=!0};function yl(r,e){const t=Math.abs(e.top-r.y),n=Math.abs(e.bottom-r.y),s=Math.abs(e.right-r.x),i=Math.abs(e.left-r.x);switch(Math.min(t,n,s,i)){case i:return"left";case s:return"right";case t:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function wl(r,e,t=5){const n=t*1.5;switch(e){case"top":return[{x:r.x-t,y:r.y+t},{x:r.x,y:r.y-n},{x:r.x+t,y:r.y+t}];case"bottom":return[{x:r.x-t,y:r.y-t},{x:r.x,y:r.y+n},{x:r.x+t,y:r.y-t}];case"left":return[{x:r.x+t,y:r.y-t},{x:r.x-n,y:r.y},{x:r.x+t,y:r.y+t}];case"right":return[{x:r.x-t,y:r.y-t},{x:r.x+n,y:r.y},{x:r.x-t,y:r.y+t}]}}function Sl(r){const{top:e,right:t,bottom:n,left:s}=r;return[{x:s,y:e},{x:t,y:e},{x:t,y:n},{x:s,y:n}]}function Cl(r,e){const{x:t,y:n}=r;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const c=e[i].x,l=e[i].y,d=e[o].x,b=e[o].y;l>n!=b>n&&t<(d-c)*(n-l)/(b-l)+c&&(s=!s)}return s}function Tl(r){const e=r.slice();return e.sort((t,n)=>t.x<n.x?-1:t.x>n.x?1:t.y<n.y?-1:t.y>n.y?1:0),Ol(e)}function Ol(r){if(r.length<=1)return r.slice();const e=[];for(let n=0;n<r.length;n++){const s=r[n];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const t=[];for(let n=r.length-1;n>=0;n--){const s=r[n];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}const _l="data-context-menu-trigger",xl="data-context-menu-content",El=new Kn("Menu.Root"),Ns=new Kn("Menu.Root | Menu.Sub"),ko=new Kn("Menu.Content"),Al=new Hc("bitsmenuopen",{bubbles:!1,cancelable:!0}),Il=io({component:"menu",parts:["trigger","content","sub-trigger","item","group","group-heading","checkbox-group","checkbox-item","radio-group","radio-item","separator","sub-content","arrow"]});var vn,mn;const zs=class zs{constructor(e){y(this,"opts");y(this,"isUsingKeyboard",new fs);h(this,vn,U(!1));h(this,mn,U(!1));y(this,"getBitsAttr",e=>Il.getAttr(e,this.opts.variant.current));this.opts=e}static create(e){const t=new zs(e);return El.set(t)}get ignoreCloseAutoFocus(){return u(a(this,vn))}set ignoreCloseAutoFocus(e){T(a(this,vn),e,!0)}get isPointerInTransit(){return u(a(this,mn))}set isPointerInTransit(e){T(a(this,mn),e,!0)}};vn=new WeakMap,mn=new WeakMap;let Ui=zs;var yn,wn;const Vs=class Vs{constructor(e,t,n){y(this,"opts");y(this,"root");y(this,"parentMenu");y(this,"contentId",x(()=>""));h(this,yn,U(null));y(this,"contentPresence");h(this,wn,U(null));this.opts=e,this.root=t,this.parentMenu=n,this.contentPresence=new os({ref:x(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),n&&oe(()=>n.opts.open.current,()=>{n.opts.open.current||(this.opts.open.current=!1)})}static create(e,t){return Ns.set(new Vs(e,t,null))}get contentNode(){return u(a(this,yn))}set contentNode(e){T(a(this,yn),e,!0)}get triggerNode(){return u(a(this,wn))}set triggerNode(e){T(a(this,wn),e,!0)}toggleOpen(){this.opts.open.current=!this.opts.open.current}onOpen(){this.opts.open.current=!0}onClose(){this.opts.open.current=!1}};yn=new WeakMap,wn=new WeakMap;let ji=Vs;var Sn,Cn,Tn,On,_n,Xe,Ro,$n,xn,En;const Gs=class Gs{constructor(e,t){h(this,Xe);y(this,"opts");y(this,"parentMenu");y(this,"rovingFocusGroup");y(this,"domContext");y(this,"attachment");h(this,Sn,U(""));h(this,Cn,0);h(this,Tn);h(this,On,U(!1));h(this,_n);y(this,"onCloseAutoFocus",e=>{var t,n;(n=(t=this.opts.onCloseAutoFocus).current)==null||n.call(t,e),!(e.defaultPrevented||a(this,_n))&&this.parentMenu.triggerNode&&Rs(this.parentMenu.triggerNode)&&(e.preventDefault(),this.parentMenu.triggerNode.focus())});h(this,xn,A(()=>({open:this.parentMenu.opts.open.current})));h(this,En,A(()=>({id:this.opts.id.current,role:"menu","aria-orientation":"vertical",[this.parentMenu.root.getBitsAttr("content")]:"","data-state":Es(this.parentMenu.opts.open.current),onkeydown:this.onkeydown,onblur:this.onblur,onfocus:this.onfocus,dir:this.parentMenu.root.opts.dir.current,style:{pointerEvents:"auto",contain:"layout style"},...this.attachment})));y(this,"popperProps",{onCloseAutoFocus:e=>this.onCloseAutoFocus(e)});this.opts=e,this.parentMenu=t,this.domContext=new As(e.ref),this.attachment=$e(this.opts.ref,n=>{this.parentMenu.contentNode!==n&&(this.parentMenu.contentNode=n)}),t.contentId=e.id,E(this,_n,e.isSub??!1),this.onkeydown=this.onkeydown.bind(this),this.onblur=this.onblur.bind(this),this.onfocus=this.onfocus.bind(this),this.handleInteractOutside=this.handleInteractOutside.bind(this),new ml({contentNode:()=>this.parentMenu.contentNode,triggerNode:()=>this.parentMenu.triggerNode,enabled:()=>{var n;return this.parentMenu.opts.open.current&&!!((n=this.parentMenu.triggerNode)!=null&&n.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger")))},onPointerExit:()=>{this.parentMenu.opts.open.current=!1},setIsPointerInTransit:n=>{this.parentMenu.root.isPointerInTransit=n}}),E(this,Tn,new vl({getActiveElement:()=>this.domContext.getActiveElement(),getWindow:()=>this.domContext.getWindow()}).handleTypeaheadSearch),this.rovingFocusGroup=new Fc({rootNode:x(()=>this.parentMenu.contentNode),candidateAttr:this.parentMenu.root.getBitsAttr("item"),loop:this.opts.loop,orientation:x(()=>"vertical")}),oe(()=>this.parentMenu.contentNode,n=>{if(!n)return;const s=()=>{ke(()=>{this.parentMenu.root.isUsingKeyboard.current&&this.rovingFocusGroup.focusFirstCandidate()})};return Al.listen(n,s)}),Ne(()=>{this.parentMenu.opts.open.current||this.domContext.getWindow().clearTimeout(a(this,Cn))})}static create(e){return ko.set(new Gs(e,Ns.get()))}get search(){return u(a(this,Sn))}set search(e){T(a(this,Sn),e,!0)}get mounted(){return u(a(this,On))}set mounted(e){T(a(this,On),e,!0)}handleTabKeyDown(e){let t=this.parentMenu;for(;t.parentMenu!==null;)t=t.parentMenu;if(!t.triggerNode)return;e.preventDefault();const n=pl(t.triggerNode,e.shiftKey?"prev":"next");n?(this.parentMenu.root.ignoreCloseAutoFocus=!0,t.onClose(),ke(()=>{n.focus(),ke(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})})):this.domContext.getDocument().body.focus()}onkeydown(e){var d,b;if(e.defaultPrevented)return;if(e.key===Ec){this.handleTabKeyDown(e);return}const t=e.target,n=e.currentTarget;if(!Fe(t)||!Fe(n))return;const s=((d=t.closest(`[${this.parentMenu.root.getBitsAttr("content")}]`))==null?void 0:d.id)===this.parentMenu.contentId.current,i=e.ctrlKey||e.altKey||e.metaKey,o=e.key.length===1;if(this.rovingFocusGroup.handleKeydown(t,e)||e.code==="Space")return;const l=N(this,Xe,Ro).call(this);s&&!i&&o&&a(this,Tn).call(this,e.key,l),((b=e.target)==null?void 0:b.id)===this.parentMenu.contentId.current&&Qc.includes(e.key)&&(e.preventDefault(),mo.includes(e.key)&&l.reverse(),$c(l,{select:!1},()=>this.domContext.getActiveElement()))}onblur(e){var t,n;ss(e.currentTarget)&&ss(e.target)&&((n=(t=e.currentTarget).contains)!=null&&n.call(t,e.target)||(this.domContext.getWindow().clearTimeout(a(this,Cn)),this.search=""))}onfocus(e){this.parentMenu.root.isUsingKeyboard.current&&ke(()=>this.rovingFocusGroup.focusFirstCandidate())}onItemEnter(){return N(this,Xe,$n).call(this)}onItemLeave(e){if(e.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))||N(this,Xe,$n).call(this)||this.parentMenu.root.isUsingKeyboard.current)return;const t=this.parentMenu.contentNode;t==null||t.focus(),this.rovingFocusGroup.setCurrentTabStopId("")}onTriggerLeave(){return!!N(this,Xe,$n).call(this)}handleInteractOutside(e){var n;if(!go(e.target))return;const t=(n=this.parentMenu.triggerNode)==null?void 0:n.id;if(e.target.id===t){e.preventDefault();return}e.target.closest(`#${t}`)&&e.preventDefault()}get shouldRender(){return this.parentMenu.contentPresence.shouldRender}get snippetProps(){return u(a(this,xn))}set snippetProps(e){T(a(this,xn),e)}get props(){return u(a(this,En))}set props(e){T(a(this,En),e)}};Sn=new WeakMap,Cn=new WeakMap,Tn=new WeakMap,On=new WeakMap,_n=new WeakMap,Xe=new WeakSet,Ro=function(){const e=this.parentMenu.contentNode;return e?Array.from(e.querySelectorAll(`[${this.parentMenu.root.getBitsAttr("item")}]:not([data-disabled])`)):[]},$n=function(){return this.parentMenu.root.isPointerInTransit},xn=new WeakMap,En=new WeakMap;let qi=Gs;var Ot,An;class Pl{constructor(e,t){y(this,"opts");y(this,"content");y(this,"attachment");h(this,Ot,U(!1));h(this,An,A(()=>({id:this.opts.id.current,tabindex:-1,role:"menuitem","aria-disabled":oo(this.opts.disabled.current),"data-disabled":kt(this.opts.disabled.current),"data-highlighted":u(a(this,Ot))?"":void 0,[this.content.parentMenu.root.getBitsAttr("item")]:"",onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,onfocus:this.onfocus,onblur:this.onblur,...this.attachment})));this.opts=e,this.content=t,this.attachment=$e(this.opts.ref),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave=this.onpointerleave.bind(this),this.onfocus=this.onfocus.bind(this),this.onblur=this.onblur.bind(this)}onpointermove(e){if(!e.defaultPrevented&&Mi(e))if(this.opts.disabled.current)this.content.onItemLeave(e);else{if(this.content.onItemEnter())return;const n=e.currentTarget;if(!Fe(n))return;n.focus()}}onpointerleave(e){e.defaultPrevented||Mi(e)&&this.content.onItemLeave(e)}onfocus(e){ke(()=>{e.defaultPrevented||this.opts.disabled.current||T(a(this,Ot),!0)})}onblur(e){ke(()=>{e.defaultPrevented||T(a(this,Ot),!1)})}get props(){return u(a(this,An))}set props(e){T(a(this,An),e)}}Ot=new WeakMap,An=new WeakMap;var In,dr,No,Pn;const Hs=class Hs{constructor(e,t){h(this,dr);y(this,"opts");y(this,"item");y(this,"root");h(this,In,!1);h(this,Pn,A(()=>Te(this.item.props,{onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown})));this.opts=e,this.item=t,this.root=t.content.parentMenu.root,this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this)}static create(e){const t=new Pl(e,ko.get());return new Hs(e,t)}onkeydown(e){const t=this.item.content.search!=="";if(!(this.item.opts.disabled.current||t&&e.key===Ar)&&Yc.includes(e.key)){if(!Fe(e.currentTarget))return;e.currentTarget.click(),e.preventDefault()}}onclick(e){this.item.opts.disabled.current||N(this,dr,No).call(this)}onpointerup(e){var t;if(!e.defaultPrevented&&!a(this,In)){if(!Fe(e.currentTarget))return;(t=e.currentTarget)==null||t.click()}}onpointerdown(e){E(this,In,!0)}get props(){return u(a(this,Pn))}set props(e){T(a(this,Pn),e)}};In=new WeakMap,dr=new WeakSet,No=function(){if(this.item.opts.disabled.current)return;const e=new CustomEvent("menuitemselect",{bubbles:!0,cancelable:!0});if(this.opts.onSelect.current(e),e.defaultPrevented){this.item.content.parentMenu.root.isUsingKeyboard.current=!1;return}this.opts.closeOnSelect.current&&this.item.content.parentMenu.root.opts.onClose()},Pn=new WeakMap;let Bi=Hs;var hr,kn;const Js=class Js{constructor(e,t){y(this,"opts");y(this,"parentMenu");y(this,"attachment");y(this,"onclick",e=>{this.opts.disabled.current||e.detail!==0||(this.parentMenu.toggleOpen(),e.preventDefault())});y(this,"onpointerdown",e=>{if(!this.opts.disabled.current){if(e.pointerType==="touch")return e.preventDefault();e.button===0&&e.ctrlKey===!1&&(this.parentMenu.toggleOpen(),this.parentMenu.opts.open.current||e.preventDefault())}});y(this,"onpointerup",e=>{this.opts.disabled.current||e.pointerType==="touch"&&(e.preventDefault(),this.parentMenu.toggleOpen())});y(this,"onkeydown",e=>{if(!this.opts.disabled.current){if(e.key===Ar||e.key===ks){this.parentMenu.toggleOpen(),e.preventDefault();return}e.key===Vt&&(this.parentMenu.onOpen(),e.preventDefault())}});h(this,hr,A(()=>{if(this.parentMenu.opts.open.current&&this.parentMenu.contentId.current)return this.parentMenu.contentId.current}));h(this,kn,A(()=>({id:this.opts.id.current,disabled:this.opts.disabled.current,"aria-haspopup":"menu","aria-expanded":oo(this.parentMenu.opts.open.current),"aria-controls":u(a(this,hr)),"data-disabled":kt(this.opts.disabled.current),"data-state":Es(this.parentMenu.opts.open.current),[this.parentMenu.root.getBitsAttr("trigger")]:"",onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown,...this.attachment})));this.opts=e,this.parentMenu=t,this.attachment=$e(this.opts.ref,n=>this.parentMenu.triggerNode=n)}static create(e){return new Js(e,Ns.get())}get props(){return u(a(this,kn))}set props(e){T(a(this,kn),e)}};hr=new WeakMap,kn=new WeakMap;let Ki=Js;globalThis.bitsDismissableLayers??(globalThis.bitsDismissableLayers=new Map);var _t,ot,ze,xt,Et,Ve,Rn,Ie,fr,Rt,Fo,pr,At,gr,br,vr,mr,Nn,Mo,yr,wr;const Ys=class Ys{constructor(e){h(this,Rt);y(this,"opts");h(this,_t);h(this,ot);h(this,ze,{pointerdown:!1});h(this,xt,!1);h(this,Et,!1);h(this,Ve);h(this,Rn);h(this,Ie,Y);h(this,fr,e=>{e.defaultPrevented||this.opts.ref.current&&ke(()=>{var t,n;!this.opts.ref.current||a(this,mr).call(this,e.target)||e.target&&!a(this,Et)&&((n=(t=a(this,Rn)).current)==null||n.call(t,e))})});h(this,pr,e=>{let t=e;t.defaultPrevented&&(t=Wi(e)),a(this,_t).current(e)});h(this,At,Fi(e=>{if(!this.opts.ref.current){a(this,Ie).call(this);return}const t=this.opts.isValidEvent.current(e,this.opts.ref.current)||Nl(e,this.opts.ref.current);if(!a(this,xt)||N(this,Rt,Mo).call(this)||!t){a(this,Ie).call(this);return}let n=e;if(n.defaultPrevented&&(n=Wi(n)),a(this,ot).current!=="close"&&a(this,ot).current!=="defer-otherwise-close"){a(this,Ie).call(this);return}e.pointerType==="touch"?(a(this,Ie).call(this),E(this,Ie,Q(a(this,Ve),"click",a(this,pr),{once:!0}))):a(this,_t).current(n)},10));h(this,gr,e=>{a(this,ze)[e.type]=!0});h(this,br,e=>{a(this,ze)[e.type]=!1});h(this,vr,()=>{this.opts.ref.current&&E(this,xt,Rl(this.opts.ref.current))});h(this,mr,e=>this.opts.ref.current?bo(this.opts.ref.current,e):!1);h(this,Nn,Fi(()=>{for(const e in a(this,ze))a(this,ze)[e]=!1;E(this,xt,!1)},20));h(this,yr,()=>{E(this,Et,!0)});h(this,wr,()=>{E(this,Et,!1)});y(this,"props",{onfocuscapture:a(this,yr),onblurcapture:a(this,wr)});this.opts=e,E(this,ot,e.interactOutsideBehavior),E(this,_t,e.onInteractOutside),E(this,Rn,e.onFocusOutside),Ne(()=>{E(this,Ve,vo(this.opts.ref.current))});let t=Y;const n=()=>{a(this,Nn).call(this),globalThis.bitsDismissableLayers.delete(this),a(this,At).destroy(),t()};oe([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(!(!this.opts.enabled.current||!this.opts.ref.current))return bc(1,()=>{this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,a(this,ot)),t(),t=N(this,Rt,Fo).call(this))}),n}),Nt(()=>{a(this,Nn).destroy(),globalThis.bitsDismissableLayers.delete(this),a(this,At).destroy(),a(this,Ie).call(this),t()})}static create(e){return new Ys(e)}};_t=new WeakMap,ot=new WeakMap,ze=new WeakMap,xt=new WeakMap,Et=new WeakMap,Ve=new WeakMap,Rn=new WeakMap,Ie=new WeakMap,fr=new WeakMap,Rt=new WeakSet,Fo=function(){return yt(Q(a(this,Ve),"pointerdown",yt(a(this,gr),a(this,vr)),{capture:!0}),Q(a(this,Ve),"pointerdown",yt(a(this,br),a(this,At))),Q(a(this,Ve),"focusin",a(this,fr)))},pr=new WeakMap,At=new WeakMap,gr=new WeakMap,br=new WeakMap,vr=new WeakMap,mr=new WeakMap,Nn=new WeakMap,Mo=function(){return Object.values(a(this,ze)).some(Boolean)},yr=new WeakMap,wr=new WeakMap;let vs=Ys;function kl(r=[...globalThis.bitsDismissableLayers]){return r.findLast(([e,{current:t}])=>t==="close"||t==="ignore")}function Rl(r){const e=[...globalThis.bitsDismissableLayers],t=kl(e);if(t)return t[0].opts.ref.current===r;const[n]=e[0];return n.opts.ref.current===r}function Nl(r,e){const t=r.target;if(!go(t))return!1;const n=!!t.closest(`[${_l}]`);if("button"in r&&r.button>0&&!n)return!1;if("button"in r&&r.button===0&&n)return!0;const s=!!e.closest(`[${xl}]`);return n&&s?!1:vo(t).documentElement.contains(t)&&!bo(e,t)&&Jc(r,e)}function Wi(r){const e=r.currentTarget,t=r.target;let n;r instanceof PointerEvent?n=new PointerEvent(r.type,r):n=new PointerEvent("pointerdown",r);let s=!1;return new Proxy(n,{get:(o,c)=>c==="currentTarget"?e:c==="target"?t:c==="preventDefault"?()=>{s=!0,typeof o.preventDefault=="function"&&o.preventDefault()}:c==="defaultPrevented"?s:c in o?o[c]:r[c]})}function Fl(r,e){G(e,!0);let t=_(e,"interactOutsideBehavior",3,"close"),n=_(e,"onInteractOutside",3,Y),s=_(e,"onFocusOutside",3,Y),i=_(e,"isValidEvent",3,()=>!1);const o=vs.create({id:x(()=>e.id),interactOutsideBehavior:x(()=>t()),onInteractOutside:x(()=>n()),enabled:x(()=>e.enabled),onFocusOutside:x(()=>s()),isValidEvent:x(()=>i()),ref:e.ref});var c=q(),l=L(c);V(l,()=>e.children??$,()=>({props:o.props})),O(r,c),H()}globalThis.bitsEscapeLayers??(globalThis.bitsEscapeLayers=new Map);var Sr,Cr;const Xs=class Xs{constructor(e){y(this,"opts");y(this,"domContext");h(this,Sr,()=>Q(this.domContext.getDocument(),"keydown",a(this,Cr),{passive:!1}));h(this,Cr,e=>{if(e.key!==Oc||!Ml(this))return;const t=new KeyboardEvent(e.type,e);e.preventDefault();const n=this.opts.escapeKeydownBehavior.current;n!=="close"&&n!=="defer-otherwise-close"||this.opts.onEscapeKeydown.current(t)});this.opts=e,this.domContext=new As(this.opts.ref);let t=Y;oe(()=>e.enabled.current,n=>(n&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),t=a(this,Sr).call(this)),()=>{t(),globalThis.bitsEscapeLayers.delete(this)}))}static create(e){return new Xs(e)}};Sr=new WeakMap,Cr=new WeakMap;let ms=Xs;function Ml(r){const e=[...globalThis.bitsEscapeLayers],t=e.findLast(([s,{current:i}])=>i==="close"||i==="ignore");if(t)return t[0]===r;const[n]=e[0];return n===r}function Ll(r,e){G(e,!0);let t=_(e,"escapeKeydownBehavior",3,"close"),n=_(e,"onEscapeKeydown",3,Y);ms.create({escapeKeydownBehavior:x(()=>t()),onEscapeKeydown:x(()=>n()),enabled:x(()=>e.enabled),ref:e.ref});var s=q(),i=L(s);V(i,()=>e.children??$),O(r,s),H()}var Pe,Fn,at;const Tr=class Tr{constructor(){h(this,Pe,Xa([]));h(this,Fn,new WeakMap);h(this,at,new WeakMap)}static getInstance(){return this.instance||(this.instance=new Tr),this.instance}register(e){const t=this.getActive();t&&t!==e&&t.pause();const n=document.activeElement;n&&n!==document.body&&a(this,at).set(e,n),a(this,Pe).current=a(this,Pe).current.filter(s=>s!==e),a(this,Pe).current.unshift(e)}unregister(e){a(this,Pe).current=a(this,Pe).current.filter(n=>n!==e);const t=this.getActive();t&&t.resume()}getActive(){return a(this,Pe).current[0]}setFocusMemory(e,t){a(this,Fn).set(e,t)}getFocusMemory(e){return a(this,Fn).get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,t){a(this,at).set(e,t)}getPreFocusMemory(e){return a(this,at).get(e)}clearPreFocusMemory(e){a(this,at).delete(e)}};Pe=new WeakMap,Fn=new WeakMap,at=new WeakMap,y(Tr,"instance");let ys=Tr;var Ge,re,ce,ct,He,X,Lo,Do,Uo,jo,Ss,er,Cs;const Qs=class Qs{constructor(e){h(this,X);h(this,Ge,!1);h(this,re,null);h(this,ce,ys.getInstance());h(this,ct,[]);h(this,He);E(this,He,e)}get paused(){return a(this,Ge)}pause(){E(this,Ge,!0)}resume(){E(this,Ge,!1)}mount(e){a(this,re)&&this.unmount(),E(this,re,e),a(this,ce).register(this),N(this,X,jo).call(this),N(this,X,Do).call(this)}unmount(){a(this,re)&&(N(this,X,Lo).call(this),N(this,X,Uo).call(this),a(this,ce).unregister(this),a(this,ce).clearPreFocusMemory(this),E(this,re,null))}static use(e){let t=null;return oe([()=>e.ref.current,()=>e.enabled.current],([n,s])=>{n&&s?(t||(t=new Qs(e)),t.mount(n)):t&&(t.unmount(),t=null)}),Nt(()=>{t==null||t.unmount()}),{get props(){return{tabindex:-1}}}}};Ge=new WeakMap,re=new WeakMap,ce=new WeakMap,ct=new WeakMap,He=new WeakMap,X=new WeakSet,Lo=function(){for(const e of a(this,ct))e();E(this,ct,[])},Do=function(){if(!a(this,re))return;const e=new CustomEvent("focusScope.onOpenAutoFocus",{bubbles:!1,cancelable:!0});a(this,He).onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!a(this,re))return;const t=N(this,X,er).call(this);t?(t.focus(),a(this,ce).setFocusMemory(this,t)):a(this,re).focus()})},Uo=function(){var t,n;const e=new CustomEvent("focusScope.onCloseAutoFocus",{bubbles:!1,cancelable:!0});if((n=(t=a(this,He).onCloseAutoFocus).current)==null||n.call(t,e),!e.defaultPrevented){const s=a(this,ce).getPreFocusMemory(this);if(s&&document.contains(s))try{s.focus()}catch{document.body.focus()}}},jo=function(){if(!a(this,re)||!a(this,He).trap.current)return;const e=a(this,re),t=e.ownerDocument,n=o=>{if(a(this,Ge)||!a(this,ce).isActiveScope(this))return;const c=o.target;if(!c)return;if(e.contains(c))a(this,ce).setFocusMemory(this,c);else{const d=a(this,ce).getFocusMemory(this);if(d&&e.contains(d)&&Ao(d))o.preventDefault(),d.focus();else{const b=N(this,X,er).call(this),f=N(this,X,Cs).call(this)[0];(b||f||e).focus()}}},s=o=>{if(!a(this,He).loop||a(this,Ge)||o.key!=="Tab"||!a(this,ce).isActiveScope(this))return;const c=N(this,X,Ss).call(this);if(c.length===0)return;const l=c[0],d=c[c.length-1];!o.shiftKey&&t.activeElement===d?(o.preventDefault(),l.focus()):o.shiftKey&&t.activeElement===l&&(o.preventDefault(),d.focus())};a(this,ct).push(Q(t,"focusin",n,{capture:!0}),Q(e,"keydown",s));const i=new MutationObserver(()=>{const o=a(this,ce).getFocusMemory(this);if(o&&!e.contains(o)){const c=N(this,X,er).call(this),l=N(this,X,Cs).call(this)[0],d=c||l;d?(d.focus(),a(this,ce).setFocusMemory(this,d)):e.focus()}});i.observe(e,{childList:!0,subtree:!0}),a(this,ct).push(()=>i.disconnect())},Ss=function(){return a(this,re)?xo(a(this,re),{includeContainer:!1,getShadowRoot:!0}):[]},er=function(){return N(this,X,Ss).call(this)[0]||null},Cs=function(){return a(this,re)?Eo(a(this,re),{includeContainer:!1,getShadowRoot:!0}):[]};let ws=Qs;function Dl(r,e){G(e,!0);let t=_(e,"enabled",3,!1),n=_(e,"trapFocus",3,!1),s=_(e,"loop",3,!1),i=_(e,"onCloseAutoFocus",3,Y),o=_(e,"onOpenAutoFocus",3,Y);const c=ws.use({enabled:x(()=>t()),trap:x(()=>n()),loop:s(),onCloseAutoFocus:x(()=>i()),onOpenAutoFocus:x(()=>o()),ref:e.ref});var l=q(),d=L(l);V(d,()=>e.focusScope??$,()=>({props:c.props})),O(r,l),H()}globalThis.bitsTextSelectionLayers??(globalThis.bitsTextSelectionLayers=new Map);var It,Or,qo,_r,Mn;const Zs=class Zs{constructor(e){h(this,Or);y(this,"opts");y(this,"domContext");h(this,It,Y);h(this,_r,e=>{const t=this.opts.ref.current,n=e.target;!Fe(t)||!Fe(n)||!this.opts.enabled.current||!jl(this)||!Cc(t,n)||(this.opts.onPointerDown.current(e),!e.defaultPrevented&&E(this,It,Ul(t,this.domContext.getDocument().body)))});h(this,Mn,()=>{a(this,It).call(this),E(this,It,Y)});this.opts=e,this.domContext=new As(e.ref);let t=Y;oe(()=>this.opts.enabled.current,n=>(n&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),t(),t=N(this,Or,qo).call(this)),()=>{t(),a(this,Mn).call(this),globalThis.bitsTextSelectionLayers.delete(this)}))}static create(e){return new Zs(e)}};It=new WeakMap,Or=new WeakSet,qo=function(){return yt(Q(this.domContext.getDocument(),"pointerdown",a(this,_r)),Q(this.domContext.getDocument(),"pointerup",Qa(a(this,Mn),this.opts.onPointerUp.current)))},_r=new WeakMap,Mn=new WeakMap;let Ts=Zs;const zi=r=>r.style.userSelect||r.style.webkitUserSelect;function Ul(r,e){const t=zi(e),n=zi(r);return Jn(e,"none"),Jn(r,"text"),()=>{Jn(e,t),Jn(r,n)}}function Jn(r,e){r.style.userSelect=e,r.style.webkitUserSelect=e}function jl(r){const e=[...globalThis.bitsTextSelectionLayers];if(!e.length)return!1;const t=e.at(-1);return t?t[0]===r:!1}function ql(r,e){G(e,!0);let t=_(e,"preventOverflowTextSelection",3,!0),n=_(e,"onPointerDown",3,Y),s=_(e,"onPointerUp",3,Y);Ts.create({id:x(()=>e.id),onPointerDown:x(()=>n()),onPointerUp:x(()=>s()),enabled:x(()=>e.enabled&&t()),ref:e.ref});var i=q(),o=L(i);V(o,()=>e.children??$),O(r,i),H()}globalThis.bitsIdCounter??(globalThis.bitsIdCounter={current:0});function Bl(r="bits"){return globalThis.bitsIdCounter.current++,`${r}-${globalThis.bitsIdCounter.current}`}var Ln,Pt,lt,ut,xr,Bo;class Kl{constructor(e){h(this,xr);h(this,Ln);h(this,Pt,0);h(this,lt,U());h(this,ut);E(this,Ln,e)}get(...e){return E(this,Pt,a(this,Pt)+1),u(a(this,lt))===void 0&&E(this,ut,ro(()=>{T(a(this,lt),a(this,Ln).call(this,...e),!0)})),Ne(()=>()=>{N(this,xr,Bo).call(this)}),u(a(this,lt))}}Ln=new WeakMap,Pt=new WeakMap,lt=new WeakMap,ut=new WeakMap,xr=new WeakSet,Bo=function(){E(this,Pt,a(this,Pt)-1),a(this,ut)&&a(this,Pt)<=0&&(a(this,ut).call(this),T(a(this,lt),void 0),E(this,ut,void 0))};const tr=new ns;let Yn=U(null),nt=null,Ut=null,jt=!1;const Vi=x(()=>{for(const r of tr.values())if(r)return!0;return!1});let Qr=null;const Wl=new Kl(()=>{function r(){document.body.setAttribute("style",u(Yn)??""),document.body.style.removeProperty("--scrollbar-width"),Ni&&(nt==null||nt()),T(Yn,null)}function e(){Ut!==null&&(window.clearTimeout(Ut),Ut=null)}function t(s,i){e(),jt=!0,Qr=Date.now();const o=Qr,c=()=>{Ut=null,Qr===o&&(Ko(tr)?jt=!1:(jt=!1,i()))},l=s===null?24:s;Ut=window.setTimeout(c,l)}function n(){u(Yn)===null&&tr.size===0&&!jt&&T(Yn,document.body.getAttribute("style"),!0)}return oe(()=>Vi.current,()=>{var b,f;if(!Vi.current)return;n(),jt=!1;const s=getComputedStyle(document.documentElement),i=getComputedStyle(document.body),o=((b=s.scrollbarGutter)==null?void 0:b.includes("stable"))||((f=i.scrollbarGutter)==null?void 0:f.includes("stable")),c=window.innerWidth-document.documentElement.clientWidth,d={padding:Number.parseInt(i.paddingRight??"0",10)+c,margin:Number.parseInt(i.marginRight??"0",10)};c>0&&!o&&(document.body.style.paddingRight=`${d.padding}px`,document.body.style.marginRight=`${d.margin}px`,document.body.style.setProperty("--scrollbar-width",`${c}px`)),document.body.style.overflow="hidden",Ni&&(nt=Q(document,"touchmove",v=>{v.target===document.documentElement&&(v.touches.length>1||v.preventDefault())},{passive:!1})),ke(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})}),Nt(()=>()=>{nt==null||nt()}),{get lockMap(){return tr},resetBodyStyle:r,scheduleCleanupIfNoNewLocks:t,cancelPendingCleanup:e,ensureInitialStyleCaptured:n}});var dt,Dn,Un,le;class zl{constructor(e,t=()=>null){h(this,dt,Bl());h(this,Dn);h(this,Un,()=>null);h(this,le);y(this,"locked");E(this,Dn,e),E(this,Un,t),E(this,le,Wl.get()),a(this,le)&&(a(this,le).cancelPendingCleanup(),a(this,le).ensureInitialStyleCaptured(),a(this,le).lockMap.set(a(this,dt),a(this,Dn)??!1),this.locked=x(()=>a(this,le).lockMap.get(a(this,dt))??!1,n=>a(this,le).lockMap.set(a(this,dt),n)),Nt(()=>{if(a(this,le).lockMap.delete(a(this,dt)),Ko(a(this,le).lockMap))return;const n=a(this,Un).call(this);a(this,le).scheduleCleanupIfNoNewLocks(n,()=>{a(this,le).resetBodyStyle()})}))}}dt=new WeakMap,Dn=new WeakMap,Un=new WeakMap,le=new WeakMap;function Ko(r){for(const[e,t]of r)if(t)return!0;return!1}function Gi(r,e){G(e,!0);let t=_(e,"preventScroll",3,!0),n=_(e,"restoreScrollDelay",3,null);t()&&new zl(t(),()=>n()),H()}var Vl=J("<div><!></div>");function Gl(r,e){const t=jn();G(e,!0);let n=_(e,"id",19,()=>Bn(t)),s=_(e,"forceMount",3,!1),i=_(e,"ref",15,null),o=ae(e,["$$slots","$$events","$$legacy","id","forceMount","child","children","ref"]);const c=hs.create({id:x(()=>n()),ref:x(()=>i(),v=>i(v))}),l=A(()=>Te(o,c.props));var d=q(),b=L(d);{var f=v=>{var m=q(),p=L(m);{var S=M=>{var R=q(),D=L(R);{let k=A(()=>({props:Te(u(l)),...c.snippetProps}));V(D,()=>e.child,()=>u(k))}O(M,R)},B=M=>{var R=Vl();Qe(R,k=>({...k}),[()=>Te(u(l))]);var D=I(R);V(D,()=>e.children??$,()=>c.snippetProps),P(R),O(M,R)};se(p,M=>{e.child?M(S):M(B,!1)})}O(v,m)};se(b,v=>{(c.shouldRender||s())&&v(f)})}O(r,d),H()}var Hl=J("<div><!></div>");function Jl(r,e){const t=jn();G(e,!0);let n=_(e,"id",19,()=>Bn(t)),s=_(e,"ref",15,null),i=ae(e,["$$slots","$$events","$$legacy","id","children","child","ref"]);const o=us.create({id:x(()=>n()),ref:x(()=>s(),v=>s(v))}),c=A(()=>Te(i,o.props));var l=q(),d=L(l);{var b=v=>{var m=q(),p=L(m);V(p,()=>e.child,()=>({props:u(c)})),O(v,m)},f=v=>{var m=Hl();Qe(m,()=>({...u(c)}));var p=I(m);V(p,()=>e.children??$),P(m),O(v,m)};se(d,v=>{e.child?v(b):v(f,!1)})}O(r,l),H()}function Yl(r,e){G(e,!0);let t=_(e,"open",15,!1),n=_(e,"onOpenChange",3,Y),s=_(e,"onOpenChangeComplete",3,Y);as.create({variant:x(()=>"dialog"),open:x(()=>t(),c=>{t(c),n()(c)}),onOpenChangeComplete:x(()=>s())});var i=q(),o=L(i);V(o,()=>e.children??$),O(r,i),H()}var Xl=J("<button><!></button>");function Ql(r,e){const t=jn();G(e,!0);let n=_(e,"id",19,()=>Bn(t)),s=_(e,"ref",15,null),i=_(e,"disabled",3,!1),o=ae(e,["$$slots","$$events","$$legacy","children","child","id","ref","disabled"]);const c=cs.create({variant:x(()=>"close"),id:x(()=>n()),ref:x(()=>s(),m=>s(m)),disabled:x(()=>!!i())}),l=A(()=>Te(o,c.props));var d=q(),b=L(d);{var f=m=>{var p=q(),S=L(p);V(S,()=>e.child,()=>({props:u(l)})),O(m,p)},v=m=>{var p=Xl();Qe(p,()=>({...u(l)}));var S=I(p);V(S,()=>e.children??$),P(p),O(m,p)};se(b,m=>{e.child?m(f):m(v,!1)})}O(r,d),H()}var Zl=J("<!> <!>",1),$l=J("<!> <div><!></div>",1);function eu(r,e){const t=jn();G(e,!0);let n=_(e,"id",19,()=>Bn(t)),s=_(e,"ref",15,null),i=_(e,"forceMount",3,!1),o=_(e,"onCloseAutoFocus",3,Y),c=_(e,"onOpenAutoFocus",3,Y),l=_(e,"onEscapeKeydown",3,Y),d=_(e,"onInteractOutside",3,Y),b=_(e,"trapFocus",3,!0),f=_(e,"preventScroll",3,!0),v=_(e,"restoreScrollDelay",3,null),m=ae(e,["$$slots","$$events","$$legacy","id","children","child","ref","forceMount","onCloseAutoFocus","onOpenAutoFocus","onEscapeKeydown","onInteractOutside","trapFocus","preventScroll","restoreScrollDelay"]);const p=ds.create({id:x(()=>n()),ref:x(()=>s(),D=>s(D))}),S=A(()=>Te(m,p.props));var B=q(),M=L(B);{var R=D=>{Dl(D,{get ref(){return p.opts.ref},loop:!0,get trapFocus(){return b()},get enabled(){return p.root.opts.open.current},get onOpenAutoFocus(){return c()},get onCloseAutoFocus(){return o()},focusScope:(z,j)=>{let W=()=>j==null?void 0:j().props;Ll(z,he(()=>u(S),{get enabled(){return p.root.opts.open.current},get ref(){return p.opts.ref},onEscapeKeydown:K=>{l()(K),!K.defaultPrevented&&p.root.handleClose()},children:(K,ue)=>{Fl(K,he(()=>u(S),{get ref(){return p.opts.ref},get enabled(){return p.root.opts.open.current},onInteractOutside:fe=>{d()(fe),!fe.defaultPrevented&&p.root.handleClose()},children:(fe,zn)=>{ql(fe,he(()=>u(S),{get ref(){return p.opts.ref},get enabled(){return p.root.opts.open.current},children:(Ir,Pr)=>{var Le=q(),Vn=L(Le);{var kr=be=>{var De=Zl(),et=L(De);{var Ue=ve=>{Gi(ve,{get preventScroll(){return f()},get restoreScrollDelay(){return v()}})};se(et,ve=>{p.root.opts.open.current&&ve(Ue)})}var gt=F(et,2);{let ve=A(()=>({props:Te(u(S),W()),...p.snippetProps}));V(gt,()=>e.child,()=>u(ve))}O(be,De)},Ft=be=>{var De=$l(),et=L(De);Gi(et,{get preventScroll(){return f()}});var Ue=F(et,2);Qe(Ue,ve=>({...ve}),[()=>Te(u(S),W())]);var gt=I(Ue);V(gt,()=>e.children??$),P(Ue),O(be,De)};se(Vn,be=>{e.child?be(kr):be(Ft,!1)})}O(Ir,Le)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};se(M,D=>{(p.shouldRender||i())&&D(R)})}O(r,B),H()}function sd(r,e){G(e,!0);let t=_(e,"open",15,!1),n=ae(e,["$$slots","$$events","$$legacy","open"]);var s=q(),i=L(s);Ye(i,()=>Yl,(o,c)=>{c(o,he(()=>n,{get open(){return t()},set open(l){t(l)}}))}),O(r,s),H()}function tu(r,e){let t=ae(e,["$$slots","$$events","$$legacy"]);var n=q(),s=L(n);Ye(s,()=>Gc,(i,o)=>{o(i,he(()=>t))}),O(r,n)}function id(r,e){G(e,!0);let t=_(e,"ref",15,null),n=ae(e,["$$slots","$$events","$$legacy","ref","class"]);var s=q(),i=L(s);{let o=A(()=>qn("text-lg leading-none font-semibold",e.class));Ye(i,()=>Uc,(c,l)=>{l(c,he({"data-slot":"dialog-title",get class(){return u(o)}},()=>n,{get ref(){return t()},set ref(d){t(d)}}))})}O(r,s),H()}var nu=J("<div><!></div>");function od(r,e){G(e,!0);let t=_(e,"ref",15,null),n=ae(e,["$$slots","$$events","$$legacy","ref","class","children"]);var s=nu();Qe(s,o=>({"data-slot":"dialog-header",class:o,...n}),[()=>qn("flex flex-col gap-2 text-center sm:text-start",e.class)]);var i=I(s);V(i,()=>e.children??$),P(s),so(s,o=>t(o),()=>t()),O(r,s),H()}function ru(r,e){G(e,!0);let t=_(e,"ref",15,null),n=ae(e,["$$slots","$$events","$$legacy","ref","class"]);var s=q(),i=L(s);{let o=A(()=>qn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e.class));Ye(i,()=>Gl,(c,l)=>{l(c,he({"data-slot":"dialog-overlay",get class(){return u(o)}},()=>n,{get ref(){return t()},set ref(d){t(d)}}))})}O(r,s),H()}/**
* @license @lucide/svelte v0.561.0 - ISC
*
* ISC License
*
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2025.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* ---
*
* The MIT License (MIT) (for portions derived from Feather)
*
* Copyright (c) 2013-2023 Cole Bemis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/const su={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var iu=qa("<svg><!><!></svg>");function Wo(r,e){G(e,!0);const t=_(e,"color",3,"currentColor"),n=_(e,"size",3,24),s=_(e,"strokeWidth",3,2),i=_(e,"absoluteStrokeWidth",3,!1),o=_(e,"iconNode",19,()=>[]),c=ae(e,["$$slots","$$events","$$legacy","name","color","size","strokeWidth","absoluteStrokeWidth","iconNode","children"]);var l=iu();Qe(l,f=>({...su,...c,width:n(),height:n(),stroke:t(),"stroke-width":f,class:["lucide-icon lucide",e.name&&`lucide-${e.name}`,e.class]}),[()=>i()?Number(s())*24/Number(n()):s()]);var d=I(l);Bt(d,17,o,qt,(f,v)=>{var m=A(()=>Ba(u(v),2));let p=()=>u(m)[0],S=()=>u(m)[1];var B=q(),M=L(B);ic(M,p,!0,(R,D)=>{Qe(R,()=>({...S()}))}),O(f,B)});var b=F(d);V(b,()=>e.children??$),P(l),O(r,l),H()}function zo(r,e){G(e,!0);/**
* @license @lucide/svelte v0.561.0 - ISC
*
* ISC License
*
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2025.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* ---
*
* The MIT License (MIT) (for portions derived from Feather)
*
* Copyright (c) 2013-2023 Cole Bemis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/let t=ae(e,["$$slots","$$events","$$legacy"]);const n=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];Wo(r,he({name:"x"},()=>t,{get iconNode(){return n},children:(s,i)=>{var o=q(),c=L(o);V(c,()=>e.children??$),O(s,o)},$$slots:{default:!0}})),H()}var ou=J('<!> <span class="sr-only">Close</span>',1),au=J("<!> <!>",1),cu=J("<!> <!>",1);function ad(r,e){G(e,!0);let t=_(e,"ref",15,null),n=_(e,"showCloseButton",3,!0),s=ae(e,["$$slots","$$events","$$legacy","ref","class","portalProps","children","showCloseButton"]);tu(r,he(()=>e.portalProps,{children:(i,o)=>{var c=cu(),l=L(c);Ye(l,()=>ru,(b,f)=>{f(b,{})});var d=F(l,2);{let b=A(()=>qn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e.class));Ye(d,()=>eu,(f,v)=>{v(f,he({"data-slot":"dialog-content",get class(){return u(b)}},()=>s,{get ref(){return t()},set ref(m){t(m)},children:(m,p)=>{var S=au(),B=L(S);V(B,()=>e.children??$);var M=F(B,2);{var R=D=>{var k=q(),z=L(k);Ye(z,()=>Ql,(j,W)=>{W(j,{class:"ring-offset-background focus:ring-ring absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:(K,ue)=>{var fe=ou(),zn=L(fe);zo(zn,{}),te(2),O(K,fe)},$$slots:{default:!0}})}),O(D,k)};se(M,D=>{n()&&D(R)})}O(m,S)},$$slots:{default:!0}}))})}O(i,c)},$$slots:{default:!0}})),H()}function cd(r,e){G(e,!0);let t=_(e,"ref",15,null),n=ae(e,["$$slots","$$events","$$legacy","ref","class"]);var s=q(),i=L(s);{let o=A(()=>qn("text-muted-foreground text-sm",e.class));Ye(i,()=>Jl,(c,l)=>{l(c,he({"data-slot":"dialog-description",get class(){return u(o)}},()=>n,{get ref(){return t()},set ref(d){t(d)}}))})}O(r,s),H()}function lu(r,e){G(e,!0);/**
* @license @lucide/svelte v0.561.0 - ISC
*
* ISC License
*
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2025.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* ---
*
* The MIT License (MIT) (for portions derived from Feather)
*
* Copyright (c) 2013-2023 Cole Bemis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/let t=ae(e,["$$slots","$$events","$$legacy"]);const n=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];Wo(r,he({name:"camera"},()=>t,{get iconNode(){return n},children:(s,i)=>{var o=q(),c=L(o);V(c,()=>e.children??$),O(s,o)},$$slots:{default:!0}})),H()}class ie extends Error{constructor(e){var t,n,s,i;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,ie.prototype),e!==null&&typeof e=="object"&&(this.originalError=e.originalError,this.url=typeof e.url=="string"?e.url:"",this.status=typeof e.status=="number"?e.status:0,this.isAbort=!!e.isAbort||e.name==="AbortError"||e.message==="Aborted",e.response!==null&&typeof e.response=="object"?this.response=e.response:e.data!==null&&typeof e.data=="object"?this.response=e.data:this.response={}),this.originalError||e instanceof ie||(this.originalError=e),this.name="ClientResponseError "+this.status,this.message=(t=this.response)==null?void 0:t.message,this.message||(this.isAbort?this.message="The request was aborted (most likely autocancelled; you can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation).":(i=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&i.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong."),this.cause=this.originalError}get data(){return this.response}toJSON(){return{...this}}}const Xn=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function uu(r,e){const t={};if(typeof r!="string")return t;const n=Object.assign({},{}).decode||du;let s=0;for(;s<r.length;){const i=r.indexOf("=",s);if(i===-1)break;let o=r.indexOf(";",s);if(o===-1)o=r.length;else if(o<i){s=r.lastIndexOf(";",i-1)+1;continue}const c=r.slice(s,i).trim();if(t[c]===void 0){let l=r.slice(i+1,o).trim();l.charCodeAt(0)===34&&(l=l.slice(1,-1));try{t[c]=n(l)}catch{t[c]=l}}s=o+1}return t}function Hi(r,e,t){const n=Object.assign({},t||{}),s=n.encode||hu;if(!Xn.test(r))throw new TypeError("argument name is invalid");const i=s(e);if(i&&!Xn.test(i))throw new TypeError("argument val is invalid");let o=r+"="+i;if(n.maxAge!=null){const c=n.maxAge-0;if(isNaN(c)||!isFinite(c))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(c)}if(n.domain){if(!Xn.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!Xn.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(!(function(l){return Object.prototype.toString.call(l)==="[object Date]"||l instanceof Date})(n.expires)||isNaN(n.expires.valueOf()))throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():n.priority){case"low":o+="; Priority=Low";break;case"medium":o+="; Priority=Medium";break;case"high":o+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o}function du(r){return r.indexOf("%")!==-1?decodeURIComponent(r):r}function hu(r){return encodeURIComponent(r)}const fu=typeof navigator<"u"&&navigator.product==="ReactNative"||typeof global<"u"&&global.HermesInternal;let Vo;function wt(r){if(r)try{const e=decodeURIComponent(Vo(r.split(".")[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(e)||{}}catch{}return{}}function Go(r,e=0){let t=wt(r);return!(Object.keys(t).length>0&&(!t.exp||t.exp-e>Date.now()/1e3))}Vo=typeof atob!="function"||fu?r=>{let e=String(r).replace(/=+$/,"");if(e.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,n,s=0,i=0,o="";n=e.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?o+=String.fromCharCode(255&t>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o}:atob;const Ji="pb_auth";class Fs{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get record(){return this.baseModel}get model(){return this.baseModel}get isValid(){return!Go(this.token)}get isSuperuser(){var t,n;let e=wt(this.token);return e.type=="auth"&&(((t=this.record)==null?void 0:t.collectionName)=="_superusers"||!((n=this.record)!=null&&n.collectionName)&&e.collectionId=="pbc_3142635823")}get isAdmin(){return console.warn("Please replace pb.authStore.isAdmin with pb.authStore.isSuperuser OR simply check the value of pb.authStore.record?.collectionName"),this.isSuperuser}get isAuthRecord(){return console.warn("Please replace pb.authStore.isAuthRecord with !pb.authStore.isSuperuser OR simply check the value of pb.authStore.record?.collectionName"),wt(this.token).type=="auth"&&!this.isSuperuser}save(e,t){this.baseToken=e||"",this.baseModel=t||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(e,t=Ji){const n=uu(e||"")[t]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.record||s.model||null)}exportToCookie(e,t=Ji){var l,d;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=wt(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),e=Object.assign({},n,e);const i={token:this.token,record:this.record?JSON.parse(JSON.stringify(this.record)):null};let o=Hi(t,JSON.stringify(i),e);const c=typeof Blob<"u"?new Blob([o]).size:o.length;if(i.record&&c>4096){i.record={id:(l=i.record)==null?void 0:l.id,email:(d=i.record)==null?void 0:d.email};const b=["collectionId","collectionName","verified"];for(const f in this.record)b.includes(f)&&(i.record[f]=this.record[f]);o=Hi(t,JSON.stringify(i),e)}return o}onChange(e,t=!1){return this._onChangeCallbacks.push(e),t&&e(this.token,this.record),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==e)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const e of this._onChangeCallbacks)e&&e(this.token,this.record)}}class pu extends Fs{constructor(e="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=e,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get record(){const e=this._storageGet(this.storageKey)||{};return e.record||e.model||null}get model(){return this.record}save(e,t){this._storageSet(this.storageKey,{token:e,record:t}),super.save(e,t)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(e){if(typeof window<"u"&&(window!=null&&window.localStorage)){const t=window.localStorage.getItem(e)||"";try{return JSON.parse(t)}catch{return t}}return this.storageFallback[e]}_storageSet(e,t){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=t;typeof t!="string"&&(n=JSON.stringify(t)),window.localStorage.setItem(e,n)}else this.storageFallback[e]=t}_storageRemove(e){var t;typeof window<"u"&&(window!=null&&window.localStorage)&&((t=window.localStorage)==null||t.removeItem(e)),delete this.storageFallback[e]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",(e=>{if(e.key!=this.storageKey)return;const t=this._storageGet(this.storageKey)||{};super.save(t.token||"",t.record||t.model||null)}))}}class Me{constructor(e){this.client=e}}class gu extends Me{async getAll(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/settings",e)}async update(e,t){return t=Object.assign({method:"PATCH",body:e},t),this.client.send("/api/settings",t)}async testS3(e="storage",t){return t=Object.assign({method:"POST",body:{filesystem:e}},t),this.client.send("/api/settings/test/s3",t).then((()=>!0))}async testEmail(e,t,n,s){return s=Object.assign({method:"POST",body:{email:t,template:n,collection:e}},s),this.client.send("/api/settings/test/email",s).then((()=>!0))}async generateAppleClientSecret(e,t,n,s,i,o){return o=Object.assign({method:"POST",body:{clientId:e,teamId:t,keyId:n,privateKey:s,duration:i}},o),this.client.send("/api/settings/apple/generate-client-secret",o)}}const bu=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function Ms(r){if(r){r.query=r.query||{};for(let e in r)bu.includes(e)||(r.query[e]=r[e],delete r[e])}}function Ls(r){const e=[];for(const t in r){const n=encodeURIComponent(t),s=Array.isArray(r[t])?r[t]:[r[t]];for(let i of s)i=vu(i),i!==null&&e.push(n+"="+i)}return e.join("&")}function vu(r){return r==null?null:r instanceof Date?encodeURIComponent(r.toISOString().replace("T"," ")):encodeURIComponent(typeof r=="object"?JSON.stringify(r):r)}class Ho extends Me{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(e,t,n){var o;if(!e)throw new Error("topic must be set.");let s=e;if(n){Ms(n=Object.assign({},n));const c="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+c}const i=function(c){const l=c;let d;try{d=JSON.parse(l==null?void 0:l.data)}catch{}t(d||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(i),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(o=this.eventSource)==null||o.addEventListener(s,i):await this.connect(),async()=>this.unsubscribeByTopicAndListener(e,i)}async unsubscribe(e){var n;let t=!1;if(e){const s=this.getSubscriptionsByTopic(e);for(let i in s)if(this.hasSubscriptionListeners(i)){for(let o of this.subscriptions[i])(n=this.eventSource)==null||n.removeEventListener(i,o);delete this.subscriptions[i],t||(t=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?t&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(e){var n;let t=!1;for(let s in this.subscriptions)if((s+"?").startsWith(e)){t=!0;for(let i of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,i);delete this.subscriptions[s]}t&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(e,t){var i;let n=!1;const s=this.getSubscriptionsByTopic(e);for(let o in s){if(!Array.isArray(this.subscriptions[o])||!this.subscriptions[o].length)continue;let c=!1;for(let l=this.subscriptions[o].length-1;l>=0;l--)this.subscriptions[o][l]===t&&(c=!0,delete this.subscriptions[o][l],this.subscriptions[o].splice(l,1),(i=this.eventSource)==null||i.removeEventListener(o,t));c&&(this.subscriptions[o].length||delete this.subscriptions[o],n||this.hasSubscriptionListeners(o)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!((t=this.subscriptions[e])!=null&&t.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch((e=>{if(!(e!=null&&e.isAbort))throw e}))}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(e){const t={};e=e.includes("?")?e:e+"?";for(let n in this.subscriptions)(n+"?").startsWith(e)&&(t[n]=this.subscriptions[n]);return t}getNonEmptySubscriptionKeys(){const e=[];for(let t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.addEventListener(e,t)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.removeEventListener(e,t)}async connect(){if(!(this.reconnectAttempts>0))return new Promise(((e,t)=>{this.pendingConnects.push({resolve:e,reject:t}),this.pendingConnects.length>1||this.initConnect()}))}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildURL("/api/realtime")),this.eventSource.onerror=e=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(e=>{const t=e;this.clientId=t==null?void 0:t.lastEventId,this.submitSubscriptions().then((async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()})).then((()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let i of n[s])i(e)})).catch((n=>{this.clientId="",this.connectErrorHandler(n)}))}))}hasUnsentSubscriptions(){const e=this.getNonEmptySubscriptionKeys();if(e.length!=this.lastSentSubscriptions.length)return!0;for(const t of e)if(!this.lastSentSubscriptions.includes(t))return!0;return!1}connectErrorHandler(e){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new ie(e));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const t=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout((()=>{this.initConnect()}),t)}disconnect(e=!1){var t;if(this.clientId&&this.onDisconnect&&this.onDisconnect(Object.keys(this.subscriptions)),clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(t=this.eventSource)==null||t.close(),this.eventSource=null,this.clientId="",!e){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class Jo extends Me{decode(e){return e}async getFullList(e,t){if(typeof e=="number")return this._getFullList(e,t);let n=1e3;return(t=Object.assign({},e,t)).batch&&(n=t.batch,delete t.batch),this._getFullList(n,t)}async getList(e=1,t=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:e,perPage:t},n.query),this.client.send(this.baseCrudPath,n).then((s=>{var i;return s.items=((i=s.items)==null?void 0:i.map((o=>this.decode(o))))||[],s}))}async getFirstListItem(e,t){return(t=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+e},t)).query=Object.assign({filter:e,skipTotal:1},t.query),this.getList(1,1,t).then((n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new ie({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]}))}async getOne(e,t){if(!e)throw new ie({url:this.client.buildURL(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then((n=>this.decode(n)))}async create(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send(this.baseCrudPath,t).then((n=>this.decode(n)))}async update(e,t,n){return n=Object.assign({method:"PATCH",body:t},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),n).then((s=>this.decode(s)))}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then((()=>!0))}_getFullList(e=1e3,t){(t=t||{}).query=Object.assign({skipTotal:1},t.query);let n=[],s=async i=>this.getList(i,e||1e3,t).then((o=>{const c=o.items;return n=n.concat(c),c.length==o.perPage?s(i+1):n}));return s(1)}}function Ke(r,e,t,n){const s=n!==void 0;return s||t!==void 0?s?(console.warn(r),e.body=Object.assign({},e.body,t),e.query=Object.assign({},e.query,n),e):Object.assign(e,t):e}function Zr(r){var e;(e=r._resetAutoRefresh)==null||e.call(r)}class mu extends Jo{constructor(e,t){super(e),this.collectionIdOrName=t}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}get isSuperusers(){return this.collectionIdOrName=="_superusers"||this.collectionIdOrName=="_pbc_2773867675"}async subscribe(e,t,n){if(!e)throw new Error("Missing topic.");if(!t)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+e,t,n)}async unsubscribe(e){return e?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+e):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(e,t){if(typeof e=="number")return super.getFullList(e,t);const n=Object.assign({},e,t);return super.getFullList(n)}async getList(e=1,t=30,n){return super.getList(e,t,n)}async getFirstListItem(e,t){return super.getFirstListItem(e,t)}async getOne(e,t){return super.getOne(e,t)}async create(e,t){return super.create(e,t)}async update(e,t,n){return super.update(e,t,n).then((s=>{var i,o,c;if(((i=this.client.authStore.record)==null?void 0:i.id)===(s==null?void 0:s.id)&&(((o=this.client.authStore.record)==null?void 0:o.collectionId)===this.collectionIdOrName||((c=this.client.authStore.record)==null?void 0:c.collectionName)===this.collectionIdOrName)){let l=Object.assign({},this.client.authStore.record.expand),d=Object.assign({},this.client.authStore.record,s);l&&(d.expand=Object.assign(l,s.expand)),this.client.authStore.save(this.client.authStore.token,d)}return s}))}async delete(e,t){return super.delete(e,t).then((n=>{var s,i,o;return!n||((s=this.client.authStore.record)==null?void 0:s.id)!==e||((i=this.client.authStore.record)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((o=this.client.authStore.record)==null?void 0:o.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n}))}authResponse(e){const t=this.decode((e==null?void 0:e.record)||{});return this.client.authStore.save(e==null?void 0:e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",record:t})}async listAuthMethods(e){return e=Object.assign({method:"GET",fields:"mfa,otp,password,oauth2"},e),this.client.send(this.baseCollectionPath+"/auth-methods",e)}async authWithPassword(e,t,n){let s;n=Object.assign({method:"POST",body:{identity:e,password:t}},n),this.isSuperusers&&(s=n.autoRefreshThreshold,delete n.autoRefreshThreshold,n.autoRefresh||Zr(this.client));let i=await this.client.send(this.baseCollectionPath+"/auth-with-password",n);return i=this.authResponse(i),s&&this.isSuperusers&&(function(c,l,d,b){Zr(c);const f=c.beforeSend,v=c.authStore.record,m=c.authStore.onChange(((p,S)=>{(!p||(S==null?void 0:S.id)!=(v==null?void 0:v.id)||(S!=null&&S.collectionId||v!=null&&v.collectionId)&&(S==null?void 0:S.collectionId)!=(v==null?void 0:v.collectionId))&&Zr(c)}));c._resetAutoRefresh=function(){m(),c.beforeSend=f,delete c._resetAutoRefresh},c.beforeSend=async(p,S)=>{var D;const B=c.authStore.token;if((D=S.query)!=null&&D.autoRefresh)return f?f(p,S):{url:p,sendOptions:S};let M=c.authStore.isValid;if(M&&Go(c.authStore.token,l))try{await d()}catch{M=!1}M||await b();const R=S.headers||{};for(let k in R)if(k.toLowerCase()=="authorization"&&B==R[k]&&c.authStore.token){R[k]=c.authStore.token;break}return S.headers=R,f?f(p,S):{url:p,sendOptions:S}}})(this.client,s,(()=>this.authRefresh({autoRefresh:!0})),(()=>this.authWithPassword(e,t,Object.assign({autoRefresh:!0},n)))),i}async authWithOAuth2Code(e,t,n,s,i,o,c){let l={method:"POST",body:{provider:e,code:t,codeVerifier:n,redirectURL:s,createData:i}};return l=Ke("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectURL, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectURL, createData?, options?).",l,o,c),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",l).then((d=>this.authResponse(d)))}authWithOAuth2(...e){if(e.length>1||typeof(e==null?void 0:e[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((e==null?void 0:e[0])||"",(e==null?void 0:e[1])||"",(e==null?void 0:e[2])||"",(e==null?void 0:e[3])||"",(e==null?void 0:e[4])||{},(e==null?void 0:e[5])||{},(e==null?void 0:e[6])||{});const t=(e==null?void 0:e[0])||{};let n=null;t.urlCallback||(n=Yi(void 0));const s=new Ho(this.client);function i(){n==null||n.close(),s.unsubscribe()}const o={},c=t.requestKey;return c&&(o.requestKey=c),this.listAuthMethods(o).then((l=>{const d=l.oauth2.providers.find((f=>f.name===t.provider));if(!d)throw new ie(new Error(`Missing or invalid provider "${t.provider}".`));const b=this.client.buildURL("/api/oauth2-redirect");return new Promise((async(f,v)=>{var p,S,B;const m=c?(p=this.client.cancelControllers)==null?void 0:p[c]:void 0;m&&(m.signal.onabort=()=>{i(),v(new ie({isAbort:!0,message:"manually cancelled"}))}),s.onDisconnect=M=>{M.length&&v&&(i(),v(new ie(new Error("realtime connection interrupted"))))};try{await s.subscribe("@oauth2",(async k=>{var j;const z=s.clientId;try{if(!k.state||z!==k.state)throw new Error("State parameters don't match.");if(k.error||!k.code)throw new Error("OAuth2 redirect error or missing code: "+k.error);const W=Object.assign({},t);delete W.provider,delete W.scopes,delete W.createData,delete W.urlCallback,(j=m==null?void 0:m.signal)!=null&&j.onabort&&(m.signal.onabort=null);const K=await this.authWithOAuth2Code(d.name,k.code,d.codeVerifier,b,t.createData,W);f(K)}catch(W){v(new ie(W))}i()}));const M={state:s.clientId};(S=t.scopes)!=null&&S.length&&(M.scope=t.scopes.join(" "));const R=this._replaceQueryParams(d.authURL+b,M);await(t.urlCallback||function(k){n?n.location.href=k:n=Yi(k)})(R)}catch(M){(B=m==null?void 0:m.signal)!=null&&B.onabort&&(m.signal.onabort=null),i(),v(new ie(M))}}))})).catch((l=>{throw i(),l}))}async authRefresh(e,t){let n={method:"POST"};return n=Ke("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,e,t),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then((s=>this.authResponse(s)))}async requestPasswordReset(e,t,n){let s={method:"POST",body:{email:e}};return s=Ke("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,t,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then((()=>!0))}async confirmPasswordReset(e,t,n,s,i){let o={method:"POST",body:{token:e,password:t,passwordConfirm:n}};return o=Ke("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",o,s,i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",o).then((()=>!0))}async requestVerification(e,t,n){let s={method:"POST",body:{email:e}};return s=Ke("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,t,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then((()=>!0))}async confirmVerification(e,t,n){let s={method:"POST",body:{token:e}};return s=Ke("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,t,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then((()=>{const i=wt(e),o=this.client.authStore.record;return o&&!o.verified&&o.id===i.id&&o.collectionId===i.collectionId&&(o.verified=!0,this.client.authStore.save(this.client.authStore.token,o)),!0}))}async requestEmailChange(e,t,n){let s={method:"POST",body:{newEmail:e}};return s=Ke("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,t,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then((()=>!0))}async confirmEmailChange(e,t,n,s){let i={method:"POST",body:{token:e,password:t}};return i=Ke("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",i,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",i).then((()=>{const o=wt(e),c=this.client.authStore.record;return c&&c.id===o.id&&c.collectionId===o.collectionId&&this.client.authStore.clear(),!0}))}async listExternalAuths(e,t){return this.client.collection("_externalAuths").getFullList(Object.assign({},t,{filter:this.client.filter("recordRef = {:id}",{id:e})}))}async unlinkExternalAuth(e,t,n){const s=await this.client.collection("_externalAuths").getFirstListItem(this.client.filter("recordRef = {:recordId} && provider = {:provider}",{recordId:e,provider:t}));return this.client.collection("_externalAuths").delete(s.id,n).then((()=>!0))}async requestOTP(e,t){return t=Object.assign({method:"POST",body:{email:e}},t),this.client.send(this.baseCollectionPath+"/request-otp",t)}async authWithOTP(e,t,n){return n=Object.assign({method:"POST",body:{otpId:e,password:t}},n),this.client.send(this.baseCollectionPath+"/auth-with-otp",n).then((s=>this.authResponse(s)))}async impersonate(e,t,n){(n=Object.assign({method:"POST",body:{duration:t}},n)).headers=n.headers||{},n.headers.Authorization||(n.headers.Authorization=this.client.authStore.token);const s=new Yo(this.client.baseURL,new Fs,this.client.lang),i=await s.send(this.baseCollectionPath+"/impersonate/"+encodeURIComponent(e),n);return s.authStore.save(i==null?void 0:i.token,this.decode((i==null?void 0:i.record)||{})),s}_replaceQueryParams(e,t={}){let n=e,s="";e.indexOf("?")>=0&&(n=e.substring(0,e.indexOf("?")),s=e.substring(e.indexOf("?")+1));const i={},o=s.split("&");for(const c of o){if(c=="")continue;const l=c.split("=");i[decodeURIComponent(l[0].replace(/\+/g," "))]=decodeURIComponent((l[1]||"").replace(/\+/g," "))}for(let c in t)t.hasOwnProperty(c)&&(t[c]==null?delete i[c]:i[c]=t[c]);s="";for(let c in i)i.hasOwnProperty(c)&&(s!=""&&(s+="&"),s+=encodeURIComponent(c.replace(/%20/g,"+"))+"="+encodeURIComponent(i[c].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function Yi(r){if(typeof window>"u"||!(window!=null&&window.open))throw new ie(new Error("Not in a browser context - please pass a custom urlCallback function."));let e=1024,t=768,n=window.innerWidth,s=window.innerHeight;e=e>n?n:e,t=t>s?s:t;let i=n/2-e/2,o=s/2-t/2;return window.open(r,"popup_window","width="+e+",height="+t+",top="+o+",left="+i+",resizable,menubar=no")}class yu extends Jo{get baseCrudPath(){return"/api/collections"}async import(e,t=!1,n){return n=Object.assign({method:"PUT",body:{collections:e,deleteMissing:t}},n),this.client.send(this.baseCrudPath+"/import",n).then((()=>!0))}async getScaffolds(e){return e=Object.assign({method:"GET"},e),this.client.send(this.baseCrudPath+"/meta/scaffolds",e)}async truncate(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/truncate",t).then((()=>!0))}}class wu extends Me{async getList(e=1,t=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:e,perPage:t},n.query),this.client.send("/api/logs",n)}async getOne(e,t){if(!e)throw new ie({url:this.client.buildURL("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/"+encodeURIComponent(e),t)}async getStats(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/logs/stats",e)}}class Su extends Me{async check(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/health",e)}}class Cu extends Me{getUrl(e,t,n={}){return console.warn("Please replace pb.files.getUrl() with pb.files.getURL()"),this.getURL(e,t,n)}getURL(e,t,n={}){if(!t||!(e!=null&&e.id)||!(e!=null&&e.collectionId)&&!(e!=null&&e.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(e.collectionId||e.collectionName)),s.push(encodeURIComponent(e.id)),s.push(encodeURIComponent(t));let i=this.client.buildURL(s.join("/"));n.download===!1&&delete n.download;const o=Ls(n);return o&&(i+=(i.includes("?")?"&":"?")+o),i}async getToken(e){return e=Object.assign({method:"POST"},e),this.client.send("/api/files/token",e).then((t=>(t==null?void 0:t.token)||""))}}class Tu extends Me{async getFullList(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/backups",e)}async create(e,t){return t=Object.assign({method:"POST",body:{name:e}},t),this.client.send("/api/backups",t).then((()=>!0))}async upload(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send("/api/backups/upload",t).then((()=>!0))}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}`,t).then((()=>!0))}async restore(e,t){return t=Object.assign({method:"POST"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}/restore`,t).then((()=>!0))}getDownloadUrl(e,t){return console.warn("Please replace pb.backups.getDownloadUrl() with pb.backups.getDownloadURL()"),this.getDownloadURL(e,t)}getDownloadURL(e,t){return this.client.buildURL(`/api/backups/${encodeURIComponent(t)}?token=${encodeURIComponent(e)}`)}}class Ou extends Me{async getFullList(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/crons",e)}async run(e,t){return t=Object.assign({method:"POST"},t),this.client.send(`/api/crons/${encodeURIComponent(e)}`,t).then((()=>!0))}}function Os(r){return typeof Blob<"u"&&r instanceof Blob||typeof File<"u"&&r instanceof File||r!==null&&typeof r=="object"&&r.uri&&(typeof navigator<"u"&&navigator.product==="ReactNative"||typeof global<"u"&&global.HermesInternal)}function _s(r){var e;return r&&(((e=r.constructor)==null?void 0:e.name)==="FormData"||typeof FormData<"u"&&r instanceof FormData)}function Xi(r){for(const e in r){const t=Array.isArray(r[e])?r[e]:[r[e]];for(const n of t)if(Os(n))return!0}return!1}const _u=/^[\-\.\d]+$/;function Qi(r){if(typeof r!="string")return r;if(r=="true")return!0;if(r=="false")return!1;if((r[0]==="-"||r[0]>="0"&&r[0]<="9")&&_u.test(r)){let e=+r;if(""+e===r)return e}return r}class xu extends Me{constructor(){super(...arguments),this.requests=[],this.subs={}}collection(e){return this.subs[e]||(this.subs[e]=new Eu(this.requests,e)),this.subs[e]}async send(e){const t=new FormData,n=[];for(let s=0;s<this.requests.length;s++){const i=this.requests[s];if(n.push({method:i.method,url:i.url,headers:i.headers,body:i.json}),i.files)for(let o in i.files){const c=i.files[o]||[];for(let l of c)t.append("requests."+s+"."+o,l)}}return t.append("@jsonPayload",JSON.stringify({requests:n})),e=Object.assign({method:"POST",body:t},e),this.client.send("/api/batch",e)}}class Eu{constructor(e,t){this.requests=[],this.requests=e,this.collectionIdOrName=t}upsert(e,t){t=Object.assign({body:e||{}},t);const n={method:"PUT",url:"/api/collections/"+encodeURIComponent(this.collectionIdOrName)+"/records"};this.prepareRequest(n,t),this.requests.push(n)}create(e,t){t=Object.assign({body:e||{}},t);const n={method:"POST",url:"/api/collections/"+encodeURIComponent(this.collectionIdOrName)+"/records"};this.prepareRequest(n,t),this.requests.push(n)}update(e,t,n){n=Object.assign({body:t||{}},n);const s={method:"PATCH",url:"/api/collections/"+encodeURIComponent(this.collectionIdOrName)+"/records/"+encodeURIComponent(e)};this.prepareRequest(s,n),this.requests.push(s)}delete(e,t){t=Object.assign({},t);const n={method:"DELETE",url:"/api/collections/"+encodeURIComponent(this.collectionIdOrName)+"/records/"+encodeURIComponent(e)};this.prepareRequest(n,t),this.requests.push(n)}prepareRequest(e,t){if(Ms(t),e.headers=t.headers,e.json={},e.files={},t.query!==void 0){const s=Ls(t.query);s&&(e.url+=(e.url.includes("?")?"&":"?")+s)}let n=t.body;_s(n)&&(n=(function(i){let o={};return i.forEach(((c,l)=>{if(l==="@jsonPayload"&&typeof c=="string")try{let d=JSON.parse(c);Object.assign(o,d)}catch(d){console.warn("@jsonPayload error:",d)}else o[l]!==void 0?(Array.isArray(o[l])||(o[l]=[o[l]]),o[l].push(Qi(c))):o[l]=Qi(c)})),o})(n));for(const s in n){const i=n[s];if(Os(i))e.files[s]=e.files[s]||[],e.files[s].push(i);else if(Array.isArray(i)){const o=[],c=[];for(const l of i)Os(l)?o.push(l):c.push(l);if(o.length>0&&o.length==i.length){e.files[s]=e.files[s]||[];for(let l of o)e.files[s].push(l)}else if(e.json[s]=c,o.length>0){let l=s;s.startsWith("+")||s.endsWith("+")||(l+="+"),e.files[l]=e.files[l]||[];for(let d of o)e.files[l].push(d)}}else e.json[s]=i}}}class Yo{get baseUrl(){return this.baseURL}set baseUrl(e){this.baseURL=e}constructor(e="/",t,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseURL=e,this.lang=n,t?this.authStore=t:typeof window<"u"&&window.Deno?this.authStore=new Fs:this.authStore=new pu,this.collections=new yu(this),this.files=new Cu(this),this.logs=new wu(this),this.settings=new gu(this),this.realtime=new Ho(this),this.health=new Su(this),this.backups=new Tu(this),this.crons=new Ou(this)}get admins(){return this.collection("_superusers")}createBatch(){return new xu(this)}collection(e){return this.recordServices[e]||(this.recordServices[e]=new mu(this,e)),this.recordServices[e]}autoCancellation(e){return this.enableAutoCancellation=!!e,this}cancelRequest(e){return this.cancelControllers[e]&&(this.cancelControllers[e].abort(),delete this.cancelControllers[e]),this}cancelAllRequests(){for(let e in this.cancelControllers)this.cancelControllers[e].abort();return this.cancelControllers={},this}filter(e,t){if(!t)return e;for(let n in t){let s=t[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}e=e.replaceAll("{:"+n+"}",s)}return e}getFileUrl(e,t,n={}){return console.warn("Please replace pb.getFileUrl() with pb.files.getURL()"),this.files.getURL(e,t,n)}buildUrl(e){return console.warn("Please replace pb.buildUrl() with pb.buildURL()"),this.buildURL(e)}buildURL(e){var n;let t=this.baseURL;return typeof window>"u"||!window.location||t.startsWith("https://")||t.startsWith("http://")||(t=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseURL.startsWith("/")||(t+=window.location.pathname||"/",t+=t.endsWith("/")?"":"/"),t+=this.baseURL),e&&(t+=t.endsWith("/")?"":"/",t+=e.startsWith("/")?e.substring(1):e),t}async send(e,t){t=this.initSendOptions(e,t);let n=this.buildURL(e);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,t));s.url!==void 0||s.options!==void 0?(n=s.url||n,t=s.options||t):Object.keys(s).length&&(t=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(t.query!==void 0){const s=Ls(t.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete t.query}return this.getHeader(t.headers,"Content-Type")=="application/json"&&t.body&&typeof t.body!="string"&&(t.body=JSON.stringify(t.body)),(t.fetch||fetch)(n,t).then((async s=>{var o;let i={};try{i=await s.json()}catch(c){if((o=t.signal)!=null&&o.aborted||(c==null?void 0:c.name)=="AbortError"||(c==null?void 0:c.message)=="Aborted")throw c}if(this.afterSend&&(i=await this.afterSend(s,i,t)),s.status>=400)throw new ie({url:s.url,status:s.status,data:i});return i})).catch((s=>{throw new ie(s)}))}initSendOptions(e,t){if((t=Object.assign({method:"GET"},t)).body=(function(s){if(typeof FormData>"u"||s===void 0||typeof s!="object"||s===null||_s(s)||!Xi(s))return s;const i=new FormData;for(const o in s){const c=s[o];if(c!==void 0)if(typeof c!="object"||Xi({data:c})){const l=Array.isArray(c)?c:[c];for(let d of l)i.append(o,d)}else{let l={};l[o]=c,i.append("@jsonPayload",JSON.stringify(l))}}return i})(t.body),Ms(t),t.query=Object.assign({},t.params,t.query),t.requestKey===void 0&&(t.$autoCancel===!1||t.query.$autoCancel===!1?t.requestKey=null:(t.$cancelKey||t.query.$cancelKey)&&(t.requestKey=t.$cancelKey||t.query.$cancelKey)),delete t.$autoCancel,delete t.query.$autoCancel,delete t.$cancelKey,delete t.query.$cancelKey,this.getHeader(t.headers,"Content-Type")!==null||_s(t.body)||(t.headers=Object.assign({},t.headers,{"Content-Type":"application/json"})),this.getHeader(t.headers,"Accept-Language")===null&&(t.headers=Object.assign({},t.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(t.headers,"Authorization")===null&&(t.headers=Object.assign({},t.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&t.requestKey!==null){const n=t.requestKey||(t.method||"GET")+e;delete t.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,t.signal=s.signal}return t}getHeader(e,t){e=e||{},t=t.toLowerCase();for(let n in e)if(n.toLowerCase()==t)return e[n];return null}}const Au="https://pocketbase.ccllc.pro",Iu=new Yo(Au),Pu=["EA","BX","CA","PK","PLT","LF"],ku=["Framing","Insulation","Drywall","T-Bar","Painting","Masking","Misc"],Ru=["ACT","Channel","Fasteners","Finishing Materials","Adhesives","Mud","Corner Bead","Sanding","Tape","Metal Studs","Metal Tracks","FRP","Gyp","Insulation","Paint","Weatherproofing","Misc"];var Nu=J('<input type="hidden" name="id"/>'),Fu=J('<p class="text-destructive text-sm"> </p>'),Mu=J('<video class="border-input w-full rounded-lg border" playsinline=""></video>',2),Lu=J("<!> Cancel",1),Du=J('<div class="bg-background/95 fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 p-4 backdrop-blur-sm" role="dialog" aria-label="Scan barcode"><div class="flex w-full max-w-sm flex-col gap-2"><!> <div class="flex gap-2"><!></div></div></div>'),Uu=J('<div class="flex flex-wrap items-center gap-3"><img alt="" class="size-20 rounded border object-cover"/> <span class="text-muted-foreground text-sm">Replace:</span></div>'),ju=J("<option> </option>"),qu=J("<option> </option>"),Bu=J("<option> </option>"),Ku=J("<option> </option>"),Wu=J('<p class="text-destructive text-sm"> </p>'),zu=J('<form method="POST" enctype="multipart/form-data" class="flex flex-col gap-4"><!> <div class="grid grid-cols-2 gap-4"><div class="space-y-2"><!> <!></div> <div class="space-y-2"><!> <div class="flex gap-2"><!> <!></div></div></div> <!> <div class="space-y-2"><!> <!></div> <div class="space-y-2"><!> <!> <!></div> <div class="grid grid-cols-2 gap-4"><div class="space-y-2"><!> <select id="UOM" name="UOM" class="border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm shadow-xs"><option>—</option><!></select></div> <div class="space-y-2"><!> <!></div></div> <div class="space-y-2"><!> <!></div> <div class="grid grid-cols-2 gap-4"><div class="space-y-2"><!> <select id="Catagory" name="Catagory" class="border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm shadow-xs"><option>—</option><!></select></div> <div class="space-y-2"><!> <select id="Sub_Catagory" name="Sub_Catagory" class="border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm shadow-xs"><option>—</option><!></select></div></div> <div class="space-y-2"><!> <select id="Parent" name="Parent" class="border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm shadow-xs"><option>—</option><!></select></div> <div class="flex flex-wrap gap-6"><label class="flex items-center gap-2 text-sm"><input type="checkbox" name="Has_Parent" value="on" class="border-input size-4 rounded"/> Has Parent</label> <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="Stock" value="on" class="border-input size-4 rounded"/> Stock</label></div> <!> <div class="flex justify-end gap-2"><!></div></form>');function ld(r,e){G(e,!0);const t="Stackq_Items";function n(g,w){return`${Iu.baseUrl}/api/files/${t}/${g}/${w}`}let s=_(e,"item",3,null),i=_(e,"itemsForParent",19,()=>[]);const o=A(()=>!!s()),c=A(()=>s()?i().filter(g=>g.id!==s().id):i()),l=A(()=>{var g;return((g=s())==null?void 0:g.Item)??""}),d=A(()=>{var g;return((g=s())==null?void 0:g.SKU)??""}),b=A(()=>{var g;return((g=s())==null?void 0:g.Description)??""}),f=A(()=>{var g;return((g=s())==null?void 0:g.UOM)??""}),v=A(()=>{var g;return((g=s())==null?void 0:g.Cost)!=null?String(s().Cost):""}),m=A(()=>{var g;return((g=s())==null?void 0:g.Vendor)??""}),p=A(()=>{var g,w;return Array.isArray((g=s())==null?void 0:g.Catagory)?s().Catagory[0]:((w=s())==null?void 0:w.Catagory)??""}),S=A(()=>{var g,w;return Array.isArray((g=s())==null?void 0:g.Sub_Catagory)?s().Sub_Catagory[0]:((w=s())==null?void 0:w.Sub_Catagory)??""}),B=A(()=>{var g;return((g=s())==null?void 0:g.Parent)??""}),M=A(()=>{var g;return!!((g=s())!=null&&g.Has_Parent)}),R=A(()=>{var g;return!!((g=s())!=null&&g.Stock)});let D=U(""),k=U(!1),z=U(null),j=U(void 0),W=null,K=0;Ne(()=>{T(D,u(d),!0)});async function ue(){if(typeof globalThis>"u"||"BarcodeDetector"in globalThis)return!0;try{const g=await tc(()=>import("./Bd99md_0.js"),[],import.meta.url);return globalThis.BarcodeDetector=g.BarcodeDetector,!0}catch{return!1}}async function fe(){if(T(z,null),!await ue()){T(z,"Failed to load barcode scanner. Try again or use Chrome/Edge."),T(k,!0);return}try{W=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}}),T(k,!0)}catch(w){T(z,w instanceof Error?w.message:"Could not access camera.",!0),T(k,!0)}}Ne(()=>{if(!(!u(k)||!W||!u(j)))return u(j).srcObject=W,u(j).play().then(()=>Ir()).catch(()=>{}),()=>{u(j).srcObject&&(u(j).srcObject=null)}});const zn=300;function Ir(){if(!u(k)||!u(j)||!("BarcodeDetector"in globalThis))return;const g=new globalThis.BarcodeDetector;let w=0;async function C(){if(!u(k)||!u(j))return;if(u(j).readyState<2){K=requestAnimationFrame(C);return}const Z=Date.now();if(Z-w>=zn){w=Z;try{const ee=await g.detect(u(j));if(ee.length>0){T(D,ee[0].rawValue,!0),Pr();return}}catch{}}K=requestAnimationFrame(C)}C()}function Pr(){T(k,!1),T(z,null),K&&(cancelAnimationFrame(K),K=0),W&&(W.getTracks().forEach(g=>g.stop()),W=null),u(j)&&u(j).srcObject&&(u(j).srcObject=null)}var Le=zu(),Vn=I(Le);{var kr=g=>{var w=Nu();Yr(w),me(()=>Ka(w,s().id)),O(g,w)};se(Vn,g=>{u(o)&&g(kr)})}var Ft=F(Vn,2),be=I(Ft),De=I(be);ye(De,{for:"Item",children:(g,w)=>{te();var C=pe("Item");O(g,C)},$$slots:{default:!0}});var et=F(De,2);vt(et,{id:"Item",name:"Item",get value(){return u(l)},required:!0}),P(be);var Ue=F(be,2),gt=I(Ue);ye(gt,{for:"SKU",children:(g,w)=>{te();var C=pe("SKU");O(g,C)},$$slots:{default:!0}});var ve=F(gt,2),$s=I(ve);vt($s,{id:"SKU",name:"SKU",class:"flex-1",get value(){return u(D)},set value(g){T(D,g,!0)}});var Xo=F($s,2);Xr(Xo,{type:"button",variant:"outline",size:"icon",onclick:fe,title:"Scan barcode",children:(g,w)=>{lu(g,{class:"size-4"})},$$slots:{default:!0}}),P(ve),P(Ue),P(Ft);var ei=F(Ft,2);{var Qo=g=>{var w=Du(),C=I(w),Z=I(C);{var ee=je=>{var qe=Fu(),bt=I(qe,!0);P(qe),me(()=>tt(bt,u(z))),O(je,qe)},la=je=>{var qe=Mu();qe.muted=!0,so(qe,bt=>T(j,bt),()=>u(j)),O(je,qe)};se(Z,je=>{u(z)?je(ee):je(la,!1)})}var Si=F(Z,2),ua=I(Si);Xr(ua,{type:"button",variant:"outline",class:"flex-1",onclick:Pr,children:(je,qe)=>{var bt=Lu(),da=L(bt);zo(da,{class:"mr-2 size-4"}),te(),O(je,bt)},$$slots:{default:!0}}),P(Si),P(C),P(w),O(g,w)};se(ei,g=>{u(k)&&g(Qo)})}var Rr=F(ei,2),ti=I(Rr);ye(ti,{for:"Description",children:(g,w)=>{te();var C=pe("Description");O(g,C)},$$slots:{default:!0}});var Zo=F(ti,2);vt(Zo,{id:"Description",name:"Description",get value(){return u(b)}}),P(Rr);var Nr=F(Rr,2),ni=I(Nr);ye(ni,{for:"Image",children:(g,w)=>{te();var C=pe("Image");O(g,C)},$$slots:{default:!0}});var ri=F(ni,2);{var $o=g=>{var w=Uu(),C=I(w);te(2),P(w),me(Z=>Pi(C,"src",Z),[()=>n(s().id,s().Image)]),O(g,w)};se(ri,g=>{var w;u(o)&&((w=s())!=null&&w.Image)&&g($o)})}var ea=F(ri,2);vt(ea,{id:"Image",name:"Image",type:"file",accept:"image/*"}),P(Nr);var Fr=F(Nr,2),Mr=I(Fr),si=I(Mr);ye(si,{for:"UOM",children:(g,w)=>{te();var C=pe("UOM");O(g,C)},$$slots:{default:!0}});var ii=F(si,2),Lr=I(ii);Lr.value=Lr.__value="";var ta=F(Lr);Bt(ta,17,()=>Pu,qt,(g,w)=>{var C=ju(),Z=I(C,!0);P(C);var ee={};me(()=>{Hn(C,u(f)===u(w)),tt(Z,u(w)),ee!==(ee=u(w))&&(C.value=(C.__value=u(w))??"")}),O(g,C)}),P(ii),P(Mr);var oi=F(Mr,2),ai=I(oi);ye(ai,{for:"Cost",children:(g,w)=>{te();var C=pe("Cost");O(g,C)},$$slots:{default:!0}});var na=F(ai,2);vt(na,{id:"Cost",name:"Cost",type:"number",step:"any",get value(){return u(v)}}),P(oi),P(Fr);var Dr=F(Fr,2),ci=I(Dr);ye(ci,{for:"Vendor",children:(g,w)=>{te();var C=pe("Vendor");O(g,C)},$$slots:{default:!0}});var ra=F(ci,2);vt(ra,{id:"Vendor",name:"Vendor",get value(){return u(m)}}),P(Dr);var Ur=F(Dr,2),jr=I(Ur),li=I(jr);ye(li,{for:"Catagory",children:(g,w)=>{te();var C=pe("Catagory");O(g,C)},$$slots:{default:!0}});var ui=F(li,2),qr=I(ui);qr.value=qr.__value="";var sa=F(qr);Bt(sa,17,()=>ku,qt,(g,w)=>{var C=qu(),Z=I(C,!0);P(C);var ee={};me(()=>{Hn(C,u(p)===u(w)),tt(Z,u(w)),ee!==(ee=u(w))&&(C.value=(C.__value=u(w))??"")}),O(g,C)}),P(ui),P(jr);var di=F(jr,2),hi=I(di);ye(hi,{for:"Sub_Catagory",children:(g,w)=>{te();var C=pe("Sub_Catagory");O(g,C)},$$slots:{default:!0}});var fi=F(hi,2),Br=I(fi);Br.value=Br.__value="";var ia=F(Br);Bt(ia,17,()=>Ru,qt,(g,w)=>{var C=Bu(),Z=I(C,!0);P(C);var ee={};me(()=>{Hn(C,u(S)===u(w)),tt(Z,u(w)),ee!==(ee=u(w))&&(C.value=(C.__value=u(w))??"")}),O(g,C)}),P(fi),P(di),P(Ur);var Kr=F(Ur,2),pi=I(Kr);ye(pi,{for:"Parent",children:(g,w)=>{te();var C=pe("Parent");O(g,C)},$$slots:{default:!0}});var gi=F(pi,2),Wr=I(gi);Wr.value=Wr.__value="";var oa=F(Wr);Bt(oa,17,()=>u(c),qt,(g,w)=>{var C=Ku(),Z=I(C,!0);P(C);var ee={};me(()=>{Hn(C,u(B)===u(w).id),tt(Z,u(w).Item||u(w).SKU||u(w).id),ee!==(ee=u(w).id)&&(C.value=(C.__value=u(w).id)??"")}),O(g,C)}),P(gi),P(Kr);var zr=F(Kr,2),Vr=I(zr),bi=I(Vr);Yr(bi),te(),P(Vr);var vi=F(Vr,2),mi=I(vi);Yr(mi),te(),P(vi),P(zr);var yi=F(zr,2);{var aa=g=>{var w=Wu(),C=I(w,!0);P(w),me(()=>tt(C,e.error)),O(g,w)};se(yi,g=>{e.error&&g(aa)})}var wi=F(yi,2),ca=I(wi);Xr(ca,{type:"submit",children:(g,w)=>{te();var C=pe();me(()=>tt(C,e.submitLabel)),O(g,C)},$$slots:{default:!0}}),P(wi),P(Le),Za(Le,(g,w)=>{var C;return(C=$a)==null?void 0:C(g,w)},()=>()=>async({update:g,result:w})=>{var C,Z;await g(),w.type==="success"&&((C=w.data)!=null&&C.success)&&((Z=e.onSuccess)==null||Z.call(e))}),me(()=>{Pi(Le,"action",e.action),ki(bi,u(M)),ki(mi,u(R))}),O(r,Le),H()}export{Kn as C,ad as D,Ll as E,Dl as F,ld as I,Bi as M,Gc as P,Gi as S,ql as T,od as a,id as b,cd as c,sd as d,dc as e,Fl as f,uo as g,Ui as h,rd as i,ji as j,qi as k,Ki as l,Wo as m,Y as n,Bt as o,qt as p,Bl as u,oe as w};