@astralbeam/sdk 0.29.6 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client.d.ts +38 -33
- package/dist/client.js +2 -2
- package/dist/{combobox-DP4y27_X.js → combobox-xio4DRYl.js} +1 -1
- package/dist/{core-iDw0grkb.js → core-CBrD2uRW.js} +171 -115
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-Coxrpa2o.d.ts → index-COWV2LM7.d.ts} +38 -33
- package/dist/listings-C1-zJbVB.js +1 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/widget-BY5hZkCs.js +27 -0
- package/package.json +1 -1
- package/dist/listings-Vd3lhoY9.js +0 -1
- package/dist/widget-G_WaD28k.js +0 -27
|
@@ -39,4 +39,4 @@ function tn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,
|
|
|
39
39
|
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i}else n++}return t}function Qf(e){let t=[],n=/:\s*([^\n]*)/g,r;for(;r=n.exec(e);){let n=r[1],i=n.trimEnd();if(!i)continue;let a=r.index+r[0].indexOf(n),o=a+i.length,s=/\s+#/.exec(i);for(s&&(o=a+s.index);o>a&&/\s/.test(e[o-1]);)o--;o>a&&t.push({start:a,end:o,className:`string`})}return t}const $f=Pd({languages:[nf,rf,pf,Of,kf,Af,jf,Pf,Ff,Lf,Hf,Kf,qf,Jf,Yf]});function ep(e,t){let n=e.replace(/\r?\n$/,``),r=t.toLowerCase()===`shellscript`?`shell`:t.toLowerCase(),{tokens:i}=$f.tokenize(n,{lang:r}),a=[[]];for(let[e,t]of i.entries())for(let[n,r]of t.value.split(/\r?\n/).entries())n&&a.push([]),r&&a[a.length-1].push(/* @__PURE__ */ (0,Q.jsx)(`span`,{className:t.className?`th-${t.className}`:void 0,children:r},`${e}-${n}`));return a}const tp=Ce(`group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs`,{variants:{variant:{default:`border border-input text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30`,destructive:`border border-destructive/30 text-destructive dark:border-destructive/40`}},defaultVariants:{variant:`default`}});function np({className:e,variant:t=`default`,size:n=`default`,...r}){return/* @__PURE__ */ (0,Q.jsx)(`div`,{"data-slot":`code-block`,"data-variant":t,"data-size":n,className:k(tp({variant:t}),e),...r})}function rp({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(`div`,{"data-slot":`code-block-header`,className:k(`flex min-w-0 shrink-0 items-center gap-2 px-3 pt-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pt-2.5 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0`,e),...t})}function ip({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(`div`,{"data-slot":`code-block-title`,className:k(`min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-3.5 *:[svg]:me-1.5`,e),...t})}function ap({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(`div`,{"data-slot":`code-block-actions`,className:k(`-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10`,e),...t})}function op({value:e,variant:t=`ghost`,size:n=`icon-xs`,className:r,onClick:i,...a}){let[o,s]=Z.useState(!1);return Z.useEffect(()=>{if(!o)return;let e=setTimeout(()=>s(!1),2e3);return()=>clearTimeout(e)},[o]),/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[/* @__PURE__ */ (0,Q.jsx)(x,{"data-slot":`code-block-copy-button`,"data-copied":o||void 0,variant:t,size:n,"aria-label":o?`Copied`:`Copy`,className:k(r),onClick:t=>{i?.(t),navigator.clipboard.writeText(e).then(()=>s(!0)).catch(()=>{})},...a,children:o?/* @__PURE__ */ (0,Q.jsx)(ra,{}):/* @__PURE__ */ (0,Q.jsx)(ia,{})}),/* @__PURE__ */ (0,Q.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,children:o?`Copied`:``})]})}function sp({className:e,children:t,style:n,wrap:r=!1,lineNumbers:i=!1,startLine:a=1,...o}){return/* @__PURE__ */ (0,Q.jsx)(`pre`,{"data-slot":`code-block-content`,"data-wrap":r||void 0,"data-numbered":i||void 0,dir:`ltr`,tabIndex:0,style:{counterReset:`line ${a-1}`,...n},className:k(`min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,e),...o,children:/* @__PURE__ */ (0,Q.jsx)(`code`,{"data-slot":`code-block-code`,className:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`,children:i&&typeof t==`string`?t.replace(/\n$/,``).split(`
|
|
40
40
|
`).map((e,t)=>/* @__PURE__ */ (0,Q.jsx)(lp,{children:e},t)):t})})}const cp=Ce(`relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-muted after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-muted`}},defaultVariants:{variant:`default`}});function lp({className:e,variant:t=`default`,children:n,...r}){let i=n==null||n===``||Array.isArray(n)&&n.length===0;return/* @__PURE__ */ (0,Q.jsx)(`span`,{"data-slot":`code-block-line`,"data-variant":t,className:k(cp({variant:t}),e),...r,children:/* @__PURE__ */ (0,Q.jsx)(`span`,{"data-slot":`code-block-line-content`,className:`min-w-0`,children:i?`
|
|
41
41
|
`:n})})}function up({children:e,language:t=`text`,title:n,wrap:r=!1,tone:i=`default`,className:a}){let o=t.toLowerCase()===`ansi`?Md(e):e,s=(0,Z.useMemo)(()=>ep(o,t),[o,t]);return/* @__PURE__ */ (0,Q.jsxs)(np,{size:`sm`,variant:i===`error`?`destructive`:`default`,children:[/* @__PURE__ */ (0,Q.jsxs)(rp,{className:`group-data-[size=sm]/code-block:pt-2`,children:[/* @__PURE__ */ (0,Q.jsx)(ip,{title:n,className:`text-muted-foreground`,children:n??t}),/* @__PURE__ */ (0,Q.jsx)(ap,{children:/* @__PURE__ */ (0,Q.jsx)(op,{value:o,className:`any-pointer-coarse:size-11`})})]}),/* @__PURE__ */ (0,Q.jsx)(sp,{wrap:r,className:k(`max-h-72 whitespace-pre group-data-[size=sm]/code-block:py-2 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1`,a),children:s.map((e,t)=>/* @__PURE__ */ (0,Q.jsx)(lp,{children:e},t))})]})}const dp=/*#__PURE__*/ Z.createContext(void 0);function fp(e){let t=Z.useContext(dp);if(t===void 0&&!e)throw Error(ft(50));return t}const pp={...Xe,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};var mp=class extends Oe{constructor(e,t,n){let r=new Yt;super(hp(e,r,t,n),gp(r),pp)}setOpen=(e,t)=>{let{inlineRectCoordsRef:n}=this.context;ue(this,e,t,{onBeforeDispatch(){let r=t.event;e&&t.reason===`trigger-hover`&&t.trigger&&`clientX`in r&&`clientY`in r&&n.current?.element!==t.trigger&&hs(n,t.trigger,r.clientX,r.clientY)}})}};function hp(e,t,n,r=!1){return{...mt(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:300,...e}}function gp(e){return{popupRef:/*#__PURE__*/ Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function _p(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,d=st((e,r)=>new mp({open:n,openProp:t,activeTriggerId:c,triggerIdProp:s},e,r));d.useControlledProp(`openProp`,t),d.useControlledProp(`triggerIdProp`,s),d.useContextCallback(`onOpenChange`,r),d.useContextCallback(`onOpenChangeComplete`,i);let f=d.useState(`open`),p=d.useState(`activeTriggerId`),h=d.useState(`mounted`),g=d.useState(`payload`);m(d,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:_}=u(f,d,()=>{d.context.inlineRectCoordsRef.current=void 0});q(()=>{f&&(p??d.set(`payload`,void 0))},[d,p,f]),Z.useImperativeHandle(a,()=>({unmount:_,close:()=>d.setOpen(!1,K(pt))}),[_,d]);let v=f||h||o!=null;return/*#__PURE__*/ (0,Q.jsxs)(dp.Provider,{value:d,children:[o&&/*#__PURE__*/ (0,Q.jsx)(qt,{handle:o,store:d}),v&&/*#__PURE__*/ (0,Q.jsx)(vp,{store:d}),typeof l==`function`?l({payload:g}):l]})}function vp({store:e}){let t=e.useState(`floatingRootContext`),n=H(t);return V(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const yp=e(function(e){return fp(!0)?/*#__PURE__*/ (0,Q.jsx)(_p,{...e}):/*#__PURE__*/ (0,Q.jsx)(T,{children:/*#__PURE__*/ (0,Q.jsx)(_p,{...e})})}),bp=/*#__PURE__*/ Z.createContext(void 0);function xp(){let e=Z.useContext(bp);if(e===void 0)throw Error(ft(48));return e}const Sp=/*#__PURE__*/ Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return fp().useState(`mounted`)||n?/*#__PURE__*/ (0,Q.jsx)(bp.Provider,{value:n,children:/*#__PURE__*/ (0,Q.jsx)(Ie,{ref:t,...r})}):null}),Cp=We(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=fp(!0),f=Ct(c)??d;if(!f)throw Error(ft(89));let p=ee(o),m=f.useState(`isTriggerActive`,p),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`floatingRootContext`),_=f.context.inlineRectCoordsRef,v=Z.useRef(null),y=i??600,b=a??300,{registerTrigger:x,isMountedByThisTrigger:S}=rt(p,v,f,{payload:s,closeDelay:b}),C=Lt(g,{mouseOnly:!0,move:!1,handleClose:dt(),delay:()=>({open:y,close:b}),triggerElementRef:v,isActiveTrigger:m,isClosing:()=>f.select(`transitionStatus`)===`ending`}),w=Ge(g,{delay:y}),T={open:h},E=f.useState(`triggerProps`,S),D=ms(_,h);return Ee(`a`,e,{state:T,ref:[t,x,v],props:[C,w.reference,E,D,{id:p},u],stateAttributesMapping:Be})}),wp=/*#__PURE__*/ Z.createContext(void 0);function Tp(){let e=Z.useContext(wp);if(e===void 0)throw Error(ft(49));return e}const Ep=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=b,style:g,...v}=e,y=fp(),x=xp(),S=P(),C=y.useState(`open`),w=y.useState(`mounted`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=y.useState(`adaptiveOrigin`),k=y.context.inlineRectCoordsRef,A=bt({anchor:i,floatingRootContext:T,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:O,inline:gs(k)}),j=A.update;q(()=>{C&&w&&j()},[C,w,j]);let M={open:C,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:E},N=$e(e,M,{styles:A.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!w,inert:!C});return/*#__PURE__*/ (0,Q.jsx)(wp.Provider,{value:A,children:/*#__PURE__*/ (0,Q.jsx)(_,{id:S,children:N})})}),Dp=/*#__PURE__*/ Z.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=fp(),{side:s,align:c}=Tp(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`closeDelay`);return ot({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),ze(p,{closeDelay:m}),Ee(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[Me,f,ke(d),a],stateAttributesMapping:Y})});function Op({...e}){return/* @__PURE__ */ (0,Q.jsx)(yp,{"data-slot":`hover-card`,...e})}function kp({...e}){return/* @__PURE__ */ (0,Q.jsx)(Cp,{"data-slot":`hover-card-trigger`,...e})}function Ap({className:e,side:t=`bottom`,sideOffset:n=4,align:r=`center`,alignOffset:i=4,container:a,collisionAvoidance:o,...s}){return/* @__PURE__ */ (0,Q.jsx)(Sp,{"data-slot":`hover-card-portal`,container:a,children:/* @__PURE__ */ (0,Q.jsx)(Ep,{align:r,alignOffset:i,side:t,sideOffset:n,collisionAvoidance:o,className:`isolate z-50`,children:/* @__PURE__ */ (0,Q.jsx)(Dp,{"data-slot":`hover-card-content`,className:k(`z-50 w-64 origin-(--transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s})})})}function jp({citation:e,href:t}){let n=(0,Z.useRef)(null),r=(0,Z.useCallback)(e=>{n.current=e?.closest(`[data-slot=chat], .astralbeam-root`)??null},[]);return/* @__PURE__ */ (0,Q.jsxs)(Op,{children:[/* @__PURE__ */ (0,Q.jsx)(kp,{"data-slot":`inline-citation`,ref:r,href:t,target:`_blank`,rel:`nofollow noopener noreferrer`,referrerPolicy:`no-referrer`,"aria-label":`Source ${e.number}: ${e.title} (opens in a new tab)`,className:M({variant:`secondary`,size:`xs`,className:`mx-0.5 h-5 min-w-5 rounded-sm px-1 text-[0.65rem] align-baseline`}),children:e.number}),/* @__PURE__ */ (0,Q.jsxs)(Ap,{container:n,align:`start`,collisionAvoidance:{side:`flip`,align:`shift`},className:`flex w-72 max-w-[calc(100vw-2rem)] flex-col gap-1`,children:[/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`font-medium wrap-break-word`,children:e.title}),/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:new URL(t).hostname}),e.excerpt&&/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs leading-relaxed wrap-break-word`,children:e.excerpt})]})]})}const Mp=[ku()],Np=(0,Z.createContext)([]),Pp=Object.fromEntries(Object.entries({p:`my-1.5 first:mt-0 last:mb-0`,h1:`mt-4 mb-2 font-heading text-base font-semibold first:mt-0`,h2:`mt-4 mb-2 font-heading text-base font-medium first:mt-0`,h3:`mt-3 mb-1.5 font-heading text-sm font-semibold first:mt-0`,h4:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,h5:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,h6:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,ul:`my-2 list-disc space-y-1 ps-5 first:mt-0 last:mb-0`,ol:`my-2 list-decimal space-y-1 ps-5 first:mt-0 last:mb-0`,li:`marker:text-muted-foreground [&>ol]:my-1 [&>ul]:my-1`,blockquote:`my-2 border-s-2 ps-3 text-muted-foreground italic`,code:`rounded-sm bg-muted px-1 py-0.5 font-mono text-xs`,hr:`my-3`,thead:`border-b`,th:`px-2 py-1 text-start font-medium`,td:`border-t px-2 py-1`,strong:`font-medium`,del:`line-through`,sup:`text-[0.7em]`,section:`mt-3 border-t pt-2 text-xs text-muted-foreground`}).map(([e,t])=>[e,n=>(0,Z.createElement)(e,{...n,className:t})]));function Fp({href:e,children:t,title:n,...r}){let i=(0,Z.useContext)(Np),a=Z.Children.toArray(t),o=i.find(t=>a.length===1&&String(t.number)===a[0]&&t.title.replaceAll(/\s+/g,` `)===n&&vi(t.url)===e);if(o&&e)return/* @__PURE__ */ (0,Q.jsx)(jp,{citation:o,href:e});let s=/^(?:https?:)?\/\//i.test(e??``);return/* @__PURE__ */ (0,Q.jsx)(`a`,{...r,href:e,title:n,className:`font-medium underline underline-offset-2`,...s?{target:`_blank`,rel:`nofollow noopener noreferrer`,referrerPolicy:`no-referrer`}:{},children:t})}function Ip({children:e,...t}){let n=Z.Children.only(e),r=(0,Z.isValidElement)(n)?n.props.children:``,i=t[`data-lang`];return/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`my-1.5 first:mt-0 last:mb-0`,children:/* @__PURE__ */ (0,Q.jsx)(up,{language:typeof i==`string`?i:void 0,children:r})})}function Lp({alt:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(`img`,{...t,alt:e??``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`my-2 max-w-full rounded-md`})}function Rp(e){return/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`my-2 overflow-x-auto`,children:/* @__PURE__ */ (0,Q.jsx)(`table`,{...e,className:`w-full border-collapse text-xs`})})}const zp={...Pp,a:Fp,img:Lp,table:Rp,pre:Ip};function Bp({children:e,citations:t=[]}){return/* @__PURE__ */ (0,Q.jsx)(Np.Provider,{value:t,children:/* @__PURE__ */ (0,Q.jsx)(_d,{extensions:Mp,components:zp,frontmatter:!1,headingIds:!1,children:e})})}function Vp({content:e,running:t}){let[n,r]=(0,Z.useState)();return e?/* @__PURE__ */ (0,Q.jsx)(vl,{children:/* @__PURE__ */ (0,Q.jsxs)(Cl,{open:n??t,onOpenChange:r,children:[/* @__PURE__ */ (0,Q.jsx)(wl,{children:/* @__PURE__ */ (0,Q.jsxs)(yl,{status:t?`running`:void 0,children:[/* @__PURE__ */ (0,Q.jsx)(bl,{children:t?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(ta,{})}),/* @__PURE__ */ (0,Q.jsx)(xl,{"aria-live":t?`polite`:void 0,children:t?`Thinking…`:`Thought`})]})}),/* @__PURE__ */ (0,Q.jsx)(Tl,{className:`text-xs whitespace-pre-wrap`,children:e})]})}):null}function Hp({part:e}){let t=(0,Z.useContext)(Io),{kind:n,title:r,description:i,href:a}=So(e),o=e.fileId,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=async()=>{if(o&&t?.threadId){u(!0);try{za(r,await t.getThreadAttachment({fileId:o,threadId:t.threadId,filename:r})),c(!1)}catch{c(!0)}finally{u(!1)}}};return/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`max-w-full`,children:/* @__PURE__ */ (0,Q.jsxs)(To,{size:`sm`,state:s?`error`:l?`processing`:`done`,children:[/* @__PURE__ */ (0,Q.jsx)(Lo,{id:o,src:n===`image`?a:void 0,title:r,kind:n,mimeType:e.source.mimeType}),/* @__PURE__ */ (0,Q.jsxs)(Oo,{children:[/* @__PURE__ */ (0,Q.jsx)(ko,{title:r,children:r}),(s||i)&&/* @__PURE__ */ (0,Q.jsx)(Ao,{children:s?`File unavailable. Try again.`:i})]}),o?/* @__PURE__ */ (0,Q.jsx)(Mo,{"aria-label":`Download ${r}`,title:`Download ${r}`,disabled:l,onClick:()=>void d()}):a?/* @__PURE__ */ (0,Q.jsx)(Mo,{render:/* @__PURE__ */ (0,Q.jsx)(`a`,{href:a,download:r,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Download ${r}`,title:`Download ${r}`})}):null]})})}function Up({message:e}){let t=Wa(e),n=e.parts.filter(e=>[`image`,`document`,`audio`,`video`].includes(e.type));return/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[n.length>0&&/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`flex w-full flex-wrap justify-end gap-2`,children:n.map((e,t)=>/* @__PURE__ */ (0,Q.jsx)(Hp,{part:e},t))}),t.length>0&&/* @__PURE__ */ (0,Q.jsx)(qc,{children:/* @__PURE__ */ (0,Q.jsx)(Jc,{className:`py-1.5`,children:/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`whitespace-pre-wrap`,children:t})})})]})}function Wp({children:e,tone:t=`default`,emptyLabel:n,caption:r,language:i}){let a=r===void 0?null:/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`mb-1 font-mono text-xs text-muted-foreground wrap-anywhere`,children:r});return e.length===0&&n?/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[a,/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:n})]}):/* @__PURE__ */ (0,Q.jsx)(up,{title:r,language:i,tone:t,children:e})}function Gp({run:e}){return e.finished?/* @__PURE__ */ (0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[/* @__PURE__ */ (0,Q.jsx)(Wp,{caption:`Command`,language:`bash`,children:`$ ${e.command}`}),!e.timedOut&&/* @__PURE__ */ (0,Q.jsx)(Wp,{caption:`Output`,language:`ansi`,emptyLabel:`No output`,children:e.stdout}),e.stderr.length>0&&/* @__PURE__ */ (0,Q.jsx)(Wp,{caption:`Error output`,language:`ansi`,tone:`error`,children:e.stderr})]}):/* @__PURE__ */ (0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[/* @__PURE__ */ (0,Q.jsx)(Wp,{caption:`Command`,language:`bash`,children:`$ ${e.command}`}),/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Still running…`})]})}function Kp({icon:e,label:t,running:n=!1,failed:r=!1,detail:i,children:a}){return/* @__PURE__ */ (0,Q.jsx)(vl,{className:`min-w-0`,children:/* @__PURE__ */ (0,Q.jsxs)(Cl,{children:[/* @__PURE__ */ (0,Q.jsx)(wl,{children:/* @__PURE__ */ (0,Q.jsxs)(yl,{status:r?`error`:n?`running`:void 0,children:[/* @__PURE__ */ (0,Q.jsx)(bl,{children:e}),/* @__PURE__ */ (0,Q.jsx)(xl,{className:`whitespace-normal wrap-anywhere`,"aria-live":n?`polite`:void 0,children:t})]})}),i&&/* @__PURE__ */ (0,Q.jsx)(Sl,{className:`min-w-0 ps-7 text-xs wrap-anywhere`,children:i}),/* @__PURE__ */ (0,Q.jsx)(Tl,{className:`min-w-0`,children:a})]})})}function qp({part:e}){let t=e.state===`error`,n=Ti(e),r=!t&&!mi(e),i=t?/* @__PURE__ */ (0,Q.jsx)(_a,{}):r?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):Jp[e.name]??/* @__PURE__ */ (0,Q.jsx)(ga,{}),a=n!==void 0||t?/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`block text-muted-foreground`,children:n??Qp(e)??`The sandbox step did not finish.`}):void 0,o=Oi(e);if(o?.published&&!t)return/* @__PURE__ */ (0,Q.jsx)(Hp,{part:{type:o.mimeType?.startsWith(`image/`)?`image`:`document`,source:{type:`url`,value:``,mimeType:o.mimeType??`application/octet-stream`},metadata:{filename:o.path.split(`/`).at(-1),size:o.size},fileId:o.fileId}});let s=ki(e);if(s){let e=ji(s);return/* @__PURE__ */ (0,Q.jsx)(Kp,{icon:i,running:r,failed:t||n!==void 0||s.timedOut||s.exitCode!==void 0&&s.exitCode!==0,label:/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[r?`Running`:`Ran`,` `,/* @__PURE__ */ (0,Q.jsx)(Yp,{children:s.command}),s.finished&&e&&/* @__PURE__ */ (0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e]})]}),detail:a,children:/* @__PURE__ */ (0,Q.jsx)(Xp,{children:/* @__PURE__ */ (0,Q.jsx)(Gp,{run:s})})})}let c=Ei(e);if(c)return/* @__PURE__ */ (0,Q.jsx)(Kp,{icon:i,running:r,failed:t||n!==void 0,label:/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[r?`Writing`:t||n!==void 0?`Could not write`:`Wrote`,` `,/* @__PURE__ */ (0,Q.jsx)(Yp,{children:c.label}),c.written&&/* @__PURE__ */ (0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,c.lines===1?`1 line`:`${c.lines} lines`]})]}),detail:a,children:/* @__PURE__ */ (0,Q.jsx)(Xp,{children:/* @__PURE__ */ (0,Q.jsx)(Wp,{emptyLabel:`Empty file`,caption:c.label===c.path?void 0:c.path,language:c.path.split(`.`).at(-1),children:c.content})})});let l=Di(e);return/* @__PURE__ */ (0,Q.jsx)(Kp,{icon:i,running:r,failed:t||n!==void 0,label:/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[o?t||n?`Could not share`:`Sharing`:Zp(e.name,r),` `,l?/* @__PURE__ */ (0,Q.jsx)(Yp,{children:l}):`the sandbox`]}),detail:a,children:/* @__PURE__ */ (0,Q.jsx)(Xp,{children:/* @__PURE__ */ (0,Q.jsx)(Wp,{emptyLabel:`Waiting for the result…`,language:l?.split(`.`).at(-1),children:$p(e)})})})}const Jp={[Rr]:/* @__PURE__ */ (0,Q.jsx)(la,{}),[zr]:/* @__PURE__ */ (0,Q.jsx)(oa,{}),[Br]:/* @__PURE__ */ (0,Q.jsx)(da,{}),[Vr]:/* @__PURE__ */ (0,Q.jsx)(ga,{})};function Yp({children:e}){return/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono wrap-anywhere`,children:e})}function Xp({children:e}){return/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col`,children:e})}function Zp(e,t){return e===`sandbox_list_files`?t?`Listing`:`Listed`:t?`Reading`:`Read`}function Qp(e){let t=e.output?.error;return typeof t==`string`&&t.length>0?t:void 0}function $p(e){let t=e.output;return t==null?``:typeof t.content==`string`?t.content:Array.isArray(t.entries)?t.entries.length===0?`(empty directory)`:t.entries.map(e=>{let{name:t,type:n}=e,r=typeof t==`string`?t:qa(e);return n===`dir`?`${r}/`:r}).join(`
|
|
42
|
-
`):qa(t)}function em({part:e,active:t}){let n=_i(e).web,r=[...new Map((n?.sources??[]).flatMap(e=>{let t=vi(e.url);return t?[[t,{...e,url:t}]]:[]})).values()],i=e.state!==`complete`&&e.state!==`error`,a=t&&i;return/* @__PURE__ */ (0,Q.jsxs)(Kp,{running:a,failed:e.state===`error`,icon:e.state===`error`?/* @__PURE__ */ (0,Q.jsx)(_a,{}):a?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(fa,{}),label:e.state===`error`?`Web retrieval failed`:a?`Searching and reading the web`:i?`Web retrieval unfinished`:r.length?`Consulted ${r.length} source${r.length===1?``:`s`}`:`Web retrieval complete`,children:[/* @__PURE__ */ (0,Q.jsx)(vl,{children:r.map(e=>/* @__PURE__ */ (0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`nofollow noopener noreferrer`,referrerPolicy:`no-referrer`,className:`min-w-0 flex-col items-start any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11 any-pointer-coarse:justify-center`,children:[/* @__PURE__ */ (0,Q.jsx)(yl,{children:/* @__PURE__ */ (0,Q.jsxs)(xl,{className:`whitespace-normal wrap-anywhere`,children:[e.title&&e.title!==e.url?e.title:new URL(e.url).pathname,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})}),/* @__PURE__ */ (0,Q.jsx)(Sl,{className:`min-w-0 text-xs wrap-anywhere`,children:new URL(e.url).hostname})]},e.url))}),r.length===0&&/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a?`Sources appear here as retrieval finishes.`:`No source links were returned.`})]})}function tm({children:e}){return/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:e})]})}function nm({running:e,children:t}){return/* @__PURE__ */ (0,Q.jsx)(vl,{children:/* @__PURE__ */ (0,Q.jsxs)(yl,{status:e?`running`:void 0,children:[/* @__PURE__ */ (0,Q.jsx)(bl,{children:e?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(va,{})}),/* @__PURE__ */ (0,Q.jsx)(xl,{className:`whitespace-normal wrap-anywhere`,"aria-live":e?`polite`:void 0,children:t})]})})}function rm({part:e,title:t,failed:n,readOnly:r=!1}){let i=mi(e),a=!r&&!n&&!i,o=t?/* @__PURE__ */ (0,Q.jsxs)(`span`,{children:[`“`,t,`”`]}):/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),s=n?e.output?.error:void 0;return/* @__PURE__ */ (0,Q.jsx)(Kp,{icon:n?/* @__PURE__ */ (0,Q.jsx)(_a,{}):a?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(va,{}),running:a,failed:n,label:n?/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[o,` failed`]}):/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[r?`Saved`:a?`Running`:`Ran`,` `,o]}),detail:typeof s==`string`&&s.length>0?/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`block text-muted-foreground`,children:s}):void 0,children:/* @__PURE__ */ (0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[/* @__PURE__ */ (0,Q.jsx)(up,{title:`Input`,language:`json`,wrap:!0,children:qa(e.input)||`—`}),/* @__PURE__ */ (0,Q.jsx)(up,{title:`Output`,language:`json`,wrap:!0,children:i?qa(e.output)||`—`:r?`No saved result.`:`Waiting for the result…`})]})})}function im({part:e,widgets:t,activeSlots:n}){let r=e.input,i=r?Ha(t,r.widget):void 0;if(!r||!i)return mi(e)?/* @__PURE__ */ (0,Q.jsx)(tm,{children:`This widget is unavailable.`}):/* @__PURE__ */ (0,Q.jsx)(nm,{running:!0,children:`Preparing a widget`});let a=Ua(e.widgetRenderId??e.id);return n.has(a)?/* @__PURE__ */ (0,Q.jsx)(`slot`,{name:a}):mi(e)?/* @__PURE__ */ (0,Q.jsxs)(tm,{children:[`Widget `,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:r.widget}),` is unavailable.`]}):/* @__PURE__ */ (0,Q.jsxs)(nm,{running:!0,children:[`Rendering `,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:r.widget})]})}function am({part:e,onQuestionnaireAnswers:t}){if(e.output!=null){let t=e.output.skipped===!0;return/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(ra,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:t?`Questionnaire skipped`:`Answers sent`})]})}if(e.state!==`input-complete`)return/* @__PURE__ */ (0,Q.jsx)(nm,{running:!0,children:`Preparing a questionnaire`});let n=Ka(e.input);return n.length===0?/* @__PURE__ */ (0,Q.jsx)(tm,{children:`The questionnaire could not be displayed`}):/* @__PURE__ */ (0,Q.jsx)(Ou,{items:n,onAnswers:n=>t(e.id,n)})}function om({readOnly:e=!1,part:t,widgets:n,toolTitles:r,serverToolTitles:i,streaming:a=!1,activeSlots:o,onQuestionnaireAnswers:s,interactiveToolIds:c,interrupted:l}){switch(t.type){case`image`:case`document`:case`audio`:case`video`:return/* @__PURE__ */ (0,Q.jsx)(Hp,{part:t});case`text`:return/* @__PURE__ */ (0,Q.jsx)(qc,{variant:`ghost`,children:/* @__PURE__ */ (0,Q.jsx)(Jc,{children:/* @__PURE__ */ (0,Q.jsx)(Bp,{citations:_i(t).web?.citations,children:yi(t.content,_i(t).web?.citations??[])})})});case`thinking`:return/* @__PURE__ */ (0,Q.jsx)(Vp,{content:t.content,running:a&&!e&&!l});case`tool-call`:{if(_i(t).providerExecuted)return/* @__PURE__ */ (0,Q.jsx)(em,{part:t,active:a&&!e&&!l});let u=t.savedToolTitle??(Object.hasOwn(r,t.name)?r[t.name]:void 0);if(e)return xi(t.name)&&mi(t)?/* @__PURE__ */ (0,Q.jsx)(qp,{part:t}):/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:t.state===`error`,readOnly:!0});if(l&&!mi(t))return/* @__PURE__ */ (0,Q.jsx)(tm,{children:`This action request was interrupted.`});if(t.resultOutcome===`unknown`)return/* @__PURE__ */ (0,Q.jsxs)(tm,{children:[`The outcome of `,u??t.name,` is unknown. It was not retried.`]});let d=a&&(xi(t.name)||i!==void 0&&Object.hasOwn(i,t.name));return!c.has(t.id)&&!d&&!mi(t)?/* @__PURE__ */ (0,Q.jsxs)(nm,{running:!1,children:[`Waiting for a confirmed result from`,` `,u??/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:t.name}),`.`]}):xi(t.name)?/* @__PURE__ */ (0,Q.jsx)(qp,{part:t}):t.state===`error`?/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:!0}):t.name===`render_widget`?/* @__PURE__ */ (0,Q.jsx)(im,{part:t,widgets:n,activeSlots:o}):t.name===`ask_questionnaire`?/* @__PURE__ */ (0,Q.jsx)(am,{part:t,onQuestionnaireAnswers:s}):/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:!1})}default:return null}}var sm=class extends Z.Component{constructor(...e){super(...e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:`Part of this response could not be displayed`})]}):this.props.children}};const cm=`[content-visibility:visible]`,lm=e=>{let t=e.metadata?.astralbeam;return e.role!==`assistant`||t?.state===`interrupted`||t?.state===`draft`||e.parts.some(e=>e.type!==`text`&&e.type!==`thinking`||e.content.length>0)},um=(0,Z.memo)(function({message:e,streaming:t,readOnly:n,latestTurn:r,currentTenantUserId:i,widgets:a,toolTitles:o,serverToolTitles:s,activeSlots:c,interactiveToolIds:l,onQuestionnaireAnswers:u}){let d=e.metadata?.astralbeam,f=t&&!n&&e.role===`assistant`&&d?.state!==`interrupted`,p=e.role===`user`&&i!==void 0&&d?.authorTenantUserId!=null&&d.authorTenantUserId!==i;return/* @__PURE__ */ (0,Q.jsx)(Uc,{messageId:e.id,className:r?cm:void 0,children:/* @__PURE__ */ (0,Q.jsx)(Fs,{align:e.role===`user`&&!p?`end`:`start`,children:/* @__PURE__ */ (0,Q.jsxs)(Is,{className:`gap-1`,children:[p&&/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Participant`}),e.role===`user`?/* @__PURE__ */ (0,Q.jsx)(Up,{message:e}):e.parts.map((t,r)=>/* @__PURE__ */ (0,Q.jsx)(sm,{children:/* @__PURE__ */ (0,Q.jsx)(om,{readOnly:n,part:t,widgets:a,toolTitles:o,serverToolTitles:s,streaming:f&&(t.type!==`thinking`||r===e.parts.length-1),activeSlots:c,interactiveToolIds:l,interrupted:d?.state===`interrupted`,onQuestionnaireAnswers:u})},t.type===`tool-call`?t.id:r)),e.role===`assistant`&&d?.state===`interrupted`&&/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:`Response interrupted. The saved content may be incomplete.`})]}),e.role===`assistant`&&d?.state===`draft`&&/* @__PURE__ */ (0,Q.jsxs)(Ms,{role:`status`,children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:f?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:f?`Response in progress.`:`Saved partial response. Completion has not been recorded.`})]})]})})})});function dm({readOnly:e=!1,messages:t,emptySlot:n,emptyHeadline:r,emptyDescription:i,widgets:a,toolTitles:o,serverToolTitles:s,streaming:c=!1,activeSlots:l,interactiveToolIds:u,currentTenantUserId:d,hasOlder:f,loadingHistory:p=!1,loadingOlder:m,onLoadOlder:h,isBusy:g,awaitingReply:_,onQuestionnaireAnswers:v}){let y=(0,Z.useRef)(!1),b=(0,Z.useRef)(null),x=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{let e=b.current;if(!e||!f||m||p)return;let n=n=>{e.scrollTop>100||y.current||(n||x.current!==t)&&(x.current=t,y.current=!0,h().finally(()=>{y.current=!1}))},r=requestAnimationFrame(()=>n());return e.addEventListener(`scroll`,n),()=>{cancelAnimationFrame(r),e.removeEventListener(`scroll`,n)}},[f,m,p,t,h]);let S=t.filter(lm),C=S.findLastIndex(e=>e.role===`user`);return p&&t.length===0?/* @__PURE__ */ (0,Q.jsxs)(`div`,{role:`status`,className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[/* @__PURE__ */ (0,Q.jsx)(Gc,{}),` Loading conversation…`]}):t.length===0&&!f?n?/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`h-full overflow-y-auto`,children:/* @__PURE__ */ (0,Q.jsx)(`slot`,{name:n})}):/* @__PURE__ */ (0,Q.jsx)(Ds,{className:`h-full`,children:/* @__PURE__ */ (0,Q.jsxs)(Os,{children:[/* @__PURE__ */ (0,Q.jsx)(ks,{children:r??`Ask the assistant`}),/* @__PURE__ */ (0,Q.jsx)(As,{children:i??`Ask a question or describe what you want to do in this app.`})]})}):/* @__PURE__ */ (0,Q.jsx)(zc,{autoScroll:!e,children:/* @__PURE__ */ (0,Q.jsxs)(Bc,{className:`h-full`,children:[m&&/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center`,role:`status`,children:/* @__PURE__ */ (0,Q.jsxs)(`span`,{className:`flex items-center gap-2 rounded-md bg-background px-3 py-1 text-sm text-muted-foreground shadow-sm`,children:[/* @__PURE__ */ (0,Q.jsx)(Gc,{}),`Loading earlier messages…`]})}),/* @__PURE__ */ (0,Q.jsx)(Vc,{preserveScrollOnPrepend:!0,ref:b,children:/* @__PURE__ */ (0,Q.jsxs)(Hc,{"aria-busy":g,className:`gap-3 px-(--card-spacing) py-2`,children:[S.map((n,r)=>/* @__PURE__ */ (0,Q.jsx)(um,{message:n,latestTurn:r>=C,streaming:c&&n===t.at(-1),readOnly:e,currentTenantUserId:d,widgets:a,toolTitles:o,serverToolTitles:s,activeSlots:l,interactiveToolIds:u,onQuestionnaireAnswers:v},n.id)),_&&/* @__PURE__ */ (0,Q.jsx)(Uc,{messageId:`astralbeam-thinking`,className:cm,children:/* @__PURE__ */ (0,Q.jsxs)(Ms,{role:`status`,children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(Gc,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{className:`shimmer`,children:`Thinking…`})]})})]})}),/* @__PURE__ */ (0,Q.jsx)(Wc,{})]})})}let fm={},pm={},mm=``;function hm(e,t){return W(e)?e:t}function gm(e,t,n){return/hidden|clip/.test(e.getComputedStyle(hm(t,n)).overflowY)}function _m(e){if(typeof document>`u`)return!1;let t=St(e);return Ht(t).innerWidth-t.documentElement.clientWidth>0}function vm(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=St(e),n=t.documentElement,r=t.body,i=hm(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ym(e){let t=St(e),n=t.documentElement,r=t.body,i=hm(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function bm(e){let t=St(e),n=t.documentElement,r=t.body,i=Ht(n),a=0,o=0,s=!1,c=ie.create();if(it&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,fm={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},mm=n.style.scrollBehavior,pm={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=hm(n,r);s=vm(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,fm),Object.assign(r.style,pm),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=mm)}function d(){u(),c.request(l)}l();let f=U(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}const xm=new class{lockCount=0;restore=null;timeoutLock=D.create();timeoutUnlock=D.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=St(e),n=t.documentElement,r=t.body,i=Ht(n);if(gm(i,n,r)){let t=new i.MutationObserver(()=>{gm(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=z||!_m(e);this.restore=a?ym(e):bm(e)}};function Sm(e=!0,t=null){q(()=>{if(e)return xm.acquire(t)},[e,t])}const Cm=/*#__PURE__*/ Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return/*#__PURE__*/ (0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function wm(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Tm(e,t){let{onClick:n,onPointerDown:r}=wm(J((n,r)=>{(typeof e==`function`?e():e)||t(r||(z?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Em(e){let[t,n]=Z.useState(null),r=Tm(e,n);return p(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const Dm=/*#__PURE__*/ Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Om(){return Z.useContext(Dm)}function km(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Om(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function Am(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),[,o]=Z.useState(0),s=wt(Mm).current,c=wt(jm).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=J(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=J((e,t)=>{c.set(e,t),p()}),h=J(e=>{c.delete(e),p()}),g=J(e=>{let t=/* @__PURE__ */ new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Fm(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Im(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=/* @__PURE__ */ new Set;for(let t=1;t<e.length;t+=1){let r=Pm(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=J(()=>{let[e,t]=Nm(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),q(()=>{u.current&&v()}),q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=J(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return/*#__PURE__*/ (0,Q.jsx)(Dm.Provider,{value:b,children:t})}function jm(){return/* @__PURE__ */ new Map}function Mm(){return/* @__PURE__ */ new Set}function Nm(e){let t=/* @__PURE__ */ new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Im(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Pm(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Fm(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Im(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Lm(e,t,n,r){let[i,a]=Z.useState(!1);q(()=>{if(!e||!t||n==null){a(!1);return}let r=St(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-20)},[e,t,n]),Sm(e&&(!t||i),r)}function Rm(e){return e==null?Ut:e.type.startsWith(`key`)?Qe:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Fe:Ut}function zm(e,t){let n=Bm(t);return e.clientX>=n.left-5&&e.clientX<=n.right+5&&e.clientY>=n.top-5&&e.clientY<=n.bottom+5}function Bm(e){let t=e.getBoundingClientRect(),n=Ht(e);if(ct)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function Vm(e){return Array.isArray(e)?e.map(e=>Vm(e)).join(`,`):e==null?``:String(e)}function Hm(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Um(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function Wm(e){return Um(e?.[0])}function Gm(e){return Wm(e)?e.flatMap(e=>e.items):e}function Km(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Wm(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function qm(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Hm(e)}function Jm(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Hm(e.value):Hm(e)}function Ym(e,t,n){function r(){return qm(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Gm(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Xm(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push(/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:Ym(r,t,n)},i)),e),[])}const Zm=/* @__PURE__ */ new Map;function Qm(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${Vm(t)}|${JSON.stringify(r)}`,a=Zm.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=qm(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=qm(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=qm(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return Zm.set(i,s),s}function $m(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function eh(e=!0){let t=F(),n=Z.useRef(null);return Z.useEffect(()=>{if(!e||z)return;let r=n.current;if(r==null)return;let i=$m(r);if(i==null)return;let a=i.data,o=`${a}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}const th=Z.createContext(void 0),nh=e=>{let t=Z.useContext(th);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},rh=({client:e,children:t})=>(Z.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */ (0,Q.jsx)(th.Provider,{value:e,children:t})),ih={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ah=new class{#e=ih;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function oh(e){setTimeout(e,0)}const sh=typeof window>`u`||`Deno`in globalThis;function ch(){}function lh(e,t){return typeof e==`function`?e(t):e}function uh(e){return typeof e==`number`&&e>=0&&e!==1/0}function dh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fh(e,t){return typeof e==`function`?e(t):e}function ph(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==hh(o,t.options))return!1}else if(!_h(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function mh(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(gh(t.options.mutationKey)!==gh(a))return!1}else if(!_h(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function hh(e,t){return(t?.queryKeyHashFn||gh)(e)}function gh(e){return JSON.stringify(e,(e,t)=>Sh(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function _h(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!_h(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!_h(e[r],t[r]))return!1;return!0}return!1}const vh=Object.prototype.hasOwnProperty;function yh(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=xh(e)&&xh(t);if(!r&&!(Sh(e)&&Sh(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:vh.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=yh(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function bh(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function xh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sh(e){if(!Ch(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Ch(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Ch(e){return Object.prototype.toString.call(e)===`[object Object]`}function wh(e){return new Promise(t=>{ah.setTimeout(t,e)})}function Th(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:yh(e,t)}function Eh(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Dh(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const Oh=Symbol();function kh(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Oh?()=>Promise.reject(/* @__PURE__ */ Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ah(e,t){return typeof e==`function`?e(...t):!!e}function jh(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}let Mh=()=>sh;const Nh=()=>Mh();var Ph=class{constructor(){this.listeners=/* @__PURE__ */ new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const Fh=new class extends Ph{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ih=oh;function Lh(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ih,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}const Rh=Lh(),zh=new class extends Ph{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Bh(e){return Math.min(1e3*2**e,3e4)}function Vh(e){return(e??`online`)!==`online`||zh.isOnline()}var Hh=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Uh(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ch);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Hh(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Fh.isFocused()&&(e.networkMode===`always`||zh.isOnline())&&e.canRun(),p=()=>Vh(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Nh()?0:3),a=e.retryDelay??Bh,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),wh(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var Wh=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),uh(this.gcTime)&&(this.#e=ah.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Nh()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(ah.clearTimeout(this.#e),this.#e=void 0)}};function Gh(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{jh(e,()=>t.signal,()=>n=!0)},u=kh(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Dh:Eh;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?qh:Kh,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Kh(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Kh(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function qh(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Jh(e,t){return t?Kh(e,t)!=null:!1}function Yh(e,t){return!t||!e.getPreviousPageParam?!1:qh(e,t)!=null}var Xh=class extends Wh{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=$h(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=$h(this.options);e.data!==void 0&&(this.setState(Qh(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Th(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ch).catch(ch):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>fh(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>fh(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!dh(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=kh(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Gh(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Uh({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Hh&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Hh){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Zh(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Qh(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Rh.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Zh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vh(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Qh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function $h(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var eg=class extends Ph{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=/* @__PURE__ */ new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ng(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rg(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rg(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */ new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof fh(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!bh(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ig(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||fh(this.options.enabled,this.#t)!==fh(t.enabled,this.#t)||fh(this.options.staleTime,this.#t)!==fh(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||fh(this.options.enabled,this.#t)!==fh(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return bh(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ch)),t}#h(e){return!Nh()&&fh(this.options.enabled,this.#t)!==!1&&uh(e)}#g(){this.#b();let e=fh(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=dh(this.#r.dataUpdatedAt,e)+1;this.#u=ah.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return fh(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=ah.setInterval(()=>{(this.options.refetchIntervalInBackground||Fh.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(ah.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(ah.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ng(e,t),o=i&&ig(e,n,t,r);(a||o)&&(l={...l,...Zh(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Th(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Th(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ag(e,t),refetch:this.refetch,isEnabled:fh(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),bh(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Rh.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function tg(e,t){return fh(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||fh(t.retryOnMount,e)!==!1)}function ng(e,t){return tg(e,t)||e.state.data!==void 0&&rg(e,t,t.refetchOnMount)}function rg(e,t,n){if(fh(t.enabled,e)!==!1&&fh(t.staleTime,e)!==`static`){let r=fh(n,e);return r===`always`||r!==!1&&ag(e,t)}return!1}function ig(e,t,n,r){return(e!==t||fh(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ag(e,n)}function ag(e,t){return fh(t.enabled,e)!==!1&&e.isStaleByTime(fh(t.staleTime,e))}var og=class extends eg{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Jh(t,n.data),hasPreviousPage:Yh(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},sg=class extends Wh{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||cg(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Uh({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(/* @__PURE__ */ Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Rh.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function cg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var lg=class extends Ph{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Set,this.#t=/* @__PURE__ */ new Map,this.#n=0}build(e,t,n){let r=new sg({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ug(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Rh.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>mh(t,e))}findAll(e={}){return this.getAll().filter(t=>mh(e,t))}notify(e){Rh.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Rh.batch(()=>Promise.all(e.map(e=>e.continue().catch(ch))))}};function ug(e){return e.options.scope?.id}var dg=class extends Ph{#e;constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??hh(r,t),a=this.get(i);return a||(a=new Xh({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Rh.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ph(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ph(e,t)):t}notify(e){Rh.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Rh.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rh.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},fg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new dg,this.#t=e.mutationCache||new lg,this.#n=e.defaultOptions||{},this.#r=/* @__PURE__ */ new Map,this.#i=/* @__PURE__ */ new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Fh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=zh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(fh(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=lh(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Rh.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Rh.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Rh.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Rh.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ch).catch(ch)}invalidateQueries(e,t={}){return Rh.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Rh.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(ch)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ch)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(fh(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(fh(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ch).catch(ch)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ch).catch(ch)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return zh.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(gh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_h(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(gh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_h(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=hh(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Oh&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const pg=Z.createContext(!1),mg=()=>Z.useContext(pg);pg.Provider;function hg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const gg=Z.createContext(hg()),_g=()=>Z.useContext(gg),vg=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ah(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},yg=e=>{Z.useEffect(()=>{e.clearReset()},[e])},bg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ah(n,[e.error,r])),xg=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Sg=(e,t)=>e?.suspense&&t.isPending,Cg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wg(e,t,n){let r=mg(),i=_g(),a=nh(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,xg(o),vg(o,i,s),yg(i);let[l]=Z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=d?l.subscribe(Rh.batchCalls(e)):ch;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Z.useEffect(()=>{l.setOptions(o)},[o,l]),Sg(o,u))throw Cg(o,l,i);if(bg({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Tg(e,t){return wg(e,eg,t)}function Eg(e,t){return wg(e,og,t)}function Dg(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Og(e,t,n,r,i,a,o,s,c,l=2){let u=N(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return De(n.current,u)?void 0:u}const kg=/*#__PURE__*/ Z.createContext(void 0),Ag=/*#__PURE__*/ Z.createContext(void 0),jg=/*#__PURE__*/ Z.createContext(void 0),Mg=/*#__PURE__*/ Z.createContext(!1),Ng=/*#__PURE__*/ Z.createContext(``);function Pg(){let e=Z.useContext(kg);if(!e)throw Error(ft(22));return e}function Fg(){let e=Z.useContext(Ag);if(!e)throw Error(ft(23));return e}function Ig(){let e=Z.useContext(jg);if(!e)throw Error(ft(24));return e}function Lg(){return Z.useContext(Ng)}function Rg(){return Z.useContext(Mg)}function zg(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}const Bg=(e,t)=>Object.is(e,t);function Vg(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Hg(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!zg(e,t,(e,t)=>Vg(e,t,n)):e!==t}function Ug(e,t,n){return e?e.some(e=>e!==void 0&&Vg(t,e,n)):!1}function Wg(e,t,n){return e?e.findIndex(e=>e!==void 0&&Vg(e,t,n)):-1}function Gg(e,t){if(t!==Bg)return n=>Ug(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function Kg(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Gg(t,n)):Wg(e,t,n);return i===-1?null:i}function qg(e,t,n,r,i,a){return Ug(r,t,i)?a!=null&&e>a&&Ug(r,n[a],i)?a:e:e===a?Kg(n,r,i,!0):a}function Jg(e,t,n){return e.filter(e=>!Vg(t,e,n))}const Yg={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Km(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>Vg(t,e,n)):Vg(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Xg(e){return e==null?void 0:`${e}-popup`}function Zg(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}const Qg=Qm;function $g(e,t=!1){let{overflowY:n}=ht(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const e_=Symbol(`none`),t_={value:e_,index:-1};function n_(e,t,n){let r=e.get(t);if(r!==void 0||n===Bg)return r;for(let[r,i]of e)if(Vg(r,t,n))return i}function r_(e){let{id:n,onOpenChangeComplete:r,defaultSelectedValue:i=null,selectedValue:a,onSelectedValueChange:o,defaultInputValue:c,inputValue:l,open:u,defaultOpen:f=!1,selectionMode:m,onItemHighlighted:_,name:y,form:b,disabled:x=!1,readOnly:S=!1,required:w=!1,inputRef:T,grid:E=!1,items:D,filteredItems:k,filter:A,filterQuery:j,openOnInputClick:M=!0,autoHighlight:N=!1,keepHighlight:P=!1,highlightItemOnHover:ee=!0,loopFocus:F=!0,itemToStringLabel:L,itemToStringValue:R,isItemEqualToValue:z=Bg,virtualized:B=!1,inline:V=!1,fillInputOnItemPress:ne=!0,modal:ie=!1,limit:U=-1,autoComplete:ae=`list`,formAutoComplete:oe,locale:se,submitOnItemClick:ce=!1}=e,{clearErrors:le}=Qt(),{setDirty:ue,validityData:de,setFilled:W,name:G,disabled:pe,setTouched:me,setFocused:he,validationMode:ge,validation:_e}=C(),ve=Mt(),ye=v({id:n}),xe=Qg({locale:se}),Ce=Array.isArray(D)?null:D;if(Ce&&typeof Ce.label!=`function`)throw Error(ft(100));let we=Ce?Ce.data:D,Te=Ce?.value,Ee=Te?void 0:we,De=Z.useMemo(()=>{if(!k||!Te)return;let e=Gm(k),t=e.map(Te),n;return{values:t,findItem(r,i){if(!n){n=/* @__PURE__ */ new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return n_(n,r,i)}}},[k,Te]),ke=Z.useMemo(()=>Ce?e=>Ce.label(e,z,e=>{let t=De?.findItem(e,z);return t==null?qm(e,L):Ce.itemLabel(t)}):L,[Ce,L,De,z]),Ae=Z.useMemo(()=>Ce?Object.assign(e=>Ce.itemLabel(e),{selected:e=>qm(e,ke)}):L,[Ce,ke,L]);function je(e){return qm(e,ke)}let[Ne,Fe]=Z.useState(!1),[Ie,Le]=Z.useState(null),Re=Z.useRef(Ie),ze=Z.useRef([]),Be=Z.useRef([]),He=Z.useRef(null),We=Z.useRef(null),Ge=Z.useRef(null),qe=Z.useRef(null),Ye=Z.useRef(null),Xe=Z.useRef(!1),Ze=Z.useRef(null),Qe=Z.useRef(null),$e=Z.useRef(null),et=Z.useRef(t_),tt=Z.useRef(null),nt=Z.useRef([]),rt=Z.useRef(null),it=pe||x,at=G??y,ot=m===`multiple`,st=m===`single`,ct=l!==void 0||c!==void 0,lt=we!==void 0,ut=k!==void 0,dt;dt=N===`always`?`always`:N?`input-change`:!1;let[Y,mt]=Yc({controlled:a,default:ot?i??t:i,name:`Combobox`,state:`selectedValue`}),ht=Z.useMemo(()=>A===null?()=>!0:A===void 0?Zg(xe,Ae):A,[A,xe,Ae]),_t=wt(()=>ct?c??``:st?je(Y):``).current,[vt,yt]=Yc({controlled:l,default:_t,name:`Combobox`,state:`inputValue`}),[bt,xt]=Yc({controlled:u,default:f,name:`Combobox`,state:`open`}),St=Wm(we),Ct=!bt&&Ie!==null?Ie:String(vt).trim(),Et=st?je(Y):``,Dt=st&&!Ne&&Ct!==``&&Et.length===Ct.length&&xe.contains(Et,Ct),Ot=Dt?``:j??Ct,kt=lt&&ut&&Dt&&(!Ce||Ce.hasValue(Y,z)),jt=Z.useMemo(()=>we?Gm(we):t,[we]),Nt=Z.useMemo(()=>{if(k&&!kt)return k;if(!we)return t;if(St){let e=we,t=[],n=0;for(let r of e){if(U>-1&&n>=U)break;let e=U>-1?U-n:1/0,i=Ot===``?r.items.slice(0,e):[];if(Ot!==``)for(let t of r.items){if(i.length>=e)break;ht(t,Ot,Ae)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ot===``)return U>-1?jt.slice(0,U):jt;let e=[];for(let t of jt){if(U>-1&&e.length>=U)break;ht(t,Ot,Ae)&&e.push(t)}return e},[k,kt,we,St,Ot,U,ht,Ae,jt]),Pt=Z.useMemo(()=>{if(De&&Nt===k)return De.values;let e=Gm(Nt);return Te?e.map(e=>Te(e)):e},[Nt,k,De,Te]),X=wt(()=>{let e=null;return V&&bt&<&&m!==`none`&&(e=Kg(Pt,Y,z,ot)),new Oe({id:ye,labelId:void 0,selectedValue:Y,open:bt,items:Ee,selectionMode:m,name:at,form:b,disabled:it,readOnly:S,required:w,grid:E,virtualized:B,openOnInputClick:M,itemToStringLabel:ke,isItemEqualToValue:z,modal:ie,autoHighlight:dt,submitOnItemClick:ce,hasInputValue:ct,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:V,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:Ue,id:ye,selectionMode:m,disabled:it,readOnly:S,isItemEqualToValue:z},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:m===`none`},{onOpenChangeComplete:Ft,setOpen:Ft,setInputValue:Ft,setSelectedValue:Ft,setIndices:Ft,handleSelection:Ft,forceMount:Ft,requestSubmit:Ft,listRef:ze,labelsRef:Be,popupRef:He,emptyRef:Ye,inputRef:We,startDismissRef:Ge,endDismissRef:qe,chipsContainerRef:Ze,clearRef:Qe,valuesRef:nt,pointerDownItemRef:rt,selectionEventRef:$e},Yg)}).current,It=m===`none`?vt:Y,Lt=Z.useMemo(()=>m===`none`?It:Array.isArray(Y)?Y.map(e=>Jm(e,R)):Jm(Y,R),[It,R,m,Y]),Rt=J(_),Bt=J(r),Vt=X.useState(`activeIndex`),Ht=X.useState(`selectedIndex`),Wt=X.useState(`positionerElement`),Gt=X.useState(`listElement`),Kt=X.useState(`triggerElement`),qt=X.useState(`inputElement`),Jt=X.useState(`inputGroupElement`),Yt=X.useState(`inline`),Xt=X.useState(`inputInsidePopup`),Zt=X.useState(`inputOwnsFormValue`),$t=st&&!Xt&&vt===Et,en=be(Kt),{openMethod:tn,triggerProps:nn}=Em(bt),rn=J(()=>Lt);re(Xt?en:We,ye,It,rn,!it,y);let an=J(()=>{we?Be.current=Pt.map(je):X.set(`forceMounted`,!0)}),on=J((e,t,n,r)=>{if(t===-1){if(et.current===t_)return;et.current=t_}else et.current={value:e,index:t};Rt(e,g(n,r,{index:t}))}),sn=J(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),X.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?on(void 0,-1,r,e.event):on(nt.current[n],n,r,e.event)}),cn=J((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Xe.current=n.reason===Ke,n.reason===`input-change`){bt&&Ie!==null&&Le(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&Fe(!0),tt.current={hasQuery:e};let n=X.state.listElement;if(!X.state.virtualized&&n){let e=He.current;for(let t of Je(n.firstElementChild??n)){if(!Pe(t)||(e?!d(e,t):t.getAttribute(`role`)===`dialog`))break;if($g(t)){t.scrollTop=0;break}}}e&&dt&&X.state.activeIndex==null&&(bt||Yt)&&X.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&X.state.inputInsidePopup&&(tt.current={hasQuery:!1,selection:!0});yt(t)}}),ln=J(e=>{let t=!e&&Xt&&!Yt&&vt!==``&&(String(vt).trim()===Ie||vt===Et);!e&&(t||vt===``||$t)&&Fe(!1),Le(null),t&&cn(``,K(Ke))}),[un,dn]=Z.useState(!1),fn=J((t,n)=>{if(bt===t)return;n.reason===`escape-key`&<&&Pt.length===0&&!Ye.current&&n.allowPropagation();let r=n,i=s(r);if(e.onOpenChange?.(t,r),tt.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(tt.current=null),!n.isCanceled&&(t&&Ie!==null&&ln(n.reason===Ve),!t&&Ne&&(st?(Yt||Le(Ct),Ct===``&&Fe(!1)):ot&&(Yt||Le(Ct),Xt&&sn({activeIndex:null}),(!Xt||Yt)&&cn(``,K(Ke,n.event,void 0,{isItemPress:n.reason===gt})))),t||dn(i()),xt(t),!t&&Xt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(me(!0),he(!1),ge===`onBlur`))){let e=m===`none`?vt:Y;_e.commit(e)}}),pn=J((e,t)=>{o?.(e,t),!t.isCanceled&&(mt(e),(m===`none`&&He.current&&ne||st&&!X.state.inputInsidePopup)&&cn(je(e),K(t.reason,t.event)))}),mn=J((e,t)=>{let n=te(e),r=$e.current??e;$e.current=null;let i=K(gt,r),a=h(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&fn(!1,i);else if(ot){let e=Array.isArray(Y)?Y:[],n=Ug(e,t,z),r=n?Jg(e,t,z):[...e,t];if(pn(r,i),i.isCanceled||!(We.current&&We.current.value.trim()!==``))return;if(X.state.inputInsidePopup){cn(``,K(Ke,i.event,void 0,{isItemPress:!0}));let e=tt.current;e&&!n&&(e.toggledValue=t)}else fn(!1,i)}else{if(pn(t,i),i.isCanceled)return;fn(!1,i)}}),hn=J(()=>{let e=_e.inputRef.current?.form??X.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),gn=J(()=>{if(Bt?.(!1),Fe(!1),Le(null),sn(m===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),ot&&We.current&&We.current.value!==``&&!Xe.current&&cn(``,K(Ke)),st){if(X.state.inputInsidePopup)We.current&&We.current.value!==``&&cn(``,K(Ke));else{let e=je(Y);We.current&&We.current.value!==e&&cn(e,K(e===``?Ke:Ut))}}}),_n=Z.useMemo(()=>Yt&&Wt?{current:h(Wt,`[role="dialog"]`)}:He,[Yt,Wt]),{mounted:vn,transitionStatus:yn,forceUnmount:bn}=I({open:bt,ref:_n,preventUnmountOnClose:un,setPreventUnmountOnClose:dn,onUnmount:gn});Z.useImperativeHandle(e.actionsRef,()=>({unmount:bn,close:()=>fn(!1,K(pt))}),[bn,fn]),q(function(){let e=Re.current!==null&&Ie===null;if(Re.current=Ie,bt&&(!e||!lt)||(bt||(rt.current=null),m===`none`))return;let t=lt?Pt:nt.current;sn({selectedIndex:Kg(t,Y,z,ot)})},[bt,Ie,Y,m,ot,lt,Pt,z,sn]),q(()=>{we&&(nt.current=Pt,ze.current.length=Pt.length)},[we,Pt]),q(()=>{!bt&&tt.current?.hasQuery&&(tt.current=null)},[bt]),q(()=>{if(!bt&&Yt&&_n.current){tt.current=null;return}let e=lt||ut?Pt:nt.current,t=tt.current;if(t){let n=bt||Yt||X.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=We.current;!dt||String(vt).trim()===``||Yt&&dt!==`always`&&(!t||fe(t.ownerDocument)!==t)?tt.current=null:n&&(e[0]!==void 0||!lt&&!ut)&&(X.set(`activeIndex`,0),tt.current=null)}else if(String(vt).trim()===``&&(tt.current=null,n)){let e=t.selection;dt===`always`&&!e&&X.state.selectionMode===`none`&&X.set(`activeIndex`,0),queueMicrotask(()=>{if(!X.state.open&&(!X.state.inline||_n.current)||We.current&&We.current.value.trim()!==``)return;let n=X.state.selectedValue,r=X.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:X.state.selectionMode!==`none`&&n!=null){let e=lt||ut?Pt:nt.current,i=Wg(e,t.toggledValue,X.state.isItemEqualToValue);X.set(`activeIndex`,i===-1?Kg(e,n,X.state.isItemEqualToValue,r):i)}else e?X.set(`activeIndex`,null):dt===`always`&&X.set(`activeIndex`,0)})}}if(!bt&&!Yt)return;let n=X.state.activeIndex;if(n==null){if(dt===`always`&&e.length>0){X.set(`activeIndex`,0);return}on(void 0,-1,Ut);return}if(n>=e.length){on(void 0,-1,Ut),X.set(`activeIndex`,null);return}let r=e[n],i=et.current.value,a=i!==e_&&Vg(r,i,X.state.isItemEqualToValue);(et.current.index!==n||!a)&&on(r,n,Ut)},[Vt,dt,on,ut,lt,Pt,Yt,bt,_n,X,vt]),q(()=>{W(m===`none`?String(vt)!==``:ot?Array.isArray(Y)&&Y.length>0:Y!=null)},[W,m,vt,Y,ot]),Z.useEffect(()=>{lt&&dt&&Pt.length===0&&sn({activeIndex:null})},[lt,dt,Pt.length,sn]);function xn(){bt&&Ct!==``&&Ct!==String(_t)&&!$t&&Fe(!0)}function Sn(){bt&&Ie!==null&&ln(!1)}let Cn=!1;function wn(){!Cn&&vt!==Et&&(Cn=!0,cn(Et,K(Ut)))}function Tn(){m!==`none`&&(le(at),ue(Hg(Y,de.initialValue,z)),_e.change(Y),st&&!ct&&!Xt&&wn())}function En(){st&&!ct&&!Xt&&!Ne&&wn()}function Dn(){m===`none`&&(le(at),ue(vt!==de.initialValue),_e.change(vt))}p(Ct,xn),p(bt,Sn),p(Y,Tn),p(Et,En),p(we,En),p(vt,Dn);let On=_s({open:Yt?!0:bt,onOpenChange:fn,elements:{reference:Xt?Kt:qt,floating:Wt}}),kn=E?`grid`:`listbox`,An=bt||Yt,jn=An?`true`:`false`,Mn=Z.useMemo(()=>{let e=qt?.tagName===`INPUT`,t=qt==null||e,n=t||An,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jn,r[`aria-haspopup`]=kn,r[`aria-controls`]=An?Gt?.id:void 0,r[`aria-autocomplete`]=S?`none`:ae),{reference:r,floating:{role:`presentation`}}},[qt,An,jn,kn,Gt?.id,ae,S]),Nn=as(On,{enabled:!it&&M,event:`mousedown-only`,toggle:!1,touchOpenDelay:Xt?0:100,reason:Tt}),Pn=H(On,{enabled:!it&&!Yt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:Yt?!0:void 0,outsidePress(e){let t=te(e);return!d(Kt,t)&&!d(Qe.current,t)&&!d(Ze.current,t)&&!d(Jt,t)}}),Fn=ws(On,{enabled:!it,id:ye,listRef:ze,activeIndex:Vt,selectedIndex:Ht,virtual:!0,loopFocus:F,allowEscape:F&&!dt,focusItemOnOpen:Ne||m===`none`&&!dt?!1:`auto`,focusItemOnHover:ee,resetOnPointerLeave:!P,orientation:E?`horizontal`:void 0,rtl:ve===`rtl`,disabledIndices:t,grid:E?Og:void 0,onNavigate(e,t){(t||bt||Yt&&e===null)&&yn!==`ending`&&sn({activeIndex:e,type:Rm(t),event:t?.nativeEvent})}}),In=Z.useMemo(()=>zt(Fn.reference,{onKeyDown(e){E&&X.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pn.reference,Nn.reference,Mn.reference),[Fn.reference,Pn.reference,Nn.reference,Mn.reference,E,X]),Ln=Z.useMemo(()=>zt(Me,Pn.floating),[Pn.floating]),Rn=Z.useMemo(()=>zt(Fn.floating,Mn.floating),[Fn.floating,Mn.floating]),zn=Z.useMemo(()=>{let e=Fn.item;return{props:e?{...e,onFocus:void 0}:Ue,id:ye,selectionMode:m,disabled:it,readOnly:S,isItemEqualToValue:z}},[Fn.item,ye,m,it,S,z]);X.useContextCallback(`setOpen`,fn),X.useContextCallback(`setInputValue`,cn),X.useContextCallback(`setSelectedValue`,pn),X.useContextCallback(`setIndices`,sn),X.useContextCallback(`handleSelection`,mn),X.useContextCallback(`forceMount`,an),X.useContextCallback(`requestSubmit`,hn),X.useContextCallback(`onOpenChangeComplete`,r),Dg(()=>{X.update({inline:V,popupProps:Ln,listProps:Rn,inputProps:In,triggerProps:nn,itemRoot:zn})});let Bn={id:ye,selectedValue:Y,open:bt,mounted:vn,transitionStatus:yn,items:Ee,inline:V,popupProps:Ln,listProps:Rn,inputProps:In,triggerProps:nn,itemRoot:zn,openMethod:tn,selectionMode:m,name:at,form:b,disabled:it,readOnly:S,required:w,grid:E,virtualized:B,openOnInputClick:M,itemToStringLabel:ke,modal:ie,autoHighlight:dt,isItemEqualToValue:z,submitOnItemClick:ce,hasInputValue:ct};q(()=>{X.update({...Bn,inputOwnsFormValue:m===`none`&&(V||!X.state.inputInsidePopup)})},[X,...Object.values(Bn)]);let Vn=At(T,_e.inputRef),Hn=Z.useMemo(()=>({query:Ct,hasItems:lt,filteredItems:Nt,flatFilteredValues:Pt}),[Ct,lt,Nt,Pt]),Un=Z.useMemo(()=>Array.isArray(It)?``:Jm(It,R),[It,R]),Wn=ot&&Array.isArray(Y)&&Y.length>0,Gn=ot||m===`none`&&Zt?void 0:at,Kn=Z.useMemo(()=>!ot||!Array.isArray(Y)||!at?null:Y.map(e=>{let t=Jm(e,R);return/*#__PURE__*/ (0,Q.jsx)(`input`,{type:`hidden`,form:b,name:at,value:t,disabled:it},t)}),[ot,Y,b,at,R,it]),qn=/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[e.children,/*#__PURE__*/ (0,Q.jsx)(`input`,{..._e.getValidationProps(it,{onFocus(){Xt?Kt?.focus():(We.current||Kt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||it||S)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=K(Ut,e.nativeEvent),i=()=>nt.current.findIndex(e=>Jm(e,R).toLowerCase()===n||je(e).toLowerCase()===n);function a(){if(ot)return;if(m===`none`){cn(t,r);return}let e=i();e===-1&&(e=nt.current.findIndex((e,t)=>{let r=Be.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:nt.current[e];a!=null&&pn?.(a,r)}st&&(an(),we&&i()===-1&&X.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:ye&&Gn==null?`${ye}-hidden-input`:void 0,form:b,name:Gn,autoComplete:oe,disabled:it,required:w&&!Wn,readOnly:S,value:Un,ref:Vn,style:Gn?Se:O,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Kn]});return/*#__PURE__*/ (0,Q.jsx)(kg.Provider,{value:X,children:/*#__PURE__*/ (0,Q.jsx)(Ag.Provider,{value:On,children:/*#__PURE__*/ (0,Q.jsx)(Mg.Provider,{value:lt,children:/*#__PURE__*/ (0,Q.jsx)(jg.Provider,{value:Hn,children:/*#__PURE__*/ (0,Q.jsx)(Ng.Provider,{value:vt,children:qn})})})})})}const i_={...Rt,...ve,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null};function a_(e,t){return e??t}function o_(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function s_(){return Ig().filteredItems.length===0}function c_(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function l_(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}const u_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:f,validationMode:p,validation:m}=C(),{labelId:h}=E(),g=Pg(),_=g.useState(`selectionMode`),y=g.useState(`disabled`),b=g.useState(`readOnly`),x=g.useState(`required`),S=g.useState(`positionerElement`),w=g.useState(`listElement`),T=g.useState(`popupId`),D=g.useState(`triggerProps`),O=g.useState(`inputInsidePopup`),k=g.useState(`id`),A=g.useState(`labelId`),j=g.useState(`open`),M=g.useState(`selectedValue`),N=g.useState(`activeIndex`),P=g.useState(`selectedIndex`),ee=g.useState(`hasSelectedValue`),I=Fg(),L=Lg(),R=F(),z=u||y||a,B=s_(),V=o_(g),ne=Z.useRef(null),re=ut(z,ne);v({id:O?o:void 0});let H=O?o??k:o,ie=a_(h,A),U;j&&O?U=T??Xg(k):j&&(U=w?.id);let ae=Z.useRef(``);function oe(e){ae.current=e.pointerType}let{reference:se}=Ts(I,{enabled:!j&&!b&&!y&&_===`single`,listRef:g.context.labelsRef,activeIndex:N,selectedIndex:P,onMatch(e){let t=g.context.valuesRef.current[e];t!==void 0&&g.context.setSelectedValue(t,K(Ut))}}),{reference:ce}=as(I,{enabled:!y,event:`mousedown`}),{buttonRef:le,getButtonProps:ue}=tt({native:i,disabled:z}),de={...l,readOnly:b,open:j,disabled:z,popupSide:V,listEmpty:B,placeholder:_!==`none`&&!ee},W=J(e=>{g.set(`triggerElement`,e)});return Ee(`button`,e,{ref:[t,le,ne,W],state:de,props:[D,ce,se,{id:H,tabIndex:O?0:-1,role:O?`combobox`:void 0,"aria-expanded":j,"aria-haspopup":O?`dialog`:`listbox`,"aria-controls":U,"aria-required":O&&x||void 0,"aria-readonly":O&&b||void 0,"aria-labelledby":ie,onPointerDown:oe,onPointerEnter:oe,onFocus(){re(!0),!z&&R.start(0,g.context.forceMount)},onBlur(e){if(!d(S,e.relatedTarget)&&(f(!0),re(!1),p===`onBlur`)){let e=_===`none`?L:M;m.commit(e)}},onMouseDown(e){if(z||(O||I.set(`domReferenceElement`,e.currentTarget),g.context.forceMount(),ae.current!==`touch`&&(g.context.inputRef.current?.focus(),O||e.preventDefault()),j))return;let t=St(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=te(e),r=g.state.positionerElement,i=g.state.listElement;d(t,n)||d(r,n)||d(i,n)||zm(e,t)||g.context.setOpen(!1,K(jt,e))}O&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(_t(e),g.context.setOpen(!0,K(Ye,e.nativeEvent)),g.context.inputRef.current?.focus())}},m.getValidationProps(z,c),ue],stateAttributesMapping:i_})}),d_=/*#__PURE__*/ Z.createContext(void 0);function f_(){return Z.useContext(d_)}const p_=/*#__PURE__*/ Z.createContext(void 0);function m_(e){let t=Z.useContext(p_);if(t===void 0&&!e)throw Error(ft(21));return t}const h_=/*#__PURE__*/ Z.forwardRef(function(e,t){let n=Pg(),{buttonRef:r,getButtonProps:i}=tt({native:!1}),a=At(t,r);function o(e){n.context.setOpen(!1,K(je,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return/*#__PURE__*/ (0,Q.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Se})}),g_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:i,disabled:o=!1,id:s,style:c,...l}=e,{state:u,disabled:d,setTouched:f,validationMode:p,validation:m}=C(),{labelId:h}=E(),g=f_(),_=!!m_(!0),v=Pg(),y=Lg(),b=Mt(),x=v.useState(`required`),S=v.useState(`disabled`),w=v.useState(`readOnly`),T=v.useState(`name`),D=v.useState(`form`),O=v.useState(`selectionMode`),k=v.useState(`autoHighlight`),A=v.useState(`inputProps`),j=v.useState(`triggerProps`),M=v.useState(`open`),N=v.useState(`mounted`),P=v.useState(`selectedValue`),F=v.useState(`id`),I=v.useState(`inline`),R=v.useState(`modal`),z=!!k,B=o_(v),V=d||S||o,te=s_(),ne=ut(V,v.context.inputRef),re=_||I,H=!re||R,ie=ee(s??(re?void 0:F)),U=_?pe:u,[ae,oe]=Z.useState(null),se=Z.useRef(!1),ce=Z.useRef(null);q(()=>{M||(ce.current=null)},[M]);let le=O===`none`&&!_,ue=J(e=>{let t=_||v.state.inline;t&&!v.state.hasInputValue&&v.context.setInputValue(``,K(Ut)),v.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:le})}),de=_?l:m.getValidationProps(V,l);function W(e){v.context.setIndices({activeIndex:null,selectedIndex:null,type:Rm(e),event:e})}let fe={...U,open:M,disabled:V,readOnly:w,popupSide:B,listEmpty:te};function G(e){if(!g)return;let t,n=g.chipsRef.current.length,[r]=c_(b);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&P.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let me=Ee(`input`,e,{state:fe,ref:[t,v.context.inputRef,ue],props:[A,j,{value:ae??y,"aria-readonly":w||void 0,"aria-required":x||void 0,"aria-labelledby":h,disabled:V,readOnly:w,required:O===`none`?x:void 0,form:D,...le&&T&&{name:T},id:ie,onFocus(){if(ne(!0),!I)return;let e=ce.current;ce.current=null,e!=null&&Object.hasOwn(v.context.valuesRef.current,e)&&v.context.setIndices({activeIndex:e})},onBlur(){f(!0),ne(!1);let e=v.state.activeIndex;if(I&&e!==null&&k!==`always`&&(ce.current=e,v.context.setIndices({activeIndex:null})),p===`onBlur`){let e=O===`none`?y:P;m.commit(e)}},onCompositionStart(e){L||(se.current=!0,oe(e.currentTarget.value))},onCompositionEnd(e){se.current=!1;let t=e.currentTarget.value;oe(null),v.context.setInputValue(t,K(Ve,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=se.current||!r;function a(e){!w&&!V&&e&&i&&(v.context.setOpen(!0,K(Ve,t)),z||W(t))}if(se.current){let n=e.currentTarget.value;oe(n),n===``&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.context.setOpen(!1,K(Ke,t));let r=n.trim(),i=z&&r!==``;a(r),M&&v.state.activeIndex!==null&&!i&&W(t);return}let o=K(Ve,t);if(v.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=K(Ke,t);s&&!v.state.inputInsidePopup&&(O===`single`&&v.context.setSelectedValue(null,c),v.state.openOnInputClick||v.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),M&&v.state.activeIndex!==null&&!z&&W(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(V||w){w&&e.key===`Enter`&&M&&v.state.activeIndex!==null&&_t(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,i=b===`rtl`;if(e.key===`Home`){_t(e);let n=r&&i?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){_t(e);let a=r&&i?0:t.value.length;t.setSelectionRange(a,a),t.scrollLeft=i?-n:n;return}if(!N&&e.key===`Escape`){let t=O===`multiple`&&Array.isArray(P)?P.length===0:P===null,n=K(Pt,e.nativeEvent),r=O===`multiple`?[]:null;v.context.setInputValue(``,n),v.context.setSelectedValue(r,n),!t&&!v.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(g&&e.key===`Backspace`&&t.value===``&&Array.isArray(P)&&P.length>0){let t=g.chipsRef.current.length,n=t>0?t-1:P.length-1,r=P.filter((e,t)=>t!==n);W(e.nativeEvent),v.context.setSelectedValue(r,K(Ut,e.nativeEvent));return}let a=G(e);if(a!==void 0&&g?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&M){let t=v.state.activeIndex,n=e.nativeEvent;if(t===null){if(I)return;v.context.setOpen(!1,K(Ut,n));return}_t(e),l_(v,t,n)}}},de],stateAttributesMapping:i_}),he=_?/*#__PURE__*/ (0,Q.jsx)(ge.Provider,{value:a,children:me}):me;return/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[M&&H&&/*#__PURE__*/ (0,Q.jsx)(h_,{ref:v.context.startDismissRef}),he]})}),__={...Vt,...Be},v_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,disabled:a=!1,nativeButton:o=!0,keepMounted:s=!1,style:c,...l}=e,{disabled:u}=C(),d=Pg(),f=d.useState(`selectionMode`),p=d.useState(`disabled`),m=d.useState(`readOnly`),h=d.useState(`open`),g=d.useState(`selectedValue`),_=d.useState(`hasSelectionChips`),v=Lg(),y=!1;y=f===`none`?v!==``:f===`single`?g!=null:_;let b=u||p||a,{buttonRef:x,getButtonProps:S}=tt({native:o,disabled:b}),{mounted:w,transitionStatus:T,setMounted:E}=i(y),D={disabled:b,visible:y,open:h,transitionStatus:T};ot({open:y,ref:d.context.clearRef,onComplete(){y||E(!1)}});let O=Ee(`button`,e,{state:D,ref:[t,x,d.context.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||m)return;let t=Rm(e);d.context.setInputValue(``,K(nt,e.nativeEvent)),f===`none`?d.context.setIndices({activeIndex:null,type:t,event:e.nativeEvent}):(d.context.setSelectedValue(Array.isArray(g)?[]:null,K(nt,e.nativeEvent)),d.context.setIndices({activeIndex:null,selectedIndex:null,type:t,event:e.nativeEvent})),d.context.inputRef.current?.focus()}},l,S],stateAttributesMapping:__});return s||w?O:null}),y_=/*#__PURE__*/ Z.createContext(null);function b_(){return Z.useContext(y_)}function x_(e){let{children:t,items:n}=e,r=Z.useMemo(()=>({items:n}),[n]);return/*#__PURE__*/ (0,Q.jsx)(y_.Provider,{value:r,children:t})}function S_(e){let{children:t}=e,{filteredItems:n}=Ig(),r=b_(),i=r?r.items:n;return/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:i.map(t)})}const C_=/*#__PURE__*/ Z.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=Pg(),l=Fg(),u=!!m_(!0),{filteredItems:d,hasItems:f}=Ig(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),v=c.useState(`forceMounted`),y=p===`multiple`,b=d.length===0,x=J(e=>{c.set(`positionerElement`,e)}),S=J(e=>{c.set(`listElement`,e)}),C=Z.useMemo(()=>typeof o==`function`?n||=/*#__PURE__*/ (0,Q.jsx)(S_,{children:o}):o,[o]),w={empty:b},T=l.useState(`floatingId`),E=Ee(`div`,e,{state:w,ref:[t,S,u?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:m?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,"aria-readonly":!m&&h?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;_t(e),l_(c,t,e.nativeEvent)}}},s]});if(_)return E;let D=f&&!v?void 0:c.context.labelsRef;return/*#__PURE__*/ (0,Q.jsx)(Am,{elementsRef:c.context.listRef,labelsRef:D,children:E})}),w_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=eh();return Ee(`div`,e,{ref:[t,s],props:[{children:a,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),T_=/*#__PURE__*/ Z.createContext(void 0);function E_(){let e=Z.useContext(T_);if(e===void 0)throw Error(ft(20));return e}const D_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Pg(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?/*#__PURE__*/ (0,Q.jsx)(T_.Provider,{value:n,children:/*#__PURE__*/ (0,Q.jsx)(he,{ref:t,...r})}):null}),O_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=_e,style:g,..._}=e,v=Pg(),y=Fg(),b=E_(),x=v.useState(`modal`),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`openMethod`),T=v.useState(`positionerElement`),E=v.useState(`triggerElement`),D=v.useState(`inputElement`),O=v.useState(`inputGroupElement`),k=v.useState(`inputInsidePopup`),A=v.useState(`transitionStatus`),j=s_(),M=bt({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});Lm(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};q(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=J(e=>{v.set(`positionerElement`,e)}),ee=$e(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return/*#__PURE__*/ (0,Q.jsxs)(p_.Provider,{value:M,children:[C&&x&&/*#__PURE__*/ (0,Q.jsx)(Cm,{inert:Es(!S),cutout:O??D??E}),ee]})}),k_={...Le,...Vt},A_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Pg(),l=m_(),u=Fg(),f=c.useState(`mounted`),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`popupProps`),g=c.useState(`transitionStatus`),_=c.useState(`inputInsidePopup`),v=c.useState(`inputElement`),y=c.useState(`modal`),b=c.useState(`id`),x=s_(),S=s.id??(_?Xg(b):void 0);q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||S),()=>{c.set(`popupId`,void 0)}),[c,S]),ot({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete(!0)}});let C={open:p,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:g,empty:x},w=Ee(`div`,e,{state:C,ref:[t,c.context.popupRef],props:[h,{id:S,role:_?`dialog`:`presentation`,onFocus(e){let t=te(e.nativeEvent);m!==`touch`&&(d(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},ke(g),s],stateAttributesMapping:k_}),T=a===void 0?_?e=>e===`touch`?c.context.popupRef.current:v:!1:a,E;E=o??(_?void 0:!1);let D=!_||y;return/*#__PURE__*/ (0,Q.jsx)(is,{context:u,disabled:!f,modal:D,openInteractionType:m,initialFocus:T,returnFocus:E,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[w,D&&/*#__PURE__*/ (0,Q.jsx)(h_,{ref:c.context.endDismissRef})]})})}),j_=/*#__PURE__*/ Z.createContext(void 0);function M_(){let e=Z.useContext(j_);if(e===void 0)throw Error(ft(18));return e}const N_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=Pg().useState(`grid`),[c,l]=Z.useState(),u=Z.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=Ee(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=/*#__PURE__*/ (0,Q.jsx)(j_.Provider,{value:u,children:d});return a?/*#__PURE__*/ (0,Q.jsx)(x_,{items:a,children:f}):f}),P_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=M_(),c=ee(a);return q(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),Ee(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),F_=/*#__PURE__*/ Z.createContext(void 0);function I_(){let e=Z.useContext(F_);if(!e)throw Error(ft(19));return e}const L_=/*#__PURE__*/ Z.createContext(!1);function R_(){return Z.useContext(L_)}function z_(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Z.useRef(null),m=km({guess:!0,index:l,textRef:p}),h=Pg(),g=R_(),_=Rg(),{props:v,id:y,selectionMode:b,disabled:x,readOnly:S,isItemEqualToValue:C}=h.useState(`itemRoot`),w=x||u,T=b!==`none`,E=l??i??m.index,D=E!==-1,O=h.useState(`isActive`,E),k=h.useState(`isSelected`,c),A=Z.useRef(null),j=y!=null&&D?`${y}-${E}`:void 0,M=k&&T;q(()=>{if(!D||!r&&l==null)return;let e=h.context.listRef.current;return e[E]=A.current,()=>{delete e[E]}},[D,r,E,l,h]),q(()=>{if(!D||_)return;let e=h.context.valuesRef.current;return e[E]=c,()=>{delete e[E]}},[D,_,E,c,h]),q(()=>{if(!D||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=qg(E,c,h.context.valuesRef.current,e,C,t):Vg(c,e,C)&&(t=E),h.set(`selectedIndex`,t)},[D,_,h,E,c,C]);let{getButtonProps:N,buttonRef:P}=tt({disabled:w,focusableWhenDisabled:!0,native:d,composite:!0}),ee={disabled:w,selected:M,highlighted:O};function F(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(Ta.flushSync(t),h.context.requestSubmit()):t()}let I={id:j,role:g?`gridcell`:`option`,"aria-selected":T?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){w||S||F(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(w||S||e.button!==0||t||!O)&&F(e.nativeEvent)}},L=Ee(`div`,t,{ref:[P,n,m.ref,A],state:ee,props:[v,I,f,N]}),R=Z.useMemo(()=>({selected:M,textRef:p}),[M,p]);return/*#__PURE__*/ (0,Q.jsx)(F_.Provider,{value:R,children:L})}function B_(e){let{componentProps:t,forwardedRef:n}=e,r=Pg().useState(`isItemEqualToValue`),{flatFilteredValues:i}=Ig(),a=Wg(i,t.value??null,r);return/*#__PURE__*/ (0,Q.jsx)(z_,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}const V_=/*#__PURE__*/ Z.memo(/*#__PURE__*/ Z.forwardRef(function(e,t){let n=Pg().useState(`virtualized`);return n&&e.index==null?/*#__PURE__*/ (0,Q.jsx)(B_,{componentProps:e,forwardedRef:t}):/*#__PURE__*/ (0,Q.jsx)(z_,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),H_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=Ig(),c=Pg(),l=eh(),u=s.length===0?a:null;return Ee(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function U_(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return/*#__PURE__*/ (0,Q.jsx)(r_,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}function W_(e){let{children:t,placeholder:n}=e,r=Pg(),i=r.useState(`itemToStringLabel`),a=r.useState(`selectedValue`),o=r.useState(`items`),s=r.useState(`selectionMode`)===`multiple`,c=r.useState(`hasSelectedValue`),l=!c&&n!=null&&t==null,u=r.useState(`hasNullItemLabel`,l),d=null;return d=typeof t==`function`?t(a):t??(!c&&n!=null&&!u?n:s&&Array.isArray(a)?Xm(a,o,i):Ym(a,o,i)),/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:d})}const G_=/*#__PURE__*/ Z.memo(/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:a,keepMounted:o,selected:s,...c}=e,l=Z.useRef(null),{transitionStatus:u,setMounted:d}=i(s),f=Ee(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},c],stateAttributesMapping:Vt});return ot({batch:!0,enabled:!s,open:s,ref:l,onComplete(){s||d(!1)}}),f})),K_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{selected:n}=I_();return e.keepMounted||n?/*#__PURE__*/ (0,Q.jsx)(G_,{...e,selected:n,ref:t}):null});var q_=Bt();const J_=(0,Z.createContext)(null);function Y_(){return(0,Z.useContext)(J_)?.defaultOptions??{}}function X_(e){return typeof e==`function`}function Z_(e,...t){return X_(e)?e(...t):e}var Q_=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}};const $_=/* @__PURE__ */ new Map;function ev(e,t){$_.set(e,t)}function tv(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function nv(e){return typeof e.get==`function`?e.get():e.state}function rv(e){return{key:e.key,store:{state:tv(nv(e.store))},options:tv(e.options)}}var iv=class extends Q_{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}};const av=(e,t)=>{let n=t.key;n&&(ev(n,t),ov.emit(e,rv({...t,key:n})))},ov=new iv;function sv(e,t){return e===t}function cv(e,t=e=>e,n){let r=n?.compare??sv,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,q_.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function lv(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}const uv={enabled:!0,leading:!1,trailing:!0,wait:0};var dv=class{#e;constructor(e,t){this.fn=e,this.store=new bn(lv()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),av(`Debouncer`,this)},this.#n=()=>!!Z_(this.options.enabled,this),this.#r=()=>Z_(this.options.wait,this),this.maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())},this.#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})},this.reset=()=>{this.#t(lv())},this.key=t.key,this.options={...uv,...t},this.#t(this.options.initialState??{}),this.key&&ov.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a};function fv(e,t,n=()=>({})){let r={...Y_().debouncer,...t},[i]=(0,Z.useState)(()=>{let t=new dv(e,r);return t.Subscribe=function(e){let n=cv(t.store,e.selector,{compare:xn});return typeof e.children==`function`?e.children(n):e.children},t});i.fn=e,i.setOptions(r),(0,Z.useEffect)(()=>()=>{r.onUnmount?r.onUnmount(i):i.cancel()},[]);let a=cv(i.store,n,{compare:xn});return(0,Z.useMemo)(()=>({...i,state:a}),[i,a])}function pv(e,t,n){let[r,i]=(0,Z.useState)(e),a=fv(i,t,n);return[r,a.maybeExecute,a]}function mv(e,t,n){let[r,i,a]=pv(e,t,n);return(0,Z.useEffect)(()=>{i(e)},[e,i]),[r,a]}const hv=U_,gv=w_;function _v({...e}){return/* @__PURE__ */ (0,Q.jsx)(W_,{"data-slot":`combobox-value`,...e})}function vv({className:e,children:t,...n}){return/* @__PURE__ */ (0,Q.jsxs)(u_,{"data-slot":`combobox-trigger`,className:k(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,/* @__PURE__ */ (0,Q.jsx)(Gt,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function yv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(v_,{"aria-label":`Clear selection`,"data-slot":`combobox-clear`,render:/* @__PURE__ */ (0,Q.jsx)(Ma,{variant:`ghost`,size:`icon-xs`}),className:k(e),...t,children:/* @__PURE__ */ (0,Q.jsx)(ya,{className:`pointer-events-none`})})}function bv({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return/* @__PURE__ */ (0,Q.jsxs)(Oa,{className:k(`w-auto`,e),children:[/* @__PURE__ */ (0,Q.jsx)(g_,{render:/* @__PURE__ */ (0,Q.jsx)(Na,{disabled:n}),...a}),/* @__PURE__ */ (0,Q.jsxs)(Aa,{align:`inline-end`,children:[r&&/* @__PURE__ */ (0,Q.jsx)(Ma,{size:`icon-xs`,variant:`ghost`,render:/* @__PURE__ */ (0,Q.jsx)(vv,{}),"aria-label":`Show options`,"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&/* @__PURE__ */ (0,Q.jsx)(yv,{disabled:n})]}),t]})}function xv({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,container:o,collisionBoundary:s,...c}){return/* @__PURE__ */ (0,Q.jsx)(D_,{container:o,children:/* @__PURE__ */ (0,Q.jsx)(O_,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,collisionBoundary:s,className:`isolate z-50`,children:/* @__PURE__ */ (0,Q.jsx)(A_,{"data-slot":`combobox-content`,"data-chips":!!a,className:k(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c})})})}const Sv=Z.forwardRef(function({className:e,...t},n){return/* @__PURE__ */ (0,Q.jsx)(C_,{ref:n,"data-slot":`combobox-list`,className:k(`max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})});function Cv({className:e,children:t,...n}){return/* @__PURE__ */ (0,Q.jsxs)(V_,{"data-slot":`combobox-item`,className:k(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,/* @__PURE__ */ (0,Q.jsx)(K_,{render:/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`pointer-events-none absolute end-2 flex size-4 items-center justify-center`}),children:/* @__PURE__ */ (0,Q.jsx)(ra,{className:`pointer-events-none`})})]})}function wv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(N_,{"data-slot":`combobox-group`,className:k(e),...t})}function Tv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(P_,{"data-slot":`combobox-label`,className:k(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function Ev({...e}){return/* @__PURE__ */ (0,Q.jsx)(S_,{"data-slot":`combobox-collection`,...e})}function Dv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(H_,{"data-slot":`combobox-empty`,className:k(`w-full text-center text-sm text-muted-foreground [&:not(:empty)]:py-2`,e),...t})}export{Lo as $,Ir as $t,Rm as A,ar as An,ga as At,Gp as B,mi as Bt,ch as C,Er as Cn,Pa as Ct,rh as D,mr as Dn,Sa as Dt,th as E,br as En,Ca as Et,Tm as F,Tn as Fn,$i as Ft,Ps as G,ti as Gt,Yc as H,pi as Ht,Cm as I,En as In,Ai as It,Ts as J,ci as Jt,Ns as K,di as Kt,Sm as L,xn as Ln,ji as Lt,Am as M,Pn as Mn,ia as Mt,km as N,Dn as Nn,ra as Nt,nh as O,vr as On,ya as Ot,Em as P,On as Pn,na as Pt,Io as Q,Lr as Qt,dm as R,hn as Rn,_i as Rt,gh as S,wr as Sn,Aa as St,Ah as T,gr as Tn,wa as Tt,Gc as U,oi as Ut,Wp as V,hi as Vt,Ms as W,ni as Wt,as as X,ri as Xt,ws as Y,li as Yt,is as Z,ai as Zt,Tg as _,rr as _n,Za as _t,wv as a,Nr as an,ko as at,Rh as b,Wn as bn,Ia as bt,Tv as c,Ar as cn,Co as ct,vv as d,$n as dn,Xa as dt,Hr as en,To as et,_v as f,ur as fn,Ya as ft,Eg as g,Xn as gn,Ha as gt,u_ as h,Hn as hn,Va as ht,Dv as i,kr as in,No as it,Lm as j,Jn as jn,la as jt,zm as k,Sr as kn,_a as kt,Sv as l,tr as ln,vo as lt,cv as m,Rn as mn,Ba as mt,Ev as n,Pr as nn,Oo as nt,bv as o,jr as on,_o as ot,mv as p,Zn as pn,Ja as pt,Es as q,fi as qt,xv as r,Mr as rn,Ao as rt,Cv as s,Fr as sn,go as st,hv as t,Ur as tn,jo as tt,gv as u,sr as un,oo as ut,fg as v,In as vn,Ua as vt,bh as w,Or as wn,xa as wt,Ph as x,Bn as xn,Oa as xt,cg as y,Kn as yn,Ga as yt,Kp as z,vn as zn,gi as zt};
|
|
42
|
+
`):qa(t)}function em({part:e,active:t}){let n=_i(e).web,r=[...new Map((n?.sources??[]).flatMap(e=>{let t=vi(e.url);return t?[[t,{...e,url:t}]]:[]})).values()],i=e.state!==`complete`&&e.state!==`error`,a=t&&i;return/* @__PURE__ */ (0,Q.jsxs)(Kp,{running:a,failed:e.state===`error`,icon:e.state===`error`?/* @__PURE__ */ (0,Q.jsx)(_a,{}):a?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(fa,{}),label:e.state===`error`?`Web retrieval failed`:a?`Searching and reading the web`:i?`Web retrieval unfinished`:r.length?`Consulted ${r.length} source${r.length===1?``:`s`}`:`Web retrieval complete`,children:[/* @__PURE__ */ (0,Q.jsx)(vl,{children:r.map(e=>/* @__PURE__ */ (0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`nofollow noopener noreferrer`,referrerPolicy:`no-referrer`,className:`min-w-0 flex-col items-start any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11 any-pointer-coarse:justify-center`,children:[/* @__PURE__ */ (0,Q.jsx)(yl,{children:/* @__PURE__ */ (0,Q.jsxs)(xl,{className:`whitespace-normal wrap-anywhere`,children:[e.title&&e.title!==e.url?e.title:new URL(e.url).pathname,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})}),/* @__PURE__ */ (0,Q.jsx)(Sl,{className:`min-w-0 text-xs wrap-anywhere`,children:new URL(e.url).hostname})]},e.url))}),r.length===0&&/* @__PURE__ */ (0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a?`Sources appear here as retrieval finishes.`:`No source links were returned.`})]})}function tm({children:e}){return/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:e})]})}function nm({running:e,children:t}){return/* @__PURE__ */ (0,Q.jsx)(vl,{children:/* @__PURE__ */ (0,Q.jsxs)(yl,{status:e?`running`:void 0,children:[/* @__PURE__ */ (0,Q.jsx)(bl,{children:e?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(va,{})}),/* @__PURE__ */ (0,Q.jsx)(xl,{className:`whitespace-normal wrap-anywhere`,"aria-live":e?`polite`:void 0,children:t})]})})}function rm({part:e,title:t,failed:n,readOnly:r=!1}){let i=mi(e),a=!r&&!n&&!i,o=t?/* @__PURE__ */ (0,Q.jsxs)(`span`,{children:[`“`,t,`”`]}):/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),s=n?e.output?.error:void 0;return/* @__PURE__ */ (0,Q.jsx)(Kp,{icon:n?/* @__PURE__ */ (0,Q.jsx)(_a,{}):a?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(va,{}),running:a,failed:n,label:n?/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[o,` failed`]}):/* @__PURE__ */ (0,Q.jsxs)(Q.Fragment,{children:[r?`Saved`:a?`Running`:`Ran`,` `,o]}),detail:typeof s==`string`&&s.length>0?/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`block text-muted-foreground`,children:s}):void 0,children:/* @__PURE__ */ (0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[/* @__PURE__ */ (0,Q.jsx)(up,{title:`Input`,language:`json`,wrap:!0,children:qa(e.input)||`—`}),/* @__PURE__ */ (0,Q.jsx)(up,{title:`Output`,language:`json`,wrap:!0,children:i?qa(e.output)||`—`:r?`No saved result.`:`Waiting for the result…`})]})})}function im({part:e,widgets:t,activeSlots:n}){let r=e.input,i=r?Ha(t,r.widget):void 0;if(!r||!i)return mi(e)?/* @__PURE__ */ (0,Q.jsx)(tm,{children:`This widget is unavailable.`}):/* @__PURE__ */ (0,Q.jsx)(nm,{running:!0,children:`Preparing a widget`});let a=Ua(e.widgetRenderId??e.id);return n.has(a)?/* @__PURE__ */ (0,Q.jsx)(`slot`,{name:a}):mi(e)?/* @__PURE__ */ (0,Q.jsxs)(tm,{children:[`Widget `,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:r.widget}),` is unavailable.`]}):/* @__PURE__ */ (0,Q.jsxs)(nm,{running:!0,children:[`Rendering `,/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:r.widget})]})}function am({part:e,onQuestionnaireAnswers:t}){if(e.output!=null){let t=e.output.skipped===!0;return/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(ra,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:t?`Questionnaire skipped`:`Answers sent`})]})}if(e.state!==`input-complete`)return/* @__PURE__ */ (0,Q.jsx)(nm,{running:!0,children:`Preparing a questionnaire`});let n=Ka(e.input);return n.length===0?/* @__PURE__ */ (0,Q.jsx)(tm,{children:`The questionnaire could not be displayed`}):/* @__PURE__ */ (0,Q.jsx)(Ou,{items:n,onAnswers:n=>t(e.id,n)})}function om({readOnly:e=!1,part:t,widgets:n,toolTitles:r,serverToolTitles:i,streaming:a=!1,activeSlots:o,onQuestionnaireAnswers:s,interactiveToolIds:c,interrupted:l}){switch(t.type){case`image`:case`document`:case`audio`:case`video`:return/* @__PURE__ */ (0,Q.jsx)(Hp,{part:t});case`text`:return/* @__PURE__ */ (0,Q.jsx)(qc,{variant:`ghost`,children:/* @__PURE__ */ (0,Q.jsx)(Jc,{children:/* @__PURE__ */ (0,Q.jsx)(Bp,{citations:_i(t).web?.citations,children:yi(t.content,_i(t).web?.citations??[])})})});case`thinking`:return/* @__PURE__ */ (0,Q.jsx)(Vp,{content:t.content,running:a&&!e&&!l});case`tool-call`:{if(_i(t).providerExecuted)return/* @__PURE__ */ (0,Q.jsx)(em,{part:t,active:a&&!e&&!l});let u=t.savedToolTitle??(Object.hasOwn(r,t.name)?r[t.name]:void 0);if(e)return xi(t.name)&&mi(t)?/* @__PURE__ */ (0,Q.jsx)(qp,{part:t}):/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:t.state===`error`,readOnly:!0});if(l&&!mi(t))return/* @__PURE__ */ (0,Q.jsx)(tm,{children:`This action request was interrupted.`});if(t.resultOutcome===`unknown`)return/* @__PURE__ */ (0,Q.jsxs)(tm,{children:[`The outcome of `,u??t.name,` is unknown. It was not retried.`]});let d=a&&(xi(t.name)||i!==void 0&&Object.hasOwn(i,t.name));return!c.has(t.id)&&!d&&!mi(t)?/* @__PURE__ */ (0,Q.jsxs)(nm,{running:!1,children:[`Waiting for a confirmed result from`,` `,u??/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`font-mono`,children:t.name}),`.`]}):xi(t.name)?/* @__PURE__ */ (0,Q.jsx)(qp,{part:t}):t.state===`error`?/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:!0}):t.name===`render_widget`?/* @__PURE__ */ (0,Q.jsx)(im,{part:t,widgets:n,activeSlots:o}):t.name===`ask_questionnaire`?/* @__PURE__ */ (0,Q.jsx)(am,{part:t,onQuestionnaireAnswers:s}):/* @__PURE__ */ (0,Q.jsx)(rm,{part:t,title:u,failed:!1})}default:return null}}var sm=class extends Z.Component{constructor(...e){super(...e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:`Part of this response could not be displayed`})]}):this.props.children}};const cm=`[content-visibility:visible]`,lm=e=>{let t=e.metadata?.astralbeam;return e.role!==`assistant`||t?.state===`interrupted`||t?.state===`draft`||e.parts.some(e=>e.type!==`text`&&e.type!==`thinking`||e.content.length>0)},um=(0,Z.memo)(function({message:e,streaming:t,readOnly:n,latestTurn:r,currentTenantUserId:i,widgets:a,toolTitles:o,serverToolTitles:s,activeSlots:c,interactiveToolIds:l,onQuestionnaireAnswers:u}){let d=e.metadata?.astralbeam,f=t&&!n&&e.role===`assistant`&&d?.state!==`interrupted`,p=e.role===`user`&&i!==void 0&&d?.authorTenantUserId!=null&&d.authorTenantUserId!==i;return/* @__PURE__ */ (0,Q.jsx)(Uc,{messageId:e.id,className:r?cm:void 0,children:/* @__PURE__ */ (0,Q.jsx)(Fs,{align:e.role===`user`&&!p?`end`:`start`,children:/* @__PURE__ */ (0,Q.jsxs)(Is,{className:`gap-1`,children:[p&&/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Participant`}),e.role===`user`?/* @__PURE__ */ (0,Q.jsx)(Up,{message:e}):e.parts.map((t,r)=>/* @__PURE__ */ (0,Q.jsx)(sm,{children:/* @__PURE__ */ (0,Q.jsx)(om,{readOnly:n,part:t,widgets:a,toolTitles:o,serverToolTitles:s,streaming:f&&(t.type!==`thinking`||r===e.parts.length-1),activeSlots:c,interactiveToolIds:l,interrupted:d?.state===`interrupted`,onQuestionnaireAnswers:u})},t.type===`tool-call`?t.id:r)),e.role===`assistant`&&d?.state===`interrupted`&&/* @__PURE__ */ (0,Q.jsxs)(Ms,{children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:`Response interrupted. The saved content may be incomplete.`})]}),e.role===`assistant`&&d?.state===`draft`&&/* @__PURE__ */ (0,Q.jsxs)(Ms,{role:`status`,children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:f?/* @__PURE__ */ (0,Q.jsx)(Gc,{}):/* @__PURE__ */ (0,Q.jsx)(_a,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{children:f?`Response in progress.`:`Saved partial response. Completion has not been recorded.`})]})]})})})});function dm({readOnly:e=!1,messages:t,emptySlot:n,emptyHeadline:r,emptyDescription:i,widgets:a,toolTitles:o,serverToolTitles:s,streaming:c=!1,activeSlots:l,interactiveToolIds:u,currentTenantUserId:d,hasOlder:f,loadingHistory:p=!1,loadingOlder:m,onLoadOlder:h,isBusy:g,awaitingReply:_,onQuestionnaireAnswers:v}){let y=(0,Z.useRef)(!1),b=(0,Z.useRef)(null),x=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{let e=b.current;if(!e||!f||m||p)return;let n=n=>{e.scrollTop>100||y.current||(n||x.current!==t)&&(x.current=t,y.current=!0,h().finally(()=>{y.current=!1}))},r=requestAnimationFrame(()=>n());return e.addEventListener(`scroll`,n),()=>{cancelAnimationFrame(r),e.removeEventListener(`scroll`,n)}},[f,m,p,t,h]);let S=t.filter(lm),C=S.findLastIndex(e=>e.role===`user`);return p&&t.length===0?/* @__PURE__ */ (0,Q.jsxs)(`div`,{role:`status`,className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[/* @__PURE__ */ (0,Q.jsx)(Gc,{}),` Loading conversation…`]}):t.length===0&&!f?n?/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`h-full overflow-y-auto`,children:/* @__PURE__ */ (0,Q.jsx)(`slot`,{name:n})}):/* @__PURE__ */ (0,Q.jsx)(Ds,{className:`h-full`,children:/* @__PURE__ */ (0,Q.jsxs)(Os,{children:[/* @__PURE__ */ (0,Q.jsx)(ks,{children:r??`Ask the assistant`}),/* @__PURE__ */ (0,Q.jsx)(As,{children:i??`Ask a question or describe what you want to do in this app.`})]})}):/* @__PURE__ */ (0,Q.jsx)(zc,{autoScroll:!e,children:/* @__PURE__ */ (0,Q.jsxs)(Bc,{className:`h-full`,children:[m&&/* @__PURE__ */ (0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center`,role:`status`,children:/* @__PURE__ */ (0,Q.jsxs)(`span`,{className:`flex items-center gap-2 rounded-md bg-background px-3 py-1 text-sm text-muted-foreground shadow-sm`,children:[/* @__PURE__ */ (0,Q.jsx)(Gc,{}),`Loading earlier messages…`]})}),/* @__PURE__ */ (0,Q.jsx)(Vc,{preserveScrollOnPrepend:!0,ref:b,children:/* @__PURE__ */ (0,Q.jsxs)(Hc,{"aria-busy":g,className:`gap-3 px-(--card-spacing) py-2`,children:[S.map((n,r)=>/* @__PURE__ */ (0,Q.jsx)(um,{message:n,latestTurn:r>=C,streaming:c&&n===t.at(-1),readOnly:e,currentTenantUserId:d,widgets:a,toolTitles:o,serverToolTitles:s,activeSlots:l,interactiveToolIds:u,onQuestionnaireAnswers:v},n.id)),_&&/* @__PURE__ */ (0,Q.jsx)(Uc,{messageId:`astralbeam-thinking`,className:cm,children:/* @__PURE__ */ (0,Q.jsxs)(Ms,{role:`status`,children:[/* @__PURE__ */ (0,Q.jsx)(Ns,{children:/* @__PURE__ */ (0,Q.jsx)(Gc,{})}),/* @__PURE__ */ (0,Q.jsx)(Ps,{className:`shimmer`,children:`Thinking…`})]})})]})}),/* @__PURE__ */ (0,Q.jsx)(Wc,{})]})})}let fm={},pm={},mm=``;function hm(e,t){return W(e)?e:t}function gm(e,t,n){return/hidden|clip/.test(e.getComputedStyle(hm(t,n)).overflowY)}function _m(e){if(typeof document>`u`)return!1;let t=St(e);return Ht(t).innerWidth-t.documentElement.clientWidth>0}function vm(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=St(e),n=t.documentElement,r=t.body,i=hm(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ym(e){let t=St(e),n=t.documentElement,r=t.body,i=hm(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function bm(e){let t=St(e),n=t.documentElement,r=t.body,i=Ht(n),a=0,o=0,s=!1,c=ie.create();if(it&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,fm={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},mm=n.style.scrollBehavior,pm={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=hm(n,r);s=vm(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,fm),Object.assign(r.style,pm),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=mm)}function d(){u(),c.request(l)}l();let f=U(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}const xm=new class{lockCount=0;restore=null;timeoutLock=D.create();timeoutUnlock=D.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=St(e),n=t.documentElement,r=t.body,i=Ht(n);if(gm(i,n,r)){let t=new i.MutationObserver(()=>{gm(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=z||!_m(e);this.restore=a?ym(e):bm(e)}};function Sm(e=!0,t=null){q(()=>{if(e)return xm.acquire(t)},[e,t])}const Cm=/*#__PURE__*/ Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return/*#__PURE__*/ (0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function wm(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Tm(e,t){let{onClick:n,onPointerDown:r}=wm(J((n,r)=>{(typeof e==`function`?e():e)||t(r||(z?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Em(e){let[t,n]=Z.useState(null),r=Tm(e,n);return p(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const Dm=/*#__PURE__*/ Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Om(){return Z.useContext(Dm)}function km(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Om(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function Am(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),[,o]=Z.useState(0),s=wt(Mm).current,c=wt(jm).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=J(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=J((e,t)=>{c.set(e,t),p()}),h=J(e=>{c.delete(e),p()}),g=J(e=>{let t=/* @__PURE__ */ new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Fm(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Im(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=/* @__PURE__ */ new Set;for(let t=1;t<e.length;t+=1){let r=Pm(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=J(()=>{let[e,t]=Nm(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),q(()=>{u.current&&v()}),q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=J(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return/*#__PURE__*/ (0,Q.jsx)(Dm.Provider,{value:b,children:t})}function jm(){return/* @__PURE__ */ new Map}function Mm(){return/* @__PURE__ */ new Set}function Nm(e){let t=/* @__PURE__ */ new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Im(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Pm(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Fm(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Im(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Lm(e,t,n,r){let[i,a]=Z.useState(!1);q(()=>{if(!e||!t||n==null){a(!1);return}let r=St(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-20)},[e,t,n]),Sm(e&&(!t||i),r)}function Rm(e){return e==null?Ut:e.type.startsWith(`key`)?Qe:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Fe:Ut}function zm(e,t){let n=Bm(t);return e.clientX>=n.left-5&&e.clientX<=n.right+5&&e.clientY>=n.top-5&&e.clientY<=n.bottom+5}function Bm(e){let t=e.getBoundingClientRect(),n=Ht(e);if(ct)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function Vm(e){return Array.isArray(e)?e.map(e=>Vm(e)).join(`,`):e==null?``:String(e)}function Hm(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Um(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function Wm(e){return Um(e?.[0])}function Gm(e){return Wm(e)?e.flatMap(e=>e.items):e}function Km(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Wm(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function qm(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Hm(e)}function Jm(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Hm(e.value):Hm(e)}function Ym(e,t,n){function r(){return qm(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Gm(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Xm(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push(/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:Ym(r,t,n)},i)),e),[])}const Zm=/* @__PURE__ */ new Map;function Qm(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${Vm(t)}|${JSON.stringify(r)}`,a=Zm.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=qm(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=qm(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=qm(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return Zm.set(i,s),s}function $m(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function eh(e=!0){let t=F(),n=Z.useRef(null);return Z.useEffect(()=>{if(!e||z)return;let r=n.current;if(r==null)return;let i=$m(r);if(i==null)return;let a=i.data,o=`${a}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}const th=Z.createContext(void 0),nh=e=>{let t=Z.useContext(th);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},rh=({client:e,children:t})=>(Z.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */ (0,Q.jsx)(th.Provider,{value:e,children:t})),ih={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ah=new class{#e=ih;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function oh(e){setTimeout(e,0)}const sh=typeof window>`u`||`Deno`in globalThis;function ch(){}function lh(e,t){return typeof e==`function`?e(t):e}function uh(e){return typeof e==`number`&&e>=0&&e!==1/0}function dh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fh(e,t){return typeof e==`function`?e(t):e}function ph(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==hh(o,t.options))return!1}else if(!_h(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function mh(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(gh(t.options.mutationKey)!==gh(a))return!1}else if(!_h(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function hh(e,t){return(t?.queryKeyHashFn||gh)(e)}function gh(e){return JSON.stringify(e,(e,t)=>Sh(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function _h(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!_h(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!_h(e[r],t[r]))return!1;return!0}return!1}const vh=Object.prototype.hasOwnProperty;function yh(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=xh(e)&&xh(t);if(!r&&!(Sh(e)&&Sh(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:vh.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=yh(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function bh(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function xh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sh(e){if(!Ch(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Ch(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Ch(e){return Object.prototype.toString.call(e)===`[object Object]`}function wh(e){return new Promise(t=>{ah.setTimeout(t,e)})}function Th(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:yh(e,t)}function Eh(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Dh(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const Oh=Symbol();function kh(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Oh?()=>Promise.reject(/* @__PURE__ */ Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ah(e,t){return typeof e==`function`?e(...t):!!e}function jh(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}let Mh=()=>sh;const Nh=()=>Mh();var Ph=class{constructor(){this.listeners=/* @__PURE__ */ new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const Fh=new class extends Ph{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ih=oh;function Lh(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ih,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}const Rh=Lh(),zh=new class extends Ph{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Bh(e){return Math.min(1e3*2**e,3e4)}function Vh(e){return(e??`online`)!==`online`||zh.isOnline()}var Hh=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Uh(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ch);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Hh(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Fh.isFocused()&&(e.networkMode===`always`||zh.isOnline())&&e.canRun(),p=()=>Vh(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Nh()?0:3),a=e.retryDelay??Bh,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),wh(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var Wh=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),uh(this.gcTime)&&(this.#e=ah.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Nh()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(ah.clearTimeout(this.#e),this.#e=void 0)}};function Gh(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{jh(e,()=>t.signal,()=>n=!0)},u=kh(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Dh:Eh;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?qh:Kh,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Kh(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Kh(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function qh(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Jh(e,t){return t?Kh(e,t)!=null:!1}function Yh(e,t){return!t||!e.getPreviousPageParam?!1:qh(e,t)!=null}var Xh=class extends Wh{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=$h(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=$h(this.options);e.data!==void 0&&(this.setState(Qh(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Th(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ch).catch(ch):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>fh(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>fh(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!dh(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=kh(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Gh(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Uh({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Hh&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Hh){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Zh(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Qh(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Rh.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Zh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vh(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Qh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function $h(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var eg=class extends Ph{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=/* @__PURE__ */ new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ng(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rg(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rg(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */ new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof fh(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!bh(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ig(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||fh(this.options.enabled,this.#t)!==fh(t.enabled,this.#t)||fh(this.options.staleTime,this.#t)!==fh(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||fh(this.options.enabled,this.#t)!==fh(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return bh(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ch)),t}#h(e){return!Nh()&&fh(this.options.enabled,this.#t)!==!1&&uh(e)}#g(){this.#b();let e=fh(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=dh(this.#r.dataUpdatedAt,e)+1;this.#u=ah.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return fh(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=ah.setInterval(()=>{(this.options.refetchIntervalInBackground||Fh.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(ah.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(ah.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ng(e,t),o=i&&ig(e,n,t,r);(a||o)&&(l={...l,...Zh(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Th(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Th(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ag(e,t),refetch:this.refetch,isEnabled:fh(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),bh(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Rh.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function tg(e,t){return fh(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||fh(t.retryOnMount,e)!==!1)}function ng(e,t){return tg(e,t)||e.state.data!==void 0&&rg(e,t,t.refetchOnMount)}function rg(e,t,n){if(fh(t.enabled,e)!==!1&&fh(t.staleTime,e)!==`static`){let r=fh(n,e);return r===`always`||r!==!1&&ag(e,t)}return!1}function ig(e,t,n,r){return(e!==t||fh(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ag(e,n)}function ag(e,t){return fh(t.enabled,e)!==!1&&e.isStaleByTime(fh(t.staleTime,e))}var og=class extends eg{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Jh(t,n.data),hasPreviousPage:Yh(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},sg=class extends Wh{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||cg(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Uh({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(/* @__PURE__ */ Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Rh.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function cg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var lg=class extends Ph{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Set,this.#t=/* @__PURE__ */ new Map,this.#n=0}build(e,t,n){let r=new sg({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ug(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ug(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Rh.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>mh(t,e))}findAll(e={}){return this.getAll().filter(t=>mh(e,t))}notify(e){Rh.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Rh.batch(()=>Promise.all(e.map(e=>e.continue().catch(ch))))}};function ug(e){return e.options.scope?.id}var dg=class extends Ph{#e;constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??hh(r,t),a=this.get(i);return a||(a=new Xh({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Rh.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ph(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ph(e,t)):t}notify(e){Rh.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Rh.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rh.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},fg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new dg,this.#t=e.mutationCache||new lg,this.#n=e.defaultOptions||{},this.#r=/* @__PURE__ */ new Map,this.#i=/* @__PURE__ */ new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Fh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=zh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(fh(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=lh(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Rh.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Rh.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Rh.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Rh.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ch).catch(ch)}invalidateQueries(e,t={}){return Rh.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Rh.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(ch)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ch)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(fh(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(fh(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ch).catch(ch)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ch).catch(ch)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return zh.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(gh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_h(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(gh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_h(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=hh(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Oh&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const pg=Z.createContext(!1),mg=()=>Z.useContext(pg);pg.Provider;function hg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const gg=Z.createContext(hg()),_g=()=>Z.useContext(gg),vg=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ah(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},yg=e=>{Z.useEffect(()=>{e.clearReset()},[e])},bg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ah(n,[e.error,r])),xg=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Sg=(e,t)=>e?.suspense&&t.isPending,Cg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wg(e,t,n){let r=mg(),i=_g(),a=nh(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,xg(o),vg(o,i,s),yg(i);let[l]=Z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=d?l.subscribe(Rh.batchCalls(e)):ch;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Z.useEffect(()=>{l.setOptions(o)},[o,l]),Sg(o,u))throw Cg(o,l,i);if(bg({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Tg(e,t){return wg(e,eg,t)}function Eg(e,t){return wg(e,og,t)}function Dg(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Og(e,t,n,r,i,a,o,s,c,l=2){let u=N(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return De(n.current,u)?void 0:u}const kg=/*#__PURE__*/ Z.createContext(void 0),Ag=/*#__PURE__*/ Z.createContext(void 0),jg=/*#__PURE__*/ Z.createContext(void 0),Mg=/*#__PURE__*/ Z.createContext(!1),Ng=/*#__PURE__*/ Z.createContext(``);function Pg(){let e=Z.useContext(kg);if(!e)throw Error(ft(22));return e}function Fg(){let e=Z.useContext(Ag);if(!e)throw Error(ft(23));return e}function Ig(){let e=Z.useContext(jg);if(!e)throw Error(ft(24));return e}function Lg(){return Z.useContext(Ng)}function Rg(){return Z.useContext(Mg)}function zg(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}const Bg=(e,t)=>Object.is(e,t);function Vg(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Hg(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!zg(e,t,(e,t)=>Vg(e,t,n)):e!==t}function Ug(e,t,n){return e?e.some(e=>e!==void 0&&Vg(t,e,n)):!1}function Wg(e,t,n){return e?e.findIndex(e=>e!==void 0&&Vg(e,t,n)):-1}function Gg(e,t){if(t!==Bg)return n=>Ug(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function Kg(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Gg(t,n)):Wg(e,t,n);return i===-1?null:i}function qg(e,t,n,r,i,a){return Ug(r,t,i)?a!=null&&e>a&&Ug(r,n[a],i)?a:e:e===a?Kg(n,r,i,!0):a}function Jg(e,t,n){return e.filter(e=>!Vg(t,e,n))}const Yg={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Km(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>Vg(t,e,n)):Vg(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Xg(e){return e==null?void 0:`${e}-popup`}function Zg(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}const Qg=Qm;function $g(e,t=!1){let{overflowY:n}=ht(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const e_=Symbol(`none`),t_={value:e_,index:-1};function n_(e,t,n){let r=e.get(t);if(r!==void 0||n===Bg)return r;for(let[r,i]of e)if(Vg(r,t,n))return i}function r_(e){let{id:n,onOpenChangeComplete:r,defaultSelectedValue:i=null,selectedValue:a,onSelectedValueChange:o,defaultInputValue:c,inputValue:l,open:u,defaultOpen:f=!1,selectionMode:m,onItemHighlighted:_,name:y,form:b,disabled:x=!1,readOnly:S=!1,required:w=!1,inputRef:T,grid:E=!1,items:D,filteredItems:k,filter:A,filterQuery:j,openOnInputClick:M=!0,autoHighlight:N=!1,keepHighlight:P=!1,highlightItemOnHover:ee=!0,loopFocus:F=!0,itemToStringLabel:L,itemToStringValue:R,isItemEqualToValue:z=Bg,virtualized:B=!1,inline:V=!1,fillInputOnItemPress:ne=!0,modal:ie=!1,limit:U=-1,autoComplete:ae=`list`,formAutoComplete:oe,locale:se,submitOnItemClick:ce=!1}=e,{clearErrors:le}=Qt(),{setDirty:ue,validityData:de,setFilled:W,name:G,disabled:pe,setTouched:me,setFocused:he,validationMode:ge,validation:_e}=C(),ve=Mt(),ye=v({id:n}),xe=Qg({locale:se}),Ce=Array.isArray(D)?null:D;if(Ce&&typeof Ce.label!=`function`)throw Error(ft(100));let we=Ce?Ce.data:D,Te=Ce?.value,Ee=Te?void 0:we,De=Z.useMemo(()=>{if(!k||!Te)return;let e=Gm(k),t=e.map(Te),n;return{values:t,findItem(r,i){if(!n){n=/* @__PURE__ */ new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return n_(n,r,i)}}},[k,Te]),ke=Z.useMemo(()=>Ce?e=>Ce.label(e,z,e=>{let t=De?.findItem(e,z);return t==null?qm(e,L):Ce.itemLabel(t)}):L,[Ce,L,De,z]),Ae=Z.useMemo(()=>Ce?Object.assign(e=>Ce.itemLabel(e),{selected:e=>qm(e,ke)}):L,[Ce,ke,L]);function je(e){return qm(e,ke)}let[Ne,Fe]=Z.useState(!1),[Ie,Le]=Z.useState(null),Re=Z.useRef(Ie),ze=Z.useRef([]),Be=Z.useRef([]),He=Z.useRef(null),We=Z.useRef(null),Ge=Z.useRef(null),qe=Z.useRef(null),Ye=Z.useRef(null),Xe=Z.useRef(!1),Ze=Z.useRef(null),Qe=Z.useRef(null),$e=Z.useRef(null),et=Z.useRef(t_),tt=Z.useRef(null),nt=Z.useRef([]),rt=Z.useRef(null),it=pe||x,at=G??y,ot=m===`multiple`,st=m===`single`,ct=l!==void 0||c!==void 0,lt=we!==void 0,ut=k!==void 0,dt;dt=N===`always`?`always`:N?`input-change`:!1;let[Y,mt]=Yc({controlled:a,default:ot?i??t:i,name:`Combobox`,state:`selectedValue`}),ht=Z.useMemo(()=>A===null?()=>!0:A===void 0?Zg(xe,Ae):A,[A,xe,Ae]),_t=wt(()=>ct?c??``:st?je(Y):``).current,[vt,yt]=Yc({controlled:l,default:_t,name:`Combobox`,state:`inputValue`}),[bt,xt]=Yc({controlled:u,default:f,name:`Combobox`,state:`open`}),St=Wm(we),Ct=!bt&&Ie!==null?Ie:String(vt).trim(),Et=st?je(Y):``,Dt=st&&!Ne&&Ct!==``&&Et.length===Ct.length&&xe.contains(Et,Ct),Ot=Dt?``:j??Ct,kt=lt&&ut&&Dt&&(!Ce||Ce.hasValue(Y,z)),jt=Z.useMemo(()=>we?Gm(we):t,[we]),Nt=Z.useMemo(()=>{if(k&&!kt)return k;if(!we)return t;if(St){let e=we,t=[],n=0;for(let r of e){if(U>-1&&n>=U)break;let e=U>-1?U-n:1/0,i=Ot===``?r.items.slice(0,e):[];if(Ot!==``)for(let t of r.items){if(i.length>=e)break;ht(t,Ot,Ae)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ot===``)return U>-1?jt.slice(0,U):jt;let e=[];for(let t of jt){if(U>-1&&e.length>=U)break;ht(t,Ot,Ae)&&e.push(t)}return e},[k,kt,we,St,Ot,U,ht,Ae,jt]),Pt=Z.useMemo(()=>{if(De&&Nt===k)return De.values;let e=Gm(Nt);return Te?e.map(e=>Te(e)):e},[Nt,k,De,Te]),X=wt(()=>{let e=null;return V&&bt&<&&m!==`none`&&(e=Kg(Pt,Y,z,ot)),new Oe({id:ye,labelId:void 0,selectedValue:Y,open:bt,items:Ee,selectionMode:m,name:at,form:b,disabled:it,readOnly:S,required:w,grid:E,virtualized:B,openOnInputClick:M,itemToStringLabel:ke,isItemEqualToValue:z,modal:ie,autoHighlight:dt,submitOnItemClick:ce,hasInputValue:ct,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:V,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:Ue,id:ye,selectionMode:m,disabled:it,readOnly:S,isItemEqualToValue:z},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:m===`none`},{onOpenChangeComplete:Ft,setOpen:Ft,setInputValue:Ft,setSelectedValue:Ft,setIndices:Ft,handleSelection:Ft,forceMount:Ft,requestSubmit:Ft,listRef:ze,labelsRef:Be,popupRef:He,emptyRef:Ye,inputRef:We,startDismissRef:Ge,endDismissRef:qe,chipsContainerRef:Ze,clearRef:Qe,valuesRef:nt,pointerDownItemRef:rt,selectionEventRef:$e},Yg)}).current,It=m===`none`?vt:Y,Lt=Z.useMemo(()=>m===`none`?It:Array.isArray(Y)?Y.map(e=>Jm(e,R)):Jm(Y,R),[It,R,m,Y]),Rt=J(_),Bt=J(r),Vt=X.useState(`activeIndex`),Ht=X.useState(`selectedIndex`),Wt=X.useState(`positionerElement`),Gt=X.useState(`listElement`),Kt=X.useState(`triggerElement`),qt=X.useState(`inputElement`),Jt=X.useState(`inputGroupElement`),Yt=X.useState(`inline`),Xt=X.useState(`inputInsidePopup`),Zt=X.useState(`inputOwnsFormValue`),$t=st&&!Xt&&vt===Et,en=be(Kt),{openMethod:tn,triggerProps:nn}=Em(bt),rn=J(()=>Lt);re(Xt?en:We,ye,It,rn,!it,y);let an=J(()=>{we?Be.current=Pt.map(je):X.set(`forceMounted`,!0)}),on=J((e,t,n,r)=>{if(t===-1){if(et.current===t_)return;et.current=t_}else et.current={value:e,index:t};Rt(e,g(n,r,{index:t}))}),sn=J(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),X.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?on(void 0,-1,r,e.event):on(nt.current[n],n,r,e.event)}),cn=J((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Xe.current=n.reason===Ke,n.reason===`input-change`){bt&&Ie!==null&&Le(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&Fe(!0),tt.current={hasQuery:e};let n=X.state.listElement;if(!X.state.virtualized&&n){let e=He.current;for(let t of Je(n.firstElementChild??n)){if(!Pe(t)||(e?!d(e,t):t.getAttribute(`role`)===`dialog`))break;if($g(t)){t.scrollTop=0;break}}}e&&dt&&X.state.activeIndex==null&&(bt||Yt)&&X.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&X.state.inputInsidePopup&&(tt.current={hasQuery:!1,selection:!0});yt(t)}}),ln=J(e=>{let t=!e&&Xt&&!Yt&&vt!==``&&(String(vt).trim()===Ie||vt===Et);!e&&(t||vt===``||$t)&&Fe(!1),Le(null),t&&cn(``,K(Ke))}),[un,dn]=Z.useState(!1),fn=J((t,n)=>{if(bt===t)return;n.reason===`escape-key`&<&&Pt.length===0&&!Ye.current&&n.allowPropagation();let r=n,i=s(r);if(e.onOpenChange?.(t,r),tt.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(tt.current=null),!n.isCanceled&&(t&&Ie!==null&&ln(n.reason===Ve),!t&&Ne&&(st?(Yt||Le(Ct),Ct===``&&Fe(!1)):ot&&(Yt||Le(Ct),Xt&&sn({activeIndex:null}),(!Xt||Yt)&&cn(``,K(Ke,n.event,void 0,{isItemPress:n.reason===gt})))),t||dn(i()),xt(t),!t&&Xt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(me(!0),he(!1),ge===`onBlur`))){let e=m===`none`?vt:Y;_e.commit(e)}}),pn=J((e,t)=>{o?.(e,t),!t.isCanceled&&(mt(e),(m===`none`&&He.current&&ne||st&&!X.state.inputInsidePopup)&&cn(je(e),K(t.reason,t.event)))}),mn=J((e,t)=>{let n=te(e),r=$e.current??e;$e.current=null;let i=K(gt,r),a=h(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&fn(!1,i);else if(ot){let e=Array.isArray(Y)?Y:[],n=Ug(e,t,z),r=n?Jg(e,t,z):[...e,t];if(pn(r,i),i.isCanceled||!(We.current&&We.current.value.trim()!==``))return;if(X.state.inputInsidePopup){cn(``,K(Ke,i.event,void 0,{isItemPress:!0}));let e=tt.current;e&&!n&&(e.toggledValue=t)}else fn(!1,i)}else{if(pn(t,i),i.isCanceled)return;fn(!1,i)}}),hn=J(()=>{let e=_e.inputRef.current?.form??X.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),gn=J(()=>{if(Bt?.(!1),Fe(!1),Le(null),sn(m===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),ot&&We.current&&We.current.value!==``&&!Xe.current&&cn(``,K(Ke)),st){if(X.state.inputInsidePopup)We.current&&We.current.value!==``&&cn(``,K(Ke));else{let e=je(Y);We.current&&We.current.value!==e&&cn(e,K(e===``?Ke:Ut))}}}),_n=Z.useMemo(()=>Yt&&Wt?{current:h(Wt,`[role="dialog"]`)}:He,[Yt,Wt]),{mounted:vn,transitionStatus:yn,forceUnmount:bn}=I({open:bt,ref:_n,preventUnmountOnClose:un,setPreventUnmountOnClose:dn,onUnmount:gn});Z.useImperativeHandle(e.actionsRef,()=>({unmount:bn,close:()=>fn(!1,K(pt))}),[bn,fn]),q(function(){let e=Re.current!==null&&Ie===null;if(Re.current=Ie,bt&&(!e||!lt)||(bt||(rt.current=null),m===`none`))return;let t=lt?Pt:nt.current;sn({selectedIndex:Kg(t,Y,z,ot)})},[bt,Ie,Y,m,ot,lt,Pt,z,sn]),q(()=>{we&&(nt.current=Pt,ze.current.length=Pt.length)},[we,Pt]),q(()=>{!bt&&tt.current?.hasQuery&&(tt.current=null)},[bt]),q(()=>{if(!bt&&Yt&&_n.current){tt.current=null;return}let e=lt||ut?Pt:nt.current,t=tt.current;if(t){let n=bt||Yt||X.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=We.current;!dt||String(vt).trim()===``||Yt&&dt!==`always`&&(!t||fe(t.ownerDocument)!==t)?tt.current=null:n&&(e[0]!==void 0||!lt&&!ut)&&(X.set(`activeIndex`,0),tt.current=null)}else if(String(vt).trim()===``&&(tt.current=null,n)){let e=t.selection;dt===`always`&&!e&&X.state.selectionMode===`none`&&X.set(`activeIndex`,0),queueMicrotask(()=>{if(!X.state.open&&(!X.state.inline||_n.current)||We.current&&We.current.value.trim()!==``)return;let n=X.state.selectedValue,r=X.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:X.state.selectionMode!==`none`&&n!=null){let e=lt||ut?Pt:nt.current,i=Wg(e,t.toggledValue,X.state.isItemEqualToValue);X.set(`activeIndex`,i===-1?Kg(e,n,X.state.isItemEqualToValue,r):i)}else e?X.set(`activeIndex`,null):dt===`always`&&X.set(`activeIndex`,0)})}}if(!bt&&!Yt)return;let n=X.state.activeIndex;if(n==null){if(dt===`always`&&e.length>0){X.set(`activeIndex`,0);return}on(void 0,-1,Ut);return}if(n>=e.length){on(void 0,-1,Ut),X.set(`activeIndex`,null);return}let r=e[n],i=et.current.value,a=i!==e_&&Vg(r,i,X.state.isItemEqualToValue);(et.current.index!==n||!a)&&on(r,n,Ut)},[Vt,dt,on,ut,lt,Pt,Yt,bt,_n,X,vt]),q(()=>{W(m===`none`?String(vt)!==``:ot?Array.isArray(Y)&&Y.length>0:Y!=null)},[W,m,vt,Y,ot]),Z.useEffect(()=>{lt&&dt&&Pt.length===0&&sn({activeIndex:null})},[lt,dt,Pt.length,sn]);function xn(){bt&&Ct!==``&&Ct!==String(_t)&&!$t&&Fe(!0)}function Sn(){bt&&Ie!==null&&ln(!1)}let Cn=!1;function wn(){!Cn&&vt!==Et&&(Cn=!0,cn(Et,K(Ut)))}function Tn(){m!==`none`&&(le(at),ue(Hg(Y,de.initialValue,z)),_e.change(Y),st&&!ct&&!Xt&&wn())}function En(){st&&!ct&&!Xt&&!Ne&&wn()}function Dn(){m===`none`&&(le(at),ue(vt!==de.initialValue),_e.change(vt))}p(Ct,xn),p(bt,Sn),p(Y,Tn),p(Et,En),p(we,En),p(vt,Dn);let On=_s({open:Yt?!0:bt,onOpenChange:fn,elements:{reference:Xt?Kt:qt,floating:Wt}}),kn=E?`grid`:`listbox`,An=bt||Yt,jn=An?`true`:`false`,Mn=Z.useMemo(()=>{let e=qt?.tagName===`INPUT`,t=qt==null||e,n=t||An,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jn,r[`aria-haspopup`]=kn,r[`aria-controls`]=An?Gt?.id:void 0,r[`aria-autocomplete`]=S?`none`:ae),{reference:r,floating:{role:`presentation`}}},[qt,An,jn,kn,Gt?.id,ae,S]),Nn=as(On,{enabled:!it&&M,event:`mousedown-only`,toggle:!1,touchOpenDelay:Xt?0:100,reason:Tt}),Pn=H(On,{enabled:!it&&!Yt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:Yt?!0:void 0,outsidePress(e){let t=te(e);return!d(Kt,t)&&!d(Qe.current,t)&&!d(Ze.current,t)&&!d(Jt,t)}}),Fn=ws(On,{enabled:!it,id:ye,listRef:ze,activeIndex:Vt,selectedIndex:Ht,virtual:!0,loopFocus:F,allowEscape:F&&!dt,focusItemOnOpen:Ne||m===`none`&&!dt?!1:`auto`,focusItemOnHover:ee,resetOnPointerLeave:!P,orientation:E?`horizontal`:void 0,rtl:ve===`rtl`,disabledIndices:t,grid:E?Og:void 0,onNavigate(e,t){(t||bt||Yt&&e===null)&&yn!==`ending`&&sn({activeIndex:e,type:Rm(t),event:t?.nativeEvent})}}),In=Z.useMemo(()=>zt(Fn.reference,{onKeyDown(e){E&&X.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pn.reference,Nn.reference,Mn.reference),[Fn.reference,Pn.reference,Nn.reference,Mn.reference,E,X]),Ln=Z.useMemo(()=>zt(Me,Pn.floating),[Pn.floating]),Rn=Z.useMemo(()=>zt(Fn.floating,Mn.floating),[Fn.floating,Mn.floating]),zn=Z.useMemo(()=>{let e=Fn.item;return{props:e?{...e,onFocus:void 0}:Ue,id:ye,selectionMode:m,disabled:it,readOnly:S,isItemEqualToValue:z}},[Fn.item,ye,m,it,S,z]);X.useContextCallback(`setOpen`,fn),X.useContextCallback(`setInputValue`,cn),X.useContextCallback(`setSelectedValue`,pn),X.useContextCallback(`setIndices`,sn),X.useContextCallback(`handleSelection`,mn),X.useContextCallback(`forceMount`,an),X.useContextCallback(`requestSubmit`,hn),X.useContextCallback(`onOpenChangeComplete`,r),Dg(()=>{X.update({inline:V,popupProps:Ln,listProps:Rn,inputProps:In,triggerProps:nn,itemRoot:zn})});let Bn={id:ye,selectedValue:Y,open:bt,mounted:vn,transitionStatus:yn,items:Ee,inline:V,popupProps:Ln,listProps:Rn,inputProps:In,triggerProps:nn,itemRoot:zn,openMethod:tn,selectionMode:m,name:at,form:b,disabled:it,readOnly:S,required:w,grid:E,virtualized:B,openOnInputClick:M,itemToStringLabel:ke,modal:ie,autoHighlight:dt,isItemEqualToValue:z,submitOnItemClick:ce,hasInputValue:ct};q(()=>{X.update({...Bn,inputOwnsFormValue:m===`none`&&(V||!X.state.inputInsidePopup)})},[X,...Object.values(Bn)]);let Vn=At(T,_e.inputRef),Hn=Z.useMemo(()=>({query:Ct,hasItems:lt,filteredItems:Nt,flatFilteredValues:Pt}),[Ct,lt,Nt,Pt]),Un=Z.useMemo(()=>Array.isArray(It)?``:Jm(It,R),[It,R]),Wn=ot&&Array.isArray(Y)&&Y.length>0,Gn=ot||m===`none`&&Zt?void 0:at,Kn=Z.useMemo(()=>!ot||!Array.isArray(Y)||!at?null:Y.map(e=>{let t=Jm(e,R);return/*#__PURE__*/ (0,Q.jsx)(`input`,{type:`hidden`,form:b,name:at,value:t,disabled:it},t)}),[ot,Y,b,at,R,it]),qn=/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[e.children,/*#__PURE__*/ (0,Q.jsx)(`input`,{..._e.getValidationProps(it,{onFocus(){Xt?Kt?.focus():(We.current||Kt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||it||S)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=K(Ut,e.nativeEvent),i=()=>nt.current.findIndex(e=>Jm(e,R).toLowerCase()===n||je(e).toLowerCase()===n);function a(){if(ot)return;if(m===`none`){cn(t,r);return}let e=i();e===-1&&(e=nt.current.findIndex((e,t)=>{let r=Be.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:nt.current[e];a!=null&&pn?.(a,r)}st&&(an(),we&&i()===-1&&X.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:ye&&Gn==null?`${ye}-hidden-input`:void 0,form:b,name:Gn,autoComplete:oe,disabled:it,required:w&&!Wn,readOnly:S,value:Un,ref:Vn,style:Gn?Se:O,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Kn]});return/*#__PURE__*/ (0,Q.jsx)(kg.Provider,{value:X,children:/*#__PURE__*/ (0,Q.jsx)(Ag.Provider,{value:On,children:/*#__PURE__*/ (0,Q.jsx)(Mg.Provider,{value:lt,children:/*#__PURE__*/ (0,Q.jsx)(jg.Provider,{value:Hn,children:/*#__PURE__*/ (0,Q.jsx)(Ng.Provider,{value:vt,children:qn})})})})})}const i_={...Rt,...ve,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null};function a_(e,t){return e??t}function o_(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function s_(){return Ig().filteredItems.length===0}function c_(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function l_(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}const u_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:f,validationMode:p,validation:m}=C(),{labelId:h}=E(),g=Pg(),_=g.useState(`selectionMode`),y=g.useState(`disabled`),b=g.useState(`readOnly`),x=g.useState(`required`),S=g.useState(`positionerElement`),w=g.useState(`listElement`),T=g.useState(`popupId`),D=g.useState(`triggerProps`),O=g.useState(`inputInsidePopup`),k=g.useState(`id`),A=g.useState(`labelId`),j=g.useState(`open`),M=g.useState(`selectedValue`),N=g.useState(`activeIndex`),P=g.useState(`selectedIndex`),ee=g.useState(`hasSelectedValue`),I=Fg(),L=Lg(),R=F(),z=u||y||a,B=s_(),V=o_(g),ne=Z.useRef(null),re=ut(z,ne);v({id:O?o:void 0});let H=O?o??k:o,ie=a_(h,A),U;j&&O?U=T??Xg(k):j&&(U=w?.id);let ae=Z.useRef(``);function oe(e){ae.current=e.pointerType}let{reference:se}=Ts(I,{enabled:!j&&!b&&!y&&_===`single`,listRef:g.context.labelsRef,activeIndex:N,selectedIndex:P,onMatch(e){let t=g.context.valuesRef.current[e];t!==void 0&&g.context.setSelectedValue(t,K(Ut))}}),{reference:ce}=as(I,{enabled:!y,event:`mousedown`}),{buttonRef:le,getButtonProps:ue}=tt({native:i,disabled:z}),de={...l,readOnly:b,open:j,disabled:z,popupSide:V,listEmpty:B,placeholder:_!==`none`&&!ee},W=J(e=>{g.set(`triggerElement`,e)});return Ee(`button`,e,{ref:[t,le,ne,W],state:de,props:[D,ce,se,{id:H,tabIndex:O?0:-1,role:O?`combobox`:void 0,"aria-expanded":j,"aria-haspopup":O?`dialog`:`listbox`,"aria-controls":U,"aria-required":O&&x||void 0,"aria-readonly":O&&b||void 0,"aria-labelledby":ie,onPointerDown:oe,onPointerEnter:oe,onFocus(){re(!0),!z&&R.start(0,g.context.forceMount)},onBlur(e){if(!d(S,e.relatedTarget)&&(f(!0),re(!1),p===`onBlur`)){let e=_===`none`?L:M;m.commit(e)}},onMouseDown(e){if(z||(O||I.set(`domReferenceElement`,e.currentTarget),g.context.forceMount(),ae.current!==`touch`&&(g.context.inputRef.current?.focus(),O||e.preventDefault()),j))return;let t=St(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=te(e),r=g.state.positionerElement,i=g.state.listElement;d(t,n)||d(r,n)||d(i,n)||zm(e,t)||g.context.setOpen(!1,K(jt,e))}O&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(_t(e),g.context.setOpen(!0,K(Ye,e.nativeEvent)),g.context.inputRef.current?.focus())}},m.getValidationProps(z,c),ue],stateAttributesMapping:i_})}),d_=/*#__PURE__*/ Z.createContext(void 0);function f_(){return Z.useContext(d_)}const p_=/*#__PURE__*/ Z.createContext(void 0);function m_(e){let t=Z.useContext(p_);if(t===void 0&&!e)throw Error(ft(21));return t}const h_=/*#__PURE__*/ Z.forwardRef(function(e,t){let n=Pg(),{buttonRef:r,getButtonProps:i}=tt({native:!1}),a=At(t,r);function o(e){n.context.setOpen(!1,K(je,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return/*#__PURE__*/ (0,Q.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Se})}),g_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:i,disabled:o=!1,id:s,style:c,...l}=e,{state:u,disabled:d,setTouched:f,validationMode:p,validation:m}=C(),{labelId:h}=E(),g=f_(),_=!!m_(!0),v=Pg(),y=Lg(),b=Mt(),x=v.useState(`required`),S=v.useState(`disabled`),w=v.useState(`readOnly`),T=v.useState(`name`),D=v.useState(`form`),O=v.useState(`selectionMode`),k=v.useState(`autoHighlight`),A=v.useState(`inputProps`),j=v.useState(`triggerProps`),M=v.useState(`open`),N=v.useState(`mounted`),P=v.useState(`selectedValue`),F=v.useState(`id`),I=v.useState(`inline`),R=v.useState(`modal`),z=!!k,B=o_(v),V=d||S||o,te=s_(),ne=ut(V,v.context.inputRef),re=_||I,H=!re||R,ie=ee(s??(re?void 0:F)),U=_?pe:u,[ae,oe]=Z.useState(null),se=Z.useRef(!1),ce=Z.useRef(null);q(()=>{M||(ce.current=null)},[M]);let le=O===`none`&&!_,ue=J(e=>{let t=_||v.state.inline;t&&!v.state.hasInputValue&&v.context.setInputValue(``,K(Ut)),v.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:le})}),de=_?l:m.getValidationProps(V,l);function W(e){v.context.setIndices({activeIndex:null,selectedIndex:null,type:Rm(e),event:e})}let fe={...U,open:M,disabled:V,readOnly:w,popupSide:B,listEmpty:te};function G(e){if(!g)return;let t,n=g.chipsRef.current.length,[r]=c_(b);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&P.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let me=Ee(`input`,e,{state:fe,ref:[t,v.context.inputRef,ue],props:[A,j,{value:ae??y,"aria-readonly":w||void 0,"aria-required":x||void 0,"aria-labelledby":h,disabled:V,readOnly:w,required:O===`none`?x:void 0,form:D,...le&&T&&{name:T},id:ie,onFocus(){if(ne(!0),!I)return;let e=ce.current;ce.current=null,e!=null&&Object.hasOwn(v.context.valuesRef.current,e)&&v.context.setIndices({activeIndex:e})},onBlur(){f(!0),ne(!1);let e=v.state.activeIndex;if(I&&e!==null&&k!==`always`&&(ce.current=e,v.context.setIndices({activeIndex:null})),p===`onBlur`){let e=O===`none`?y:P;m.commit(e)}},onCompositionStart(e){L||(se.current=!0,oe(e.currentTarget.value))},onCompositionEnd(e){se.current=!1;let t=e.currentTarget.value;oe(null),v.context.setInputValue(t,K(Ve,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=se.current||!r;function a(e){!w&&!V&&e&&i&&(v.context.setOpen(!0,K(Ve,t)),z||W(t))}if(se.current){let n=e.currentTarget.value;oe(n),n===``&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.context.setOpen(!1,K(Ke,t));let r=n.trim(),i=z&&r!==``;a(r),M&&v.state.activeIndex!==null&&!i&&W(t);return}let o=K(Ve,t);if(v.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=K(Ke,t);s&&!v.state.inputInsidePopup&&(O===`single`&&v.context.setSelectedValue(null,c),v.state.openOnInputClick||v.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),M&&v.state.activeIndex!==null&&!z&&W(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(V||w){w&&e.key===`Enter`&&M&&v.state.activeIndex!==null&&_t(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,i=b===`rtl`;if(e.key===`Home`){_t(e);let n=r&&i?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){_t(e);let a=r&&i?0:t.value.length;t.setSelectionRange(a,a),t.scrollLeft=i?-n:n;return}if(!N&&e.key===`Escape`){let t=O===`multiple`&&Array.isArray(P)?P.length===0:P===null,n=K(Pt,e.nativeEvent),r=O===`multiple`?[]:null;v.context.setInputValue(``,n),v.context.setSelectedValue(r,n),!t&&!v.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(g&&e.key===`Backspace`&&t.value===``&&Array.isArray(P)&&P.length>0){let t=g.chipsRef.current.length,n=t>0?t-1:P.length-1,r=P.filter((e,t)=>t!==n);W(e.nativeEvent),v.context.setSelectedValue(r,K(Ut,e.nativeEvent));return}let a=G(e);if(a!==void 0&&g?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&M){let t=v.state.activeIndex,n=e.nativeEvent;if(t===null){if(I)return;v.context.setOpen(!1,K(Ut,n));return}_t(e),l_(v,t,n)}}},de],stateAttributesMapping:i_}),he=_?/*#__PURE__*/ (0,Q.jsx)(ge.Provider,{value:a,children:me}):me;return/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[M&&H&&/*#__PURE__*/ (0,Q.jsx)(h_,{ref:v.context.startDismissRef}),he]})}),__={...Vt,...Be},v_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,disabled:a=!1,nativeButton:o=!0,keepMounted:s=!1,style:c,...l}=e,{disabled:u}=C(),d=Pg(),f=d.useState(`selectionMode`),p=d.useState(`disabled`),m=d.useState(`readOnly`),h=d.useState(`open`),g=d.useState(`selectedValue`),_=d.useState(`hasSelectionChips`),v=Lg(),y=!1;y=f===`none`?v!==``:f===`single`?g!=null:_;let b=u||p||a,{buttonRef:x,getButtonProps:S}=tt({native:o,disabled:b}),{mounted:w,transitionStatus:T,setMounted:E}=i(y),D={disabled:b,visible:y,open:h,transitionStatus:T};ot({open:y,ref:d.context.clearRef,onComplete(){y||E(!1)}});let O=Ee(`button`,e,{state:D,ref:[t,x,d.context.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||m)return;let t=Rm(e);d.context.setInputValue(``,K(nt,e.nativeEvent)),f===`none`?d.context.setIndices({activeIndex:null,type:t,event:e.nativeEvent}):(d.context.setSelectedValue(Array.isArray(g)?[]:null,K(nt,e.nativeEvent)),d.context.setIndices({activeIndex:null,selectedIndex:null,type:t,event:e.nativeEvent})),d.context.inputRef.current?.focus()}},l,S],stateAttributesMapping:__});return s||w?O:null}),y_=/*#__PURE__*/ Z.createContext(null);function b_(){return Z.useContext(y_)}function x_(e){let{children:t,items:n}=e,r=Z.useMemo(()=>({items:n}),[n]);return/*#__PURE__*/ (0,Q.jsx)(y_.Provider,{value:r,children:t})}function S_(e){let{children:t}=e,{filteredItems:n}=Ig(),r=b_(),i=r?r.items:n;return/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:i.map(t)})}const C_=/*#__PURE__*/ Z.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=Pg(),l=Fg(),u=!!m_(!0),{filteredItems:d,hasItems:f}=Ig(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),v=c.useState(`forceMounted`),y=p===`multiple`,b=d.length===0,x=J(e=>{c.set(`positionerElement`,e)}),S=J(e=>{c.set(`listElement`,e)}),C=Z.useMemo(()=>typeof o==`function`?n||=/*#__PURE__*/ (0,Q.jsx)(S_,{children:o}):o,[o]),w={empty:b},T=l.useState(`floatingId`),E=Ee(`div`,e,{state:w,ref:[t,S,u?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:m?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,"aria-readonly":!m&&h?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;_t(e),l_(c,t,e.nativeEvent)}}},s]});if(_)return E;let D=f&&!v?void 0:c.context.labelsRef;return/*#__PURE__*/ (0,Q.jsx)(Am,{elementsRef:c.context.listRef,labelsRef:D,children:E})}),w_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=eh();return Ee(`div`,e,{ref:[t,s],props:[{children:a,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),T_=/*#__PURE__*/ Z.createContext(void 0);function E_(){let e=Z.useContext(T_);if(e===void 0)throw Error(ft(20));return e}const D_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Pg(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?/*#__PURE__*/ (0,Q.jsx)(T_.Provider,{value:n,children:/*#__PURE__*/ (0,Q.jsx)(he,{ref:t,...r})}):null}),O_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=_e,style:g,..._}=e,v=Pg(),y=Fg(),b=E_(),x=v.useState(`modal`),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`openMethod`),T=v.useState(`positionerElement`),E=v.useState(`triggerElement`),D=v.useState(`inputElement`),O=v.useState(`inputGroupElement`),k=v.useState(`inputInsidePopup`),A=v.useState(`transitionStatus`),j=s_(),M=bt({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});Lm(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};q(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=J(e=>{v.set(`positionerElement`,e)}),ee=$e(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return/*#__PURE__*/ (0,Q.jsxs)(p_.Provider,{value:M,children:[C&&x&&/*#__PURE__*/ (0,Q.jsx)(Cm,{inert:Es(!S),cutout:O??D??E}),ee]})}),k_={...Le,...Vt},A_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Pg(),l=m_(),u=Fg(),f=c.useState(`mounted`),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`popupProps`),g=c.useState(`transitionStatus`),_=c.useState(`inputInsidePopup`),v=c.useState(`inputElement`),y=c.useState(`modal`),b=c.useState(`id`),x=s_(),S=s.id??(_?Xg(b):void 0);q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||S),()=>{c.set(`popupId`,void 0)}),[c,S]),ot({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete(!0)}});let C={open:p,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:g,empty:x},w=Ee(`div`,e,{state:C,ref:[t,c.context.popupRef],props:[h,{id:S,role:_?`dialog`:`presentation`,onFocus(e){let t=te(e.nativeEvent);m!==`touch`&&(d(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},ke(g),s],stateAttributesMapping:k_}),T=a===void 0?_?e=>e===`touch`?c.context.popupRef.current:v:!1:a,E;E=o??(_?void 0:!1);let D=!_||y;return/*#__PURE__*/ (0,Q.jsx)(is,{context:u,disabled:!f,modal:D,openInteractionType:m,initialFocus:T,returnFocus:E,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:/*#__PURE__*/ (0,Q.jsxs)(Z.Fragment,{children:[w,D&&/*#__PURE__*/ (0,Q.jsx)(h_,{ref:c.context.endDismissRef})]})})}),j_=/*#__PURE__*/ Z.createContext(void 0);function M_(){let e=Z.useContext(j_);if(e===void 0)throw Error(ft(18));return e}const N_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=Pg().useState(`grid`),[c,l]=Z.useState(),u=Z.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=Ee(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=/*#__PURE__*/ (0,Q.jsx)(j_.Provider,{value:u,children:d});return a?/*#__PURE__*/ (0,Q.jsx)(x_,{items:a,children:f}):f}),P_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=M_(),c=ee(a);return q(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),Ee(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),F_=/*#__PURE__*/ Z.createContext(void 0);function I_(){let e=Z.useContext(F_);if(!e)throw Error(ft(19));return e}const L_=/*#__PURE__*/ Z.createContext(!1);function R_(){return Z.useContext(L_)}function z_(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Z.useRef(null),m=km({guess:!0,index:l,textRef:p}),h=Pg(),g=R_(),_=Rg(),{props:v,id:y,selectionMode:b,disabled:x,readOnly:S,isItemEqualToValue:C}=h.useState(`itemRoot`),w=x||u,T=b!==`none`,E=l??i??m.index,D=E!==-1,O=h.useState(`isActive`,E),k=h.useState(`isSelected`,c),A=Z.useRef(null),j=y!=null&&D?`${y}-${E}`:void 0,M=k&&T;q(()=>{if(!D||!r&&l==null)return;let e=h.context.listRef.current;return e[E]=A.current,()=>{delete e[E]}},[D,r,E,l,h]),q(()=>{if(!D||_)return;let e=h.context.valuesRef.current;return e[E]=c,()=>{delete e[E]}},[D,_,E,c,h]),q(()=>{if(!D||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=qg(E,c,h.context.valuesRef.current,e,C,t):Vg(c,e,C)&&(t=E),h.set(`selectedIndex`,t)},[D,_,h,E,c,C]);let{getButtonProps:N,buttonRef:P}=tt({disabled:w,focusableWhenDisabled:!0,native:d,composite:!0}),ee={disabled:w,selected:M,highlighted:O};function F(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(Ta.flushSync(t),h.context.requestSubmit()):t()}let I={id:j,role:g?`gridcell`:`option`,"aria-selected":T?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){w||S||F(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(w||S||e.button!==0||t||!O)&&F(e.nativeEvent)}},L=Ee(`div`,t,{ref:[P,n,m.ref,A],state:ee,props:[v,I,f,N]}),R=Z.useMemo(()=>({selected:M,textRef:p}),[M,p]);return/*#__PURE__*/ (0,Q.jsx)(F_.Provider,{value:R,children:L})}function B_(e){let{componentProps:t,forwardedRef:n}=e,r=Pg().useState(`isItemEqualToValue`),{flatFilteredValues:i}=Ig(),a=Wg(i,t.value??null,r);return/*#__PURE__*/ (0,Q.jsx)(z_,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}const V_=/*#__PURE__*/ Z.memo(/*#__PURE__*/ Z.forwardRef(function(e,t){let n=Pg().useState(`virtualized`);return n&&e.index==null?/*#__PURE__*/ (0,Q.jsx)(B_,{componentProps:e,forwardedRef:t}):/*#__PURE__*/ (0,Q.jsx)(z_,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),H_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=Ig(),c=Pg(),l=eh(),u=s.length===0?a:null;return Ee(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function U_(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return/*#__PURE__*/ (0,Q.jsx)(r_,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}function W_(e){let{children:t,placeholder:n}=e,r=Pg(),i=r.useState(`itemToStringLabel`),a=r.useState(`selectedValue`),o=r.useState(`items`),s=r.useState(`selectionMode`)===`multiple`,c=r.useState(`hasSelectedValue`),l=!c&&n!=null&&t==null,u=r.useState(`hasNullItemLabel`,l),d=null;return d=typeof t==`function`?t(a):t??(!c&&n!=null&&!u?n:s&&Array.isArray(a)?Xm(a,o,i):Ym(a,o,i)),/*#__PURE__*/ (0,Q.jsx)(Z.Fragment,{children:d})}const G_=/*#__PURE__*/ Z.memo(/*#__PURE__*/ Z.forwardRef(function(e,t){let{render:n,className:r,style:a,keepMounted:o,selected:s,...c}=e,l=Z.useRef(null),{transitionStatus:u,setMounted:d}=i(s),f=Ee(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},c],stateAttributesMapping:Vt});return ot({batch:!0,enabled:!s,open:s,ref:l,onComplete(){s||d(!1)}}),f})),K_=/*#__PURE__*/ Z.forwardRef(function(e,t){let{selected:n}=I_();return e.keepMounted||n?/*#__PURE__*/ (0,Q.jsx)(G_,{...e,selected:n,ref:t}):null});var q_=Bt();const J_=(0,Z.createContext)(null);function Y_(){return(0,Z.useContext)(J_)?.defaultOptions??{}}function X_(e){return typeof e==`function`}function Z_(e,...t){return X_(e)?e(...t):e}var Q_=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}};const $_=/* @__PURE__ */ new Map;function ev(e,t){$_.set(e,t)}function tv(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function nv(e){return typeof e.get==`function`?e.get():e.state}function rv(e){return{key:e.key,store:{state:tv(nv(e.store))},options:tv(e.options)}}var iv=class extends Q_{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}};const av=(e,t)=>{let n=t.key;n&&(ev(n,t),ov.emit(e,rv({...t,key:n})))},ov=new iv;function sv(e,t){return e===t}function cv(e,t=e=>e,n){let r=n?.compare??sv,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,q_.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function lv(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}const uv={enabled:!0,leading:!1,trailing:!0,wait:0};var dv=class{#e;constructor(e,t){this.fn=e,this.store=new bn(lv()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),av(`Debouncer`,this)},this.#n=()=>!!Z_(this.options.enabled,this),this.#r=()=>Z_(this.options.wait,this),this.maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())},this.#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})},this.reset=()=>{this.#t(lv())},this.key=t.key,this.options={...uv,...t},this.#t(this.options.initialState??{}),this.key&&ov.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a};function fv(e,t,n=()=>({})){let r={...Y_().debouncer,...t},[i]=(0,Z.useState)(()=>{let t=new dv(e,r);return t.Subscribe=function(e){let n=cv(t.store,e.selector,{compare:xn});return typeof e.children==`function`?e.children(n):e.children},t});i.fn=e,i.setOptions(r),(0,Z.useEffect)(()=>()=>{r.onUnmount?r.onUnmount(i):i.cancel()},[]);let a=cv(i.store,n,{compare:xn});return(0,Z.useMemo)(()=>({...i,state:a}),[i,a])}function pv(e,t,n){let[r,i]=(0,Z.useState)(e),a=fv(i,t,n);return[r,a.maybeExecute,a]}function mv(e,t,n){let[r,i,a]=pv(e,t,n);return(0,Z.useEffect)(()=>{i(e)},[e,i]),[r,a]}function hv({list:e,enabled:t,query:n}){let{hasNextPage:r,isFetching:i,isError:a,fetchNextPage:o,data:s}=n;(0,Z.useEffect)(()=>{let n=e.current;if(!t||!n||!r||i||a)return;let s=()=>{n.scrollHeight-n.scrollTop-n.clientHeight<48&&o({cancelRefetch:!1})};return s(),n.addEventListener(`scroll`,s),()=>n.removeEventListener(`scroll`,s)},[e,t,r,i,a,o,s])}const gv=U_,_v=w_;function vv({...e}){return/* @__PURE__ */ (0,Q.jsx)(W_,{"data-slot":`combobox-value`,...e})}function yv({className:e,children:t,...n}){return/* @__PURE__ */ (0,Q.jsxs)(u_,{"data-slot":`combobox-trigger`,className:k(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,/* @__PURE__ */ (0,Q.jsx)(Gt,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function bv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(v_,{"aria-label":`Clear selection`,"data-slot":`combobox-clear`,render:/* @__PURE__ */ (0,Q.jsx)(Ma,{variant:`ghost`,size:`icon-xs`}),className:k(e),...t,children:/* @__PURE__ */ (0,Q.jsx)(ya,{className:`pointer-events-none`})})}function xv({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return/* @__PURE__ */ (0,Q.jsxs)(Oa,{className:k(`w-auto`,e),children:[/* @__PURE__ */ (0,Q.jsx)(g_,{render:/* @__PURE__ */ (0,Q.jsx)(Na,{disabled:n}),...a}),/* @__PURE__ */ (0,Q.jsxs)(Aa,{align:`inline-end`,children:[r&&/* @__PURE__ */ (0,Q.jsx)(Ma,{size:`icon-xs`,variant:`ghost`,render:/* @__PURE__ */ (0,Q.jsx)(yv,{}),"aria-label":`Show options`,"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&/* @__PURE__ */ (0,Q.jsx)(bv,{disabled:n})]}),t]})}function Sv({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,container:o,collisionBoundary:s,...c}){return/* @__PURE__ */ (0,Q.jsx)(D_,{container:o,children:/* @__PURE__ */ (0,Q.jsx)(O_,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,collisionBoundary:s,className:`isolate z-50`,children:/* @__PURE__ */ (0,Q.jsx)(A_,{"data-slot":`combobox-content`,"data-chips":!!a,className:k(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c})})})}const Cv=Z.forwardRef(function({className:e,...t},n){return/* @__PURE__ */ (0,Q.jsx)(C_,{ref:n,"data-slot":`combobox-list`,className:k(`max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})});function wv({className:e,children:t,...n}){return/* @__PURE__ */ (0,Q.jsxs)(V_,{"data-slot":`combobox-item`,className:k(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,/* @__PURE__ */ (0,Q.jsx)(K_,{render:/* @__PURE__ */ (0,Q.jsx)(`span`,{className:`pointer-events-none absolute end-2 flex size-4 items-center justify-center`}),children:/* @__PURE__ */ (0,Q.jsx)(ra,{className:`pointer-events-none`})})]})}function Tv({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(N_,{"data-slot":`combobox-group`,className:k(e),...t})}function Ev({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(P_,{"data-slot":`combobox-label`,className:k(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function Dv({...e}){return/* @__PURE__ */ (0,Q.jsx)(S_,{"data-slot":`combobox-collection`,...e})}function Ov({className:e,...t}){return/* @__PURE__ */ (0,Q.jsx)(H_,{"data-slot":`combobox-empty`,className:k(`w-full text-center text-sm text-muted-foreground [&:not(:empty)]:py-2`,e),...t})}export{Lo as $,Ir as $t,Rm as A,ar as An,ga as At,Gp as B,mi as Bt,gh as C,Er as Cn,Pa as Ct,rh as D,mr as Dn,Sa as Dt,Ah as E,br as En,Ca as Et,Tm as F,Tn as Fn,$i as Ft,Ps as G,ti as Gt,Yc as H,pi as Ht,Cm as I,En as In,Ai as It,Ts as J,ci as Jt,Ns as K,di as Kt,Sm as L,xn as Ln,ji as Lt,Am as M,Pn as Mn,ia as Mt,km as N,Dn as Nn,ra as Nt,nh as O,vr as On,ya as Ot,Em as P,On as Pn,na as Pt,Io as Q,Lr as Qt,dm as R,hn as Rn,_i as Rt,Ph as S,wr as Sn,Aa as St,bh as T,gr as Tn,wa as Tt,Gc as U,oi as Ut,Wp as V,hi as Vt,Ms as W,ni as Wt,as as X,ri as Xt,ws as Y,li as Yt,is as Z,ai as Zt,Eg as _,rr as _n,Za as _t,Tv as a,Nr as an,ko as at,cg as b,Wn as bn,Ia as bt,Ev as c,Ar as cn,Co as ct,yv as d,$n as dn,Xa as dt,Hr as en,To as et,vv as f,ur as fn,Ya as ft,u_ as g,Xn as gn,Ha as gt,cv as h,Hn as hn,Va as ht,Ov as i,kr as in,No as it,Lm as j,Jn as jn,la as jt,zm as k,Sr as kn,_a as kt,Cv as l,tr as ln,vo as lt,mv as m,Rn as mn,Ba as mt,Dv as n,Pr as nn,Oo as nt,xv as o,jr as on,_o as ot,hv as p,Zn as pn,Ja as pt,Es as q,fi as qt,Sv as r,Mr as rn,Ao as rt,wv as s,Fr as sn,go as st,gv as t,Ur as tn,jo as tt,_v as u,sr as un,oo as ut,Tg as v,In as vn,Ua as vt,ch as w,Or as wn,xa as wt,Rh as x,Bn as xn,Oa as xt,fg as y,Kn as yn,Ga as yt,Kp as z,vn as zn,gi as zt};
|