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