@fungi.computer/grove 0.5.1 → 0.5.2

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.
Files changed (26) hide show
  1. package/dist/assets/{anthropic-messages-BTv37DKo.js → anthropic-messages-BjaXSMDz.js} +3 -3
  2. package/dist/assets/{azure-openai-responses-CLI5CTea.js → azure-openai-responses-B8jHTRWc.js} +1 -1
  3. package/dist/assets/burger-DGwSIRh1.js +1 -0
  4. package/dist/assets/cat-DYC4NkHa.js +1 -0
  5. package/dist/assets/{compat-BQZx9Jx3.js → compat-DCBJyiIu.js} +2 -2
  6. package/dist/assets/{extension-hook-UDdYbDsl.js → extension-hook-CGfHHaEt.js} +2 -2
  7. package/dist/assets/{extensions-DF9U5f_Z.js → extensions-BUUGqZ5T.js} +1 -1
  8. package/dist/assets/{google-generative-ai-_8qHW2IX.js → google-generative-ai-ClCo1xY1.js} +1 -1
  9. package/dist/assets/{google-shared-BjptlrJn.js → google-shared-B6LRLDsV.js} +1 -1
  10. package/dist/assets/{google-vertex-C6JPlmUK.js → google-vertex-CwEc6kyk.js} +1 -1
  11. package/dist/assets/{index-DM8ziIjn.js → index-tKkWT4tn.js} +5 -5
  12. package/dist/assets/{mistral-conversations-C_XYmgUS.js → mistral-conversations-CjTjXMEd.js} +1 -1
  13. package/dist/assets/{mushroom-BTxbn3Sf.js → mushroom-BcYLQ0Mq.js} +1 -1
  14. package/dist/assets/{node.browser-Bc9i4viB.js → node.browser-BWR9sMWl.js} +1 -1
  15. package/dist/assets/{openai-codex-responses-C0Thlbgz.js → openai-codex-responses-YqAd_KCF.js} +1 -1
  16. package/dist/assets/{openai-completions-CJJn6-l3.js → openai-completions-BKlNdMXI.js} +1 -1
  17. package/dist/assets/{openai-responses-BuHYr0Ip.js → openai-responses-DWfSszti.js} +1 -1
  18. package/dist/assets/{openai-responses-shared-px8hA25N.js → openai-responses-shared-2yBHJV-3.js} +1 -1
  19. package/dist/assets/{parakeet-conversation-gakMmXhW.js → parakeet-conversation-CsLT5hy_.js} +1 -1
  20. package/dist/assets/{renderer-69rvqVnj.js → renderer-BnzZtBi_.js} +1 -1
  21. package/dist/assets/{runtime-core-CHfIZEOV.js → runtime-core-CqqxD70n.js} +1 -1
  22. package/dist/assets/{transform-messages-zEOZxc_F.js → transform-messages-CJm9GFj2.js} +1 -1
  23. package/dist/index.html +2 -2
  24. package/package.json +3 -3
  25. package/dist/assets/burger-BrMTWnA6.js +0 -1
  26. package/dist/assets/cat-Ce0yvAsw.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/runtime-core-CHfIZEOV.js","assets/rolldown-runtime-hePW80VL.js","assets/Effect-TOXKEWei.js","assets/extension-hook-UDdYbDsl.js","assets/preload-helper-DY31Aviq.js","assets/extensions-DF9U5f_Z.js","assets/mushroom-BTxbn3Sf.js","assets/document-aOA3zT2S.js","assets/renderer-69rvqVnj.js","assets/cat-Ce0yvAsw.js","assets/base-face-CD4oLBv-.js","assets/burger-BrMTWnA6.js","assets/parakeet-conversation-gakMmXhW.js","assets/parakeet-conversation-COndlivb.css"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$i as n,Aa as r,Ba as i,Bi as a,Ca as o,Da as s,E as c,Ea as l,Fa as u,Fi as d,Ga as f,Gi as p,Gn as m,Ha as h,Hi as g,I as _,Ia as v,Ii as y,Ja as b,Ka as x,Ki as S,La as C,Li as w,Ma as T,Mi as E,Na as D,Ni as O,Oa as k,Pa as A,Pi as j,Qn as M,Ra as N,Ri as P,Sa as F,St as ee,Ta as I,Ua as te,Ui as ne,V as re,Va as ie,Vi as L,Vn as ae,Wi as oe,X as R,Xi as se,Xn as ce,Y as le,Ya as z,Yi as ue,Zi as de,Zn as fe,_a as pe,a as me,aa as B,ar as he,at as ge,ba as _e,bt as ve,d as ye,da as be,dt as xe,ea as Se,er as Ce,et as we,fa as Te,ft as Ee,g as De,ia as Oe,j as ke,ja as Ae,ji as je,ka as Me,l as Ne,la as Pe,li as Fe,m as Ie,ma as V,mi as Le,mt as Re,na as ze,nr as Be,oa as Ve,pa as He,pt as Ue,qi as We,rr as Ge,rt as Ke,s as qe,sa as Je,t as Ye,ta as Xe,ua as Ze,va as Qe,vt as $e,wa as et,wi as tt,xa as nt,xt as rt,y as it,ya as at,yi as ot,yt as st,za as ct,zi as lt}from"./Effect-TOXKEWei.js";import{$r as H,Aa as ut,Ar as dt,Br as ft,Da as pt,Di as mt,Dr as ht,Ea as gt,Ei as _t,Fa as vt,Fi as yt,Ga as bt,Gr as xt,Ha as St,Hr as U,Ii as Ct,Ir as wt,Ja as Tt,Jr as Et,Ka as Dt,Ma as Ot,Na as kt,Nr as At,Oa as jt,Or as Mt,Pa as Nt,Pr as Pt,Qr as W,Rr as Ft,Sa as It,Si as Lt,Ta as Rt,Ti as zt,Tr as Bt,Ui as Vt,Ur as Ht,Va as Ut,Vn as Wt,Vr as Gt,Wa as Kt,Xa as qt,Xr as Jt,Yr as Yt,Za as Xt,Zi as G,Zr as Zt,_a as Qt,_i as $t,aa as en,ai as tn,ao as nn,ba as rn,ca as an,ci as on,d as sn,da as cn,di as ln,eo as un,f as dn,gi as fn,ha as pn,hi as mn,i as hn,ii as gn,io as _n,ja as vn,jr as yn,ka as bn,kr as xn,l as Sn,la as K,li as q,m as Cn,mi as wn,n as Tn,ni as En,oi as Dn,p as On,pr as kn,qa as An,qi as jn,qr as Mn,ri as Nn,si as Pn,so as Fn,ta as In,ti as Ln,u as Rn,ua as zn,ui as Bn,va as Vn,vi as Hn,vr as Un,wa as Wn,wi as Gn,wn as Kn,wr as qn,xa as Jn,xr as Yn,ya as Xn,za as Zn,zi as Qn,zr as $n}from"./extension-hook-UDdYbDsl.js";import{a as er,o as tr,s as nr,t as rr}from"./document-aOA3zT2S.js";import{t as ir}from"./preload-helper-DY31Aviq.js";import{a as ar,i as or,n as sr,r as cr,t as lr}from"./base-face-CD4oLBv-.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ur=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},ee={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function I(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ee,e.act=I,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=I,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),dr=t(((e,t)=>{t.exports=ur()})),J=e(dr(),1),fr=Oe(),pr=B(()=>Xe(`status`,[Ze({status:Ve(`available`)}).strict(),Ze({status:Ve(`unavailable`),reason:V()}).strict()])),mr=fr,hr=B(()=>Te(V(),mr)),gr=e=>mr.parse(e),_r=e=>hr.parse(e),vr=B(()=>Ze({code:V().min(1).max(160),message:V().min(1).max(512),details:mr.optional()}).strict()),yr=e=>vr.parse(e),br=hr,xr=B(()=>V().refine(e=>e.trim().length>0)),Sr=pr,Cr=B(()=>pe([Ze({type:Ve(`action`)}).strict(),Ze({type:Ve(`custom`),data:hr}).strict(),Ze({type:Ve(`choice`),options:se(Ze({value:mr,label:xr,description:xr.optional()}))}).strict(),Ze({type:Ve(`form`),submitLabel:xr.optional()}).strict(),Ze({type:Ve(`confirmation`),message:xr,confirmLabel:xr.optional(),cancelLabel:xr.optional()}).strict()])),wr=B(()=>Ze({inputSchema:br.optional(),outputSchema:br.optional(),presentation:Cr.optional()}).strict()),Tr=B(()=>Pe().int().refine(e=>Number.isSafeInteger(e))),Er=B(()=>Ze({hint:xr.pipe(V().max(120)),words:se(Ze({word:V().regex(/^\S{1,64}$/u),description:xr.pipe(V().max(512)).optional(),arguments:hr}).strict()).max(32).optional(),text:Ze({field:xr.pipe(V().max(120)),arguments:hr,requestIdField:xr.pipe(V().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Dr=B(()=>Ze({order:Tr.optional()}).strict()),Or=B(()=>Ze({bindings:Ze({order:Tr.optional(),values:se(xr).max(16)}).strict().optional(),agent:Ze({keybind:xr.optional(),order:Tr.optional()}).strict().optional(),help:Dr.optional(),menu:Dr.optional(),palette:Dr.optional(),slash:Ze({aliases:se(xr).max(16),consumesDraft:n().optional(),order:Tr.optional(),arguments:Er.optional()}).strict().optional()}).strict()),kr=B(()=>Ze({id:xr.refine(e=>!e.includes(`:`)),title:xr,category:xr,description:xr.optional(),projections:Or.optional(),action:wr.optional(),availability:Sr.optional()}).strict()),Ar=e=>kr.parse(e),jr=B(()=>Ze({inputSchema:br.optional(),outputSchema:br.optional()}).strict()),Mr=V().min(1).brand(),Nr=B(()=>Ze({commandId:Mr,command:Ze({namespace:V(),id:V()}).strict(),sourceId:V(),scope:V().optional(),title:V(),category:V(),description:V().optional(),order:Pe(),availability:pr,action:jr.optional(),keybind:V().optional()}).strict());se(Nr);var Pr=8192,Fr=xr.pipe(V().max(Pr)),Ir=xr.pipe(V().max(60)),Lr=at({protocol:/^https?$/u}),Rr=Ze({label:Fr,value:Fr}).strict(),zr={summary:Fr.optional(),facts:se(Rr).max(4).optional(),body:Fr.optional(),bodyLabel:Fr.optional(),details:se(Rr).max(24).optional()},Br=Xe(`type`,[Ze({type:Ve(`choice`),message:Ir,...zr,current:Fr.optional(),collapsedGroup:Fr.optional(),options:se(Ze({value:Fr,label:Fr,description:Fr.optional(),group:Fr.optional(),destructive:Ve(!0).optional()}).strict()).min(1).max(256)}).strict(),Ze({type:Ve(`text`),message:Ir,...zr,placeholder:Fr.optional(),secret:n().optional()}).strict(),Ze({type:Ve(`confirmation`),message:Ir,...zr,confirmLabel:Fr.optional(),cancelLabel:Fr.optional(),destructive:Ve(!0).optional()}).strict(),Ze({type:Ve(`decision`),message:Ir,...zr,options:se(Ze({value:Fr,label:Fr,description:Fr.optional(),destructive:Ve(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:n().optional(),other:Ze({label:Fr,placeholder:Fr.optional(),maxLength:Pe().int().min(1).max(Pr),blank:Fr.optional()}).strict().optional(),escape:Fr.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),Vr=B(()=>Xe(`type`,[Ze({type:Ve(`info`),message:Fr,links:se(Ze({url:Lr,label:Fr.optional()}).strict()).max(16).optional()}).strict(),Ze({type:Ve(`progress`),message:Fr}).strict(),Ze({type:Ve(`handoff`),url:Lr,code:Fr.optional(),message:Fr.optional()}).strict(),Ze({type:Ve(`success`),message:Fr}).strict()])),Hr=e=>Br.parse(e),Ur=e=>Vr.parse(e),Wr={decision:e=>{let t=Br.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return Ze({selected:se(V()).max(t.options.length),text:ze(xr.pipe(V().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(Br.options[2].parse(e),n()),text:e=>(Br.options[1].parse(e),V().max(Pr)),choice:e=>{let t=Br.options[0].parse(e);return V().refine(e=>t.options.some(t=>t.value===e))}};function Gr(e){let t=Wr[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var Kr=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},qr=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Jr(){let e=!1,t=Di,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=Di,s(),o.clear())},contribute:t=>{if(ri(t),e)throw new qr;ii(t,n),ai(t,n);let r=Symbol(`whistle-contribution`);ni(t)||(n=[...n,{contribution:oi(t),generation:r}],i=!0,s());let a=!0;return Ti(o=>{if(!a||e)return;let c={...t,commands:o};ri(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);ii(c,u),ai(c,u);let d=oi(c);if(ni(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=ti(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=ki(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&Yr.has(r.origin)&&(o=n({commandId:ei(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=ji(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return Di;let a=n.flatMap(e=>e.contribution.commands.map(ki));return(i||a.some((e,t)=>!Ai(e,r[t])))&&(t=Mi(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Yr=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Xr=16,Zr=32,Qr=64,$r=256;function ei(e,t){return Mr.parse(`${e}:${t}`)}function ti(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function ni(e){return e.commands.length===0}function ri(e){Ci(e.sourceId,`source ID`),Ci(e.namespace,`namespace`),e.scope!==void 0&&Ci(e.scope,`scope`);for(let t of e.commands)vi(t)}function ii(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Ei(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(ei(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=ei(e.namespace,t.id);n.has(i)&&Ei(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Ei(`Slash alias is already registered`),r.add(e)}}function ai(e,t){t.length>=Qr&&Ei(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>$r&&Ei(`Live command capacity exceeded`)}function oi(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(si)};return e.scope===void 0?t:{...t,scope:e.scope}}function si(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=ci(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=fi(e.projections)),t}function ci(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=li(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=li(e.outputSchema)),e.presentation!==void 0&&(t.presentation=di(e.presentation)),Object.freeze(t)}function li(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ui(t)])))}function ui(e){return Array.isArray(e)?Object.freeze(e.map(ui)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ui(t)]))):e}function di(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:li(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:ui(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function fi(e){let t={};return e.bindings!==void 0&&(t.bindings=pi(e.bindings)),e.agent!==void 0&&(t.agent=mi(e.agent)),e.help!==void 0&&(t.help=hi(e.help.order)),e.menu!==void 0&&(t.menu=hi(e.menu.order)),e.palette!==void 0&&(t.palette=hi(e.palette.order)),e.slash!==void 0&&(t.slash=gi(e.slash)),t}function pi(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function mi(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function hi(e){let t={};return e!==void 0&&(t.order=e),t}function gi(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=_i(e.arguments)),t}function _i(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:li(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:li(e.text.arguments)})),Object.freeze(t)}function vi(e){Ci(e.id,`command ID`,!0),Ci(e.title,`title`),Ci(e.category,`category`),yi(e.action),bi(e.projections)}function yi(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Ci(t.label,`choice label`),t.description!==void 0&&Ci(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Ci(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Ci(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Ci(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Ci(e.presentation.cancelLabel,`cancellation label`)}}function bi(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&wi(t.order);if(e.bindings!==void 0&&Si(e.bindings.values,`binding`),e.slash!==void 0){Si(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Ei(`slash alias must not contain whitespace`);xi(e.slash.arguments)}e.agent?.keybind!==void 0&&Ci(e.agent.keybind,`agent keybind`)}}function xi(e){if(e===void 0)return;Ci(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Ei(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Ci(n.word,`argument word`),/\s/u.test(n.word)&&Ei(`argument word must not contain whitespace`),t.has(n.word)&&Ei(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Ci(n.description,`argument word description`);t.size>Zr&&Ei(`argument word count exceeds 32`),e.text!==void 0&&(Ci(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Ci(e.text.requestIdField,`request id field`))}function Si(e,t){e.length>Xr&&Ei(`${t} count exceeds 16`);for(let n of e)Ci(n,t)}function Ci(e,t,n=!1){e.trim().length===0&&Ei(`${t} must not be blank`),n&&e.includes(`:`)&&Ei(`${t} must not contain a colon`)}function wi(e){e!==void 0&&!Number.isSafeInteger(e)&&Ei(`order must be a safe integer`)}function Ti(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Ei(e){throw Error(e)}var Di=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Oi=Object.freeze({status:`available`});function ki(e){let t=e.availability?.()??Oi;return t.status===`available`?Oi:Object.freeze({status:`unavailable`,reason:t.reason})}function Ai(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function ji(e){if(e instanceof Kr){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:ui(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Mi(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??Oi;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...zi(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...zi(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...zi(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...zi(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...zi(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Vi(e,l,u.agent,d))}}return Ii(n),Li(i),Fi(r),Fi(a),Fi(o),Fi(s),Object.freeze({bindings:Ri(n),palette:Ri(r),slash:Ri(i),help:Ri(a),menu:Ri(o),agent:Ri(s)})}var Ni=new TextEncoder;function Pi(e,t){let n=Ni.encode(e),r=Ni.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function Fi(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId))}function Ii(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId)||Pi(e.binding,t.binding))}function Li(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId)||Pi(e.alias,t.alias))}function Ri(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function zi(e,t,n,r){let i=Bi(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Bi(e,t,n,r){let i={commandId:ei(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Vi(e,t,n,r){let i=zi(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Hi(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Hi(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function Ui(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:gr(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}var Wi=[`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`DELIVERY_PENDING`,`DISCONNECTED`,`FILE_TOO_LARGE`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SELECTION_CHANGED`,`TIMEOUT`];H({name:U(`AppError`),code:Ht(Wi),retryable:wt});var Y=class extends Error{code;retryable;constructor(e,t){super(e,{cause:t.cause}),this.name=`AppError`,this.code=t.code,this.retryable=t.retryable}};oe(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Gi=`data-theme`;function Ki(e){return e||(globalThis.document?.documentElement??null)}function qi(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function Ji(e,t){let n=qi(e),r=Ki(t);r&&r.setAttribute(Gi,n)}function Yi(e){return Ki(e)?.getAttribute(Gi)??null}var Xi=t((e=>{var t=dr(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Zi=t(((e,t)=>{t.exports=Xi()})),X=Zi(),Qi=J.createContext(void 0),$i=e=>{let t=J.useContext(Qi);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ea=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(Qi.Provider,{value:e,children:t})),ta={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},na=new class{#e=ta;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 ra(e){setTimeout(e,0)}var ia=typeof window>`u`||`Deno`in globalThis;function aa(){}function oa(e,t){return typeof e==`function`?e(t):e}function sa(e){return typeof e==`number`&&e>=0&&e!==1/0}function ca(e,t){return Math.max(e+(t||0)-Date.now(),0)}function la(e,t){return typeof e==`function`?e(t):e}function ua(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==fa(o,t.options))return!1}else if(!ma(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 da(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(pa(t.options.mutationKey)!==pa(a))return!1}else if(!ma(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function fa(e,t){return(t?.queryKeyHashFn||pa)(e)}function pa(e){return JSON.stringify(e,(e,t)=>ya(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ma(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)){for(let n=0;n<t.length;n++)if(!ma(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ma(e[r],t[r]))return!1;return!0}return!1}var ha=Object.prototype.hasOwnProperty;function ga(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=va(e)&&va(t);if(!r&&!(ya(e)&&ya(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:ha.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ga(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function _a(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 va(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ya(e){if(!ba(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ba(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ba(e){return Object.prototype.toString.call(e)===`[object Object]`}function xa(e){return new Promise(t=>{na.setTimeout(t,e)})}function Sa(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ga(e,t)}function Ca(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function wa(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ta=Symbol();function Ea(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ta?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Da(e,t){return typeof e==`function`?e(...t):!!e}function Oa(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ka=()=>ia,Aa=()=>ka(),ja=class{constructor(){this.listeners=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(){}},Ma=new class extends ja{#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`}},Na=ra;function Pa(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Na,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}}}var Fa=Pa(),Ia=new class extends ja{#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 La(e){return Math.min(1e3*2**e,3e4)}function Ra(e){return(e??`online`)!==`online`||Ia.isOnline()}var za=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ba(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(aa);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new za(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Ma.isFocused()&&(e.networkMode===`always`||Ia.isOnline())&&e.canRun(),p=()=>Ra(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(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??(Aa()?0:3),a=e.retryDelay??La,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),xa(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Va=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sa(this.gcTime)&&(this.#e=na.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Aa()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(na.clearTimeout(this.#e),this.#e=void 0)}};function Ha(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=>{Oa(e,()=>t.signal,()=>n=!0)},u=Ea(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?wa:Ca;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Wa:Ua,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:Ua(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 Ua(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 Wa(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ga(e,t){return t?Ua(e,t)!=null:!1}function Ka(e,t){return!t||!e.getPreviousPageParam?!1:Wa(e,t)!=null}var qa=class extends Va{#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=Xa(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=Xa(this.options);e.data!==void 0&&(this.setState(Ya(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Sa(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(aa).catch(aa):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=>la(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ta||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>la(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:!ca(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=Ea(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`?Ha(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=Ba({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof za&&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 za){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,...Ja(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ya(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),Fa.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ja(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ra(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ya(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Xa(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 Za=class extends ja{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=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),$a(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return eo(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return eo(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=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 la(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&&!_a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&to(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||la(this.options.enabled,this.#t)!==la(t.enabled,this.#t)||la(this.options.staleTime,this.#t)!==la(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||la(this.options.enabled,this.#t)!==la(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 _a(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(aa)),t}#h(e){return!Aa()&&la(this.options.enabled,this.#t)!==!1&&sa(e)}#g(){this.#b();let e=la(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ca(this.#r.dataUpdatedAt,e)+1;this.#u=na.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=na.setInterval(()=>{(this.options.refetchIntervalInBackground||Ma.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(na.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(na.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&&$a(e,t),o=i&&to(e,n,t,r);(a||o)&&(l={...l,...Ja(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=Sa(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=Sa(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:no(e,t),refetch:this.refetch,isEnabled:la(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),_a(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)})})();Fa.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 Qa(e,t){return la(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||la(t.retryOnMount,e)!==!1)}function $a(e,t){return Qa(e,t)||e.state.data!==void 0&&eo(e,t,t.refetchOnMount)}function eo(e,t,n){if(la(t.enabled,e)!==!1&&la(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&no(e,t)}return!1}function to(e,t,n,r){return(e!==t||la(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&no(e,n)}function no(e,t){return la(t.enabled,e)!==!1&&e.isStaleByTime(la(t.staleTime,e))}var ro=class extends Za{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:Ga(t,n.data),hasPreviousPage:Ka(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},io=class extends Va{#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||ao(),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=Ba({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(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),Fa.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ao(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var oo=class extends ja{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new io({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=so(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=so(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=so(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=so(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Fa.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=>da(t,e))}findAll(e={}){return this.getAll().filter(t=>da(e,t))}notify(e){Fa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Fa.batch(()=>Promise.all(e.map(e=>e.continue().catch(aa))))}};function so(e){return e.options.scope?.id}var co=class extends ja{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),_a(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&pa(t.mutationKey)!==pa(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ao();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Fa.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function lo(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var uo=class extends ja{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Fa.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!_a(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(lo(e,n).forEach(e=>{e.destroy()}),lo(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ga(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Za(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Fa.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},fo=class extends ja{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??fa(r,t),a=this.get(i);return a||(a=new qa({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Fa.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=>ua(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ua(e,t)):t}notify(e){Fa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},po=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new fo,this.#t=e.mutationCache||new oo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ma.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ia.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(la(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=oa(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Fa.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;Fa.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Fa.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=Fa.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(aa).catch(aa)}invalidateQueries(e,t={}){return Fa.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=Fa.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(aa)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(aa)}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(la(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(la(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(aa).catch(aa)}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(aa).catch(aa)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ia.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(pa(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ma(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(pa(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ma(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||=fa(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===Ta&&(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()}};function mo({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Ca(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Oa({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}var ho=J.createContext(!1),go=()=>J.useContext(ho);ho.Provider;function _o(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vo=J.createContext(_o()),yo=()=>J.useContext(vo),bo=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Da(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},xo=e=>{J.useEffect(()=>{e.clearReset()},[e])},So=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Da(n,[e.error,r])),Co=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))}},wo=(e,t)=>e?.suspense&&t.isPending,To=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Eo({queries:e,...t},n){let r=$i(n),i=go(),a=yo(),o=t.subscribed!==!1,s=J.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Co(e);let t=r.getQueryCache().get(e.queryHash);bo(e,a,t)}),xo(a);let[c]=J.useState(()=>new uo(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(Fa.batchCalls(e)):aa,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>wo(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&wo(n,e)?To(n,new Za(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&So({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function Do(e,t,n){let r=go(),i=yo(),a=$i(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Co(o),bo(o,i,s),xo(i);let[l]=J.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=d?l.subscribe(Fa.batchCalls(e)):aa;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(o)},[o,l]),wo(o,u))throw To(o,l,i);if(So({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Oo(e,t){return Do(e,Za,t)}function ko(e){return e}function Ao(e){return e}function jo(e,t){let n=$i(t),[r]=J.useState(()=>new co(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(Fa.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(aa)},[r]);if(i.error&&Da(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Mo=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),No=t(((e,t)=>{t.exports=Mo()})),Po=t((e=>{var t=dr(),n=No();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),A=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.offscreen`),F=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,te;function ne(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``}return`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/runtime-core-CqqxD70n.js","assets/rolldown-runtime-hePW80VL.js","assets/Effect-TOXKEWei.js","assets/extension-hook-CGfHHaEt.js","assets/preload-helper-DY31Aviq.js","assets/extensions-BUUGqZ5T.js","assets/mushroom-BcYLQ0Mq.js","assets/document-aOA3zT2S.js","assets/renderer-BnzZtBi_.js","assets/cat-DYC4NkHa.js","assets/base-face-CD4oLBv-.js","assets/burger-DGwSIRh1.js","assets/parakeet-conversation-CsLT5hy_.js","assets/parakeet-conversation-COndlivb.css"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$i as n,Aa as r,Ba as i,Bi as a,Ca as o,Da as s,E as c,Ea as l,Fa as u,Fi as d,Ga as f,Gi as p,Gn as m,Ha as h,Hi as g,I as _,Ia as v,Ii as y,Ja as b,Ka as x,Ki as S,La as C,Li as w,Ma as T,Mi as E,Na as D,Ni as O,Oa as k,Pa as A,Pi as j,Qn as M,Ra as N,Ri as P,Sa as F,St as ee,Ta as I,Ua as te,Ui as ne,V as re,Va as ie,Vi as L,Vn as ae,Wi as oe,X as R,Xi as se,Xn as ce,Y as le,Ya as z,Yi as ue,Zi as de,Zn as fe,_a as pe,a as me,aa as B,ar as he,at as ge,ba as _e,bt as ve,d as ye,da as be,dt as xe,ea as Se,er as Ce,et as we,fa as Te,ft as Ee,g as De,ia as Oe,j as ke,ja as Ae,ji as je,ka as Me,l as Ne,la as Pe,li as Fe,m as Ie,ma as V,mi as Le,mt as Re,na as ze,nr as Be,oa as Ve,pa as He,pt as Ue,qi as We,rr as Ge,rt as Ke,s as qe,sa as Je,t as Ye,ta as Xe,ua as Ze,va as Qe,vt as $e,wa as et,wi as tt,xa as nt,xt as rt,y as it,ya as at,yi as ot,yt as st,za as ct,zi as lt}from"./Effect-TOXKEWei.js";import{$r as H,Aa as ut,Ar as dt,Br as ft,Da as pt,Di as mt,Dr as ht,Ea as gt,Ei as _t,Fa as vt,Fi as yt,Ga as bt,Gr as xt,Ha as St,Hr as U,Ii as Ct,Ir as wt,Ja as Tt,Jr as Et,Ka as Dt,Ma as Ot,Na as kt,Nr as At,Oa as jt,Or as Mt,Pa as Nt,Pr as Pt,Qr as W,Rr as Ft,Sa as It,Si as Lt,Ta as Rt,Ti as zt,Tr as Bt,Ui as Vt,Ur as Ht,Va as Ut,Vn as Wt,Vr as Gt,Wa as Kt,Xa as qt,Xr as Jt,Yr as Yt,Za as Xt,Zi as G,Zr as Zt,_a as Qt,_i as $t,aa as en,ai as tn,ao as nn,ba as rn,ca as an,ci as on,d as sn,da as cn,di as ln,eo as un,f as dn,gi as fn,ha as pn,hi as mn,i as hn,ii as gn,io as _n,ja as vn,jr as yn,ka as bn,kr as xn,l as Sn,la as K,li as q,m as Cn,mi as wn,n as Tn,ni as En,oi as Dn,p as On,pr as kn,qa as An,qi as jn,qr as Mn,ri as Nn,si as Pn,so as Fn,ta as In,ti as Ln,u as Rn,ua as zn,ui as Bn,va as Vn,vi as Hn,vr as Un,wa as Wn,wi as Gn,wn as Kn,wr as qn,xa as Jn,xr as Yn,ya as Xn,za as Zn,zi as Qn,zr as $n}from"./extension-hook-CGfHHaEt.js";import{a as er,o as tr,s as nr,t as rr}from"./document-aOA3zT2S.js";import{t as ir}from"./preload-helper-DY31Aviq.js";import{a as ar,i as or,n as sr,r as cr,t as lr}from"./base-face-CD4oLBv-.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ur=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},ee={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function I(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ee,e.act=I,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=I,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),dr=t(((e,t)=>{t.exports=ur()})),J=e(dr(),1),fr=Oe(),pr=B(()=>Xe(`status`,[Ze({status:Ve(`available`)}).strict(),Ze({status:Ve(`unavailable`),reason:V()}).strict()])),mr=fr,hr=B(()=>Te(V(),mr)),gr=e=>mr.parse(e),_r=e=>hr.parse(e),vr=B(()=>Ze({code:V().min(1).max(160),message:V().min(1).max(512),details:mr.optional()}).strict()),yr=e=>vr.parse(e),br=hr,xr=B(()=>V().refine(e=>e.trim().length>0)),Sr=pr,Cr=B(()=>pe([Ze({type:Ve(`action`)}).strict(),Ze({type:Ve(`custom`),data:hr}).strict(),Ze({type:Ve(`choice`),options:se(Ze({value:mr,label:xr,description:xr.optional()}))}).strict(),Ze({type:Ve(`form`),submitLabel:xr.optional()}).strict(),Ze({type:Ve(`confirmation`),message:xr,confirmLabel:xr.optional(),cancelLabel:xr.optional()}).strict()])),wr=B(()=>Ze({inputSchema:br.optional(),outputSchema:br.optional(),presentation:Cr.optional()}).strict()),Tr=B(()=>Pe().int().refine(e=>Number.isSafeInteger(e))),Er=B(()=>Ze({hint:xr.pipe(V().max(120)),words:se(Ze({word:V().regex(/^\S{1,64}$/u),description:xr.pipe(V().max(512)).optional(),arguments:hr}).strict()).max(32).optional(),text:Ze({field:xr.pipe(V().max(120)),arguments:hr,requestIdField:xr.pipe(V().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Dr=B(()=>Ze({order:Tr.optional()}).strict()),Or=B(()=>Ze({bindings:Ze({order:Tr.optional(),values:se(xr).max(16)}).strict().optional(),agent:Ze({keybind:xr.optional(),order:Tr.optional()}).strict().optional(),help:Dr.optional(),menu:Dr.optional(),palette:Dr.optional(),slash:Ze({aliases:se(xr).max(16),consumesDraft:n().optional(),order:Tr.optional(),arguments:Er.optional()}).strict().optional()}).strict()),kr=B(()=>Ze({id:xr.refine(e=>!e.includes(`:`)),title:xr,category:xr,description:xr.optional(),projections:Or.optional(),action:wr.optional(),availability:Sr.optional()}).strict()),Ar=e=>kr.parse(e),jr=B(()=>Ze({inputSchema:br.optional(),outputSchema:br.optional()}).strict()),Mr=V().min(1).brand(),Nr=B(()=>Ze({commandId:Mr,command:Ze({namespace:V(),id:V()}).strict(),sourceId:V(),scope:V().optional(),title:V(),category:V(),description:V().optional(),order:Pe(),availability:pr,action:jr.optional(),keybind:V().optional()}).strict());se(Nr);var Pr=8192,Fr=xr.pipe(V().max(Pr)),Ir=xr.pipe(V().max(60)),Lr=at({protocol:/^https?$/u}),Rr=Ze({label:Fr,value:Fr}).strict(),zr={summary:Fr.optional(),facts:se(Rr).max(4).optional(),body:Fr.optional(),bodyLabel:Fr.optional(),details:se(Rr).max(24).optional()},Br=Xe(`type`,[Ze({type:Ve(`choice`),message:Ir,...zr,current:Fr.optional(),collapsedGroup:Fr.optional(),options:se(Ze({value:Fr,label:Fr,description:Fr.optional(),group:Fr.optional(),destructive:Ve(!0).optional()}).strict()).min(1).max(256)}).strict(),Ze({type:Ve(`text`),message:Ir,...zr,placeholder:Fr.optional(),secret:n().optional()}).strict(),Ze({type:Ve(`confirmation`),message:Ir,...zr,confirmLabel:Fr.optional(),cancelLabel:Fr.optional(),destructive:Ve(!0).optional()}).strict(),Ze({type:Ve(`decision`),message:Ir,...zr,options:se(Ze({value:Fr,label:Fr,description:Fr.optional(),destructive:Ve(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:n().optional(),other:Ze({label:Fr,placeholder:Fr.optional(),maxLength:Pe().int().min(1).max(Pr),blank:Fr.optional()}).strict().optional(),escape:Fr.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),Vr=B(()=>Xe(`type`,[Ze({type:Ve(`info`),message:Fr,links:se(Ze({url:Lr,label:Fr.optional()}).strict()).max(16).optional()}).strict(),Ze({type:Ve(`progress`),message:Fr}).strict(),Ze({type:Ve(`handoff`),url:Lr,code:Fr.optional(),message:Fr.optional()}).strict(),Ze({type:Ve(`success`),message:Fr}).strict()])),Hr=e=>Br.parse(e),Ur=e=>Vr.parse(e),Wr={decision:e=>{let t=Br.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return Ze({selected:se(V()).max(t.options.length),text:ze(xr.pipe(V().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(Br.options[2].parse(e),n()),text:e=>(Br.options[1].parse(e),V().max(Pr)),choice:e=>{let t=Br.options[0].parse(e);return V().refine(e=>t.options.some(t=>t.value===e))}};function Gr(e){let t=Wr[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var Kr=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},qr=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Jr(){let e=!1,t=Di,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=Di,s(),o.clear())},contribute:t=>{if(ri(t),e)throw new qr;ii(t,n),ai(t,n);let r=Symbol(`whistle-contribution`);ni(t)||(n=[...n,{contribution:oi(t),generation:r}],i=!0,s());let a=!0;return Ti(o=>{if(!a||e)return;let c={...t,commands:o};ri(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);ii(c,u),ai(c,u);let d=oi(c);if(ni(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=ti(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=ki(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&Yr.has(r.origin)&&(o=n({commandId:ei(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=ji(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return Di;let a=n.flatMap(e=>e.contribution.commands.map(ki));return(i||a.some((e,t)=>!Ai(e,r[t])))&&(t=Mi(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Yr=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Xr=16,Zr=32,Qr=64,$r=256;function ei(e,t){return Mr.parse(`${e}:${t}`)}function ti(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function ni(e){return e.commands.length===0}function ri(e){Ci(e.sourceId,`source ID`),Ci(e.namespace,`namespace`),e.scope!==void 0&&Ci(e.scope,`scope`);for(let t of e.commands)vi(t)}function ii(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Ei(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(ei(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=ei(e.namespace,t.id);n.has(i)&&Ei(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Ei(`Slash alias is already registered`),r.add(e)}}function ai(e,t){t.length>=Qr&&Ei(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>$r&&Ei(`Live command capacity exceeded`)}function oi(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(si)};return e.scope===void 0?t:{...t,scope:e.scope}}function si(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=ci(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=fi(e.projections)),t}function ci(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=li(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=li(e.outputSchema)),e.presentation!==void 0&&(t.presentation=di(e.presentation)),Object.freeze(t)}function li(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ui(t)])))}function ui(e){return Array.isArray(e)?Object.freeze(e.map(ui)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ui(t)]))):e}function di(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:li(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:ui(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function fi(e){let t={};return e.bindings!==void 0&&(t.bindings=pi(e.bindings)),e.agent!==void 0&&(t.agent=mi(e.agent)),e.help!==void 0&&(t.help=hi(e.help.order)),e.menu!==void 0&&(t.menu=hi(e.menu.order)),e.palette!==void 0&&(t.palette=hi(e.palette.order)),e.slash!==void 0&&(t.slash=gi(e.slash)),t}function pi(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function mi(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function hi(e){let t={};return e!==void 0&&(t.order=e),t}function gi(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=_i(e.arguments)),t}function _i(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:li(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:li(e.text.arguments)})),Object.freeze(t)}function vi(e){Ci(e.id,`command ID`,!0),Ci(e.title,`title`),Ci(e.category,`category`),yi(e.action),bi(e.projections)}function yi(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Ci(t.label,`choice label`),t.description!==void 0&&Ci(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Ci(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Ci(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Ci(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Ci(e.presentation.cancelLabel,`cancellation label`)}}function bi(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&wi(t.order);if(e.bindings!==void 0&&Si(e.bindings.values,`binding`),e.slash!==void 0){Si(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Ei(`slash alias must not contain whitespace`);xi(e.slash.arguments)}e.agent?.keybind!==void 0&&Ci(e.agent.keybind,`agent keybind`)}}function xi(e){if(e===void 0)return;Ci(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Ei(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Ci(n.word,`argument word`),/\s/u.test(n.word)&&Ei(`argument word must not contain whitespace`),t.has(n.word)&&Ei(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Ci(n.description,`argument word description`);t.size>Zr&&Ei(`argument word count exceeds 32`),e.text!==void 0&&(Ci(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Ci(e.text.requestIdField,`request id field`))}function Si(e,t){e.length>Xr&&Ei(`${t} count exceeds 16`);for(let n of e)Ci(n,t)}function Ci(e,t,n=!1){e.trim().length===0&&Ei(`${t} must not be blank`),n&&e.includes(`:`)&&Ei(`${t} must not contain a colon`)}function wi(e){e!==void 0&&!Number.isSafeInteger(e)&&Ei(`order must be a safe integer`)}function Ti(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Ei(e){throw Error(e)}var Di=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Oi=Object.freeze({status:`available`});function ki(e){let t=e.availability?.()??Oi;return t.status===`available`?Oi:Object.freeze({status:`unavailable`,reason:t.reason})}function Ai(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function ji(e){if(e instanceof Kr){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:ui(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Mi(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??Oi;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...zi(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...zi(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...zi(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...zi(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...zi(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Vi(e,l,u.agent,d))}}return Ii(n),Li(i),Fi(r),Fi(a),Fi(o),Fi(s),Object.freeze({bindings:Ri(n),palette:Ri(r),slash:Ri(i),help:Ri(a),menu:Ri(o),agent:Ri(s)})}var Ni=new TextEncoder;function Pi(e,t){let n=Ni.encode(e),r=Ni.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function Fi(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId))}function Ii(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId)||Pi(e.binding,t.binding))}function Li(e){e.sort((e,t)=>e.order-t.order||Pi(e.commandId,t.commandId)||Pi(e.alias,t.alias))}function Ri(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function zi(e,t,n,r){let i=Bi(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Bi(e,t,n,r){let i={commandId:ei(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Vi(e,t,n,r){let i=zi(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Hi(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Hi(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function Ui(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:gr(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}var Wi=[`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`DELIVERY_PENDING`,`DISCONNECTED`,`FILE_TOO_LARGE`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SELECTION_CHANGED`,`TIMEOUT`];H({name:U(`AppError`),code:Ht(Wi),retryable:wt});var Y=class extends Error{code;retryable;constructor(e,t){super(e,{cause:t.cause}),this.name=`AppError`,this.code=t.code,this.retryable=t.retryable}};oe(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Gi=`data-theme`;function Ki(e){return e||(globalThis.document?.documentElement??null)}function qi(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function Ji(e,t){let n=qi(e),r=Ki(t);r&&r.setAttribute(Gi,n)}function Yi(e){return Ki(e)?.getAttribute(Gi)??null}var Xi=t((e=>{var t=dr(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Zi=t(((e,t)=>{t.exports=Xi()})),X=Zi(),Qi=J.createContext(void 0),$i=e=>{let t=J.useContext(Qi);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ea=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(Qi.Provider,{value:e,children:t})),ta={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},na=new class{#e=ta;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 ra(e){setTimeout(e,0)}var ia=typeof window>`u`||`Deno`in globalThis;function aa(){}function oa(e,t){return typeof e==`function`?e(t):e}function sa(e){return typeof e==`number`&&e>=0&&e!==1/0}function ca(e,t){return Math.max(e+(t||0)-Date.now(),0)}function la(e,t){return typeof e==`function`?e(t):e}function ua(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==fa(o,t.options))return!1}else if(!ma(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 da(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(pa(t.options.mutationKey)!==pa(a))return!1}else if(!ma(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function fa(e,t){return(t?.queryKeyHashFn||pa)(e)}function pa(e){return JSON.stringify(e,(e,t)=>ya(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ma(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)){for(let n=0;n<t.length;n++)if(!ma(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ma(e[r],t[r]))return!1;return!0}return!1}var ha=Object.prototype.hasOwnProperty;function ga(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=va(e)&&va(t);if(!r&&!(ya(e)&&ya(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:ha.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ga(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function _a(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 va(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ya(e){if(!ba(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ba(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ba(e){return Object.prototype.toString.call(e)===`[object Object]`}function xa(e){return new Promise(t=>{na.setTimeout(t,e)})}function Sa(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ga(e,t)}function Ca(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function wa(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ta=Symbol();function Ea(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ta?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Da(e,t){return typeof e==`function`?e(...t):!!e}function Oa(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ka=()=>ia,Aa=()=>ka(),ja=class{constructor(){this.listeners=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(){}},Ma=new class extends ja{#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`}},Na=ra;function Pa(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Na,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}}}var Fa=Pa(),Ia=new class extends ja{#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 La(e){return Math.min(1e3*2**e,3e4)}function Ra(e){return(e??`online`)!==`online`||Ia.isOnline()}var za=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ba(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(aa);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new za(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Ma.isFocused()&&(e.networkMode===`always`||Ia.isOnline())&&e.canRun(),p=()=>Ra(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(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??(Aa()?0:3),a=e.retryDelay??La,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),xa(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Va=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sa(this.gcTime)&&(this.#e=na.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Aa()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(na.clearTimeout(this.#e),this.#e=void 0)}};function Ha(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=>{Oa(e,()=>t.signal,()=>n=!0)},u=Ea(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?wa:Ca;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Wa:Ua,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:Ua(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 Ua(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 Wa(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ga(e,t){return t?Ua(e,t)!=null:!1}function Ka(e,t){return!t||!e.getPreviousPageParam?!1:Wa(e,t)!=null}var qa=class extends Va{#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=Xa(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=Xa(this.options);e.data!==void 0&&(this.setState(Ya(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Sa(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(aa).catch(aa):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=>la(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ta||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>la(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:!ca(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=Ea(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`?Ha(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=Ba({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof za&&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 za){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,...Ja(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ya(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),Fa.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ja(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ra(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ya(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Xa(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 Za=class extends ja{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=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),$a(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return eo(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return eo(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=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 la(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&&!_a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&to(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||la(this.options.enabled,this.#t)!==la(t.enabled,this.#t)||la(this.options.staleTime,this.#t)!==la(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||la(this.options.enabled,this.#t)!==la(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 _a(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(aa)),t}#h(e){return!Aa()&&la(this.options.enabled,this.#t)!==!1&&sa(e)}#g(){this.#b();let e=la(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ca(this.#r.dataUpdatedAt,e)+1;this.#u=na.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=na.setInterval(()=>{(this.options.refetchIntervalInBackground||Ma.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(na.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(na.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&&$a(e,t),o=i&&to(e,n,t,r);(a||o)&&(l={...l,...Ja(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=Sa(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=Sa(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:no(e,t),refetch:this.refetch,isEnabled:la(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),_a(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)})})();Fa.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 Qa(e,t){return la(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||la(t.retryOnMount,e)!==!1)}function $a(e,t){return Qa(e,t)||e.state.data!==void 0&&eo(e,t,t.refetchOnMount)}function eo(e,t,n){if(la(t.enabled,e)!==!1&&la(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&no(e,t)}return!1}function to(e,t,n,r){return(e!==t||la(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&no(e,n)}function no(e,t){return la(t.enabled,e)!==!1&&e.isStaleByTime(la(t.staleTime,e))}var ro=class extends Za{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:Ga(t,n.data),hasPreviousPage:Ka(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},io=class extends Va{#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||ao(),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=Ba({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(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),Fa.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ao(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var oo=class extends ja{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new io({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=so(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=so(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=so(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=so(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Fa.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=>da(t,e))}findAll(e={}){return this.getAll().filter(t=>da(e,t))}notify(e){Fa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Fa.batch(()=>Promise.all(e.map(e=>e.continue().catch(aa))))}};function so(e){return e.options.scope?.id}var co=class extends ja{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),_a(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&pa(t.mutationKey)!==pa(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ao();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Fa.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function lo(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var uo=class extends ja{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Fa.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!_a(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(lo(e,n).forEach(e=>{e.destroy()}),lo(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ga(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Za(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Fa.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},fo=class extends ja{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??fa(r,t),a=this.get(i);return a||(a=new qa({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Fa.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=>ua(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ua(e,t)):t}notify(e){Fa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},po=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new fo,this.#t=e.mutationCache||new oo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ma.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ia.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(la(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=oa(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Fa.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;Fa.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Fa.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=Fa.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(aa).catch(aa)}invalidateQueries(e,t={}){return Fa.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=Fa.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(aa)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(aa)}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(la(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(la(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(aa).catch(aa)}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(aa).catch(aa)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ia.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(pa(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ma(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(pa(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ma(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||=fa(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===Ta&&(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()}};function mo({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Ca(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Oa({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}var ho=J.createContext(!1),go=()=>J.useContext(ho);ho.Provider;function _o(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vo=J.createContext(_o()),yo=()=>J.useContext(vo),bo=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Da(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},xo=e=>{J.useEffect(()=>{e.clearReset()},[e])},So=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Da(n,[e.error,r])),Co=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))}},wo=(e,t)=>e?.suspense&&t.isPending,To=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Eo({queries:e,...t},n){let r=$i(n),i=go(),a=yo(),o=t.subscribed!==!1,s=J.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Co(e);let t=r.getQueryCache().get(e.queryHash);bo(e,a,t)}),xo(a);let[c]=J.useState(()=>new uo(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(Fa.batchCalls(e)):aa,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>wo(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&wo(n,e)?To(n,new Za(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&So({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function Do(e,t,n){let r=go(),i=yo(),a=$i(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Co(o),bo(o,i,s),xo(i);let[l]=J.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=d?l.subscribe(Fa.batchCalls(e)):aa;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(o)},[o,l]),wo(o,u))throw To(o,l,i);if(So({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Oo(e,t){return Do(e,Za,t)}function ko(e){return e}function Ao(e){return e}function jo(e,t){let n=$i(t),[r]=J.useState(()=>new co(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(Fa.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(aa)},[r]);if(i.error&&Da(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Mo=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),No=t(((e,t)=>{t.exports=Mo()})),Po=t((e=>{var t=dr(),n=No();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),A=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.offscreen`),F=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,te;function ne(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``}return`
3
3
  `+te+e}var re=!1;function ie(e,t){if(!e||re)return``;re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
4
4
  `),a=r.stack.split(`
5
5
  `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
@@ -136,7 +136,7 @@ Error generating stack: `+e.message+`
136
136
  recovery_count = recovery_count + 1
137
137
  WHERE job_id = ? AND state = 'running' AND claim_token = ?`,n.job.jobId,n.claimToken),TI(e,t,n.job.queue),{status:`requeued`};let i=r.row.cancellation_id!==null,a=i?null:r.job.recovery===void 0?`Execution disappeared without a recovery policy`:`Restart recovery budget exhausted (${String(r.job.recovery.maxRecoveries)} recoveries)`;e.sql.exec(`UPDATE watchdog_jobs
138
138
  SET state = 'settled', outcome = ?, failure_reason = ?
139
- WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i?`cancelled`:`interrupted`,a,n.job.jobId,n.claimToken);let o=xI(e,n.job.jobId)?.job;return o?.state===`settled`?(TI(e,t,o.queue,o),{status:`settled`,job:o}):{status:`conflict`}}))})};return Object.freeze({store:i(n),partition:i,transactional:r})}var MI=W.check(In(1),G(256)),NI=W.check(In(1),G(200)),PI=$n.check(Qn(-(2**53-1)),jn(2**53-1)),FI=$n.check(Qn(0),jn(2**53-1)),II=H({maxRecoveries:FI}),LI={jobId:MI,queue:MI,lane:rI,priority:PI,payload:Pn,recovery:K(II)},RI=H({...LI,state:U(`queued`)}),zI=H({...LI,state:U(`settled`),outcome:Ht([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`]),failureReason:zn(NI)}),BI=H({...LI,state:U(`running`)}),VI=Dn([RI,BI,zI]);Dn([H({kind:U(`completed`)}),H({kind:U(`failed`),reason:zn(NI)}),H({kind:U(`cancelled`)}),H({kind:U(`outcome_unknown`)})]);var HI=H({jobId:MI,cancellationId:MI,onlyIfQueued:K(wt)}),UI=Dn([H({status:U(`absent`)}),H({status:U(`present`),cancellation:HI})]);Dn([H({status:U(`found`),job:VI,cancellation:UI}),H({status:U(`missing`)})]),Dn([H({state:U(`idle`)}),H({state:Ht([`queued`,`running`]),jobId:MI,cancellationRequested:wt})]),Dn([H({status:U(`queued`)}),H({status:U(`duplicate`)})]),Dn([H({status:Ht([`recorded`,`replayed`])}),H({status:Ht([`conflict`,`missing`])})]);var WI=Dn([zt(ArrayBuffer),W,Jt,Et]);Zt(W,WI);function GI(e){return st({try:()=>{let t=e.concurrentLane===void 0?void 0:Hn(rI)(e.concurrentLane),n=jI(e.owner,e.project,t===void 0?void 0:{lane:t,include:!1}),r=nI(e,n.store),i={...r,transactional:n.transactional};if(t===void 0)return Object.freeze(i);let a=nI(e,n.partition({lane:t,include:!0}));return Object.freeze({...i,tickConcurrent:a.tick,failLane:e=>e.lane===t?a.failLane(e):r.failLane(e),cancel:e=>r.read(e.jobId).pipe(it(n=>n.status===`found`&&n.job.lane===t?a.cancel(e):r.cancel(e)))})},catch:e=>new $F(`store_unavailable`,e)})}var KI=e=>({owner:e.owner,project:e.project,isAlive:t=>$e({try:()=>e.isAlive(t),catch:e=>new $F(`liveness_unavailable`,e)}),executor:{execute:t=>$e({try:n=>e.execute(t,n),catch:()=>new $F(`execution_failed`)})},wake:{recompute:()=>$e({try:()=>e.wake.recompute(),catch:()=>new $F(`wake_unavailable`)})}}),qI=e=>Ke(e).then(e=>{if(Xt(e))return e.value;let t=fe(_n(e.cause))??Fn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))});function JI(e){let t=KI(e);return e.concurrentLane===void 0?qI(GI(t)).then(YI):qI(GI({...t,concurrentLane:e.concurrentLane})).then(e=>Object.freeze({...YI(e),tickConcurrent:()=>qI(e.tickConcurrent())}))}function YI(e){return Object.freeze({hasPendingWork:()=>qI(e.hasPendingWork),ingest:t=>qI(e.ingest(t)),read:t=>qI(e.read(t)),readQueueHead:t=>qI(e.readQueueHead(t)),tick:()=>qI(e.tick()),cancel:t=>qI(e.cancel(t)),failLane:t=>qI(e.failLane(t)),purge:t=>qI(e.purge(t)),transactional:e.transactional})}Object.freeze({make:JI});function XI(e){return R(()=>ir(()=>import(`./runtime-core-CHfIZEOV.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]))).pipe(it(({openRuntimeCore:t})=>t(e)),_(({agent:e})=>e))}function ZI(e){return e instanceof kn?e:new kn(`model`,`rejected`,`Model acquisition failed`,void 0,e)}function QI(e){return new kn(`model`,`rejected`,`Model release failed`,void 0,e)}function $I(e){let t=$e({try:()=>e.release(),catch:QI}),n={model:e.model,release:t,retryable:e.retryable};return e.failureReason!==void 0&&(n={...n,failureReason:e.failureReason}),e.providerError!==void 0&&(n={...n,providerError:e.providerError}),e.rejection!==void 0&&(n={...n,rejection:e.rejection}),e.stream===void 0?e.retryAfterMs===void 0?Object.freeze(n):Object.freeze({...n,retryAfterMs:e.retryAfterMs}):e.retryAfterMs===void 0?Object.freeze({...n,stream:e.stream}):Object.freeze({...n,stream:e.stream,retryAfterMs:e.retryAfterMs})}function eL(e){return Ne((t,n)=>{if(n.aborted)return;let r;try{r=Promise.resolve(e(n))}catch(e){t(De(ZI(e)));return}let i=r.then(e=>{if(n.aborted)return Promise.resolve(e.release()).then(()=>void 0);t(xe($I(e)))},e=>{n.aborted?Wt(`late-model-acquisition`,e):t(De(ZI(e)))});return $e({try:()=>i,catch:QI}).pipe(le)})}function tL(e){let t,n=rt(n=>it(n(e),e=>Ue(()=>(t=e,e))));return Ye(n,()=>t===void 0?ee:t.release.pipe(le),{interruptible:!0})}function nL(e){let t=({sessionId:t,preference:n})=>eL(r=>e.acquire({sessionId:t,preference:n,signal:r})),n=e.describe;return Object.freeze(n===void 0?{acquire:t}:{acquire:t,describe:({sessionId:e,preference:t})=>$e({try:r=>n({sessionId:e,preference:t,signal:r}),catch:ZI})})}function rL(e,t){return new kn(e,`rejected`,t)}var iL=W.pipe(q(In(1)),q(G(256))),aL=W.pipe(q(In(1)),q(an(e=>new TextEncoder().encode(e).byteLength<=32e3))),oL=H({revision:iL,text:aL,modules:zn(Bn(e=>Array.isArray(e)&&e.every(Le)))}),sL=Bn(e=>Fe(e)),cL=Bn(e=>Fe(e)),lL=H({bind:sL}),uL=Bn(e=>Fe(e)),dL=H({commit:uL,requestWake:cL,close:cL}),fL=H({close:cL}),pL=$t(oL),mL=$t(lL),hL=$t(dL),gL=$t(fL);function _L(e){return new kn(`runtime`,`invalid`,`Runtime host is invalid`,void 0,e)}function vL(){return new kn(`runtime`,`unavailable`,`Runtime host is unavailable`)}function yL(e,t){return st({try:()=>t.call(e),catch:vL}).pipe(it(e=>$e({try:()=>Promise.resolve(e),catch:vL})),it(e=>e===void 0?ee:De(_L())))}function bL(e,t,n){let r=gL({close:t});return r._tag===`Failure`?De(_L(n)):ve(yL(e,r.success.close)).pipe(re({onFailure:e=>De(_L({cause:n,cleanup:e})),onSuccess:()=>De(_L(n))}))}function xL(e){return Ee(()=>{if(!Le(e))return De(_L());let t=e,n;try{n=t.close}catch(e){return De(_L(e))}let r;try{r=t.requestWake}catch(e){return bL(t,n,e)}let i=hL({commit:t.commit,requestWake:r,close:n});return i._tag===`Failure`?bL(t,n):xe(Object.freeze({commit:e=>$e({try:()=>t.commit(()=>On(e)),catch:e=>e instanceof kn?e:vL()}),requestWake:yL(t,i.success.requestWake),close:yL(t,i.success.close)}))})}function SL(e){return st({try:()=>{let t=e.runtime;if(!Le(t))throw _L();let n=mL(t);if(n._tag===`Failure`)throw _L();return{receiver:t,bind:n.success.bind}},catch:_L}).pipe(_(({receiver:e,bind:t})=>Object.freeze({bind:({reconcile:n,pendingWork:r})=>st({try:()=>t.call(e,{reconcile:()=>On(n),pendingWork:()=>On(r)}),catch:vL}).pipe(it(e=>$e({try:()=>Promise.resolve(e),catch:vL})),it(xL))})))}function CL(e,t){let n={store:e.store,runtime:t,extensions:e.extensions,instructions:{load:({sessionId:t,commandId:n})=>$e({try:r=>e.instructions.load({sessionId:t,commandId:n,signal:r}),catch:()=>rL(`instructions`,`Instruction acquisition failed`)}).pipe(it(e=>{let t=pL(e);return t._tag===`Success`?xe(t.success):De(new kn(`contract`,`invalid`,`Instruction revision is invalid`))}))},model:nL(e.model)};e.meta!==void 0&&Object.assign(n,{meta:e.meta}),e.storagePressure!==void 0&&Object.assign(n,{storagePressure:e.storagePressure}),e.admission!==void 0&&Object.assign(n,{admission:e.admission}),e.compaction!==void 0&&Object.assign(n,{compaction:e.compaction});let r=e.tools;return r===void 0?n:{...n,tools:dn(r)}}function wL(e,t){return On(SL(e).pipe(it(n=>t(CL(e,n))))).then(Cn)}Object.freeze({make:e=>wL(e,XI)});var TL=200,EL=He({action:Ve(`list`)}),DL=Te(V(),Oe()).parse(structuredClone(nt(EL))),OL=120,kL=He({title:V()}).optional().transform(e=>e?.title.trim().replaceAll(/\s+/gu,` `)??``),AL=4096,jL=He({instructions:V()}).optional().transform(e=>e?.instructions.trim()??``);function ML(e,t){return e?.notify({type:`info`,message:t}),t}function NL(e,t,n){let r=e=>{throw Error(`${e} is unavailable in this host.`)},i={sourceId:n.sourceId,namespace:n.namespace,commands:[{id:`session`,title:`Session status`,category:`Advanced`,projections:{help:{order:1},palette:{order:1},slash:{aliases:[`session`],order:1}},handler:async({interaction:e})=>{let n=await t.read();return ML(e,`Session ${n.sessionId} is ${uM(sM(n))}; ${String(n.pending.prompts.length)} queued prompt${n.pending.prompts.length===1?``:`s`}.`)}},{id:`queue`,title:`Queued prompts`,category:`Advanced`,projections:{help:{order:3},palette:{order:3},slash:{aliases:[`queue`],order:3,arguments:{hint:`list`,words:[{word:`list`,description:`List accepted queued prompts`,arguments:{action:`list`}}]}}},action:{inputSchema:DL},handler:async({arguments:e,interaction:n})=>{if(!EL.safeParse(e??{action:`list`}).success)throw Error(`/queue requires list.`);let r=await t.read(),i=r.pending.prompts,a=r.terminals.map(e=>`${e.outcome} · ${e.commandId}`);ML(n,i.length===0&&a.length===0?`No queued prompts.`:[...i.map((e,t)=>`${String(t+1)}. queued · accepted: ${e.text}`),...a,...r.pending.hasMore===!0?[`More accepted prompts are waiting outside this view.`]:[]].join(`
139
+ WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i?`cancelled`:`interrupted`,a,n.job.jobId,n.claimToken);let o=xI(e,n.job.jobId)?.job;return o?.state===`settled`?(TI(e,t,o.queue,o),{status:`settled`,job:o}):{status:`conflict`}}))})};return Object.freeze({store:i(n),partition:i,transactional:r})}var MI=W.check(In(1),G(256)),NI=W.check(In(1),G(200)),PI=$n.check(Qn(-(2**53-1)),jn(2**53-1)),FI=$n.check(Qn(0),jn(2**53-1)),II=H({maxRecoveries:FI}),LI={jobId:MI,queue:MI,lane:rI,priority:PI,payload:Pn,recovery:K(II)},RI=H({...LI,state:U(`queued`)}),zI=H({...LI,state:U(`settled`),outcome:Ht([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`]),failureReason:zn(NI)}),BI=H({...LI,state:U(`running`)}),VI=Dn([RI,BI,zI]);Dn([H({kind:U(`completed`)}),H({kind:U(`failed`),reason:zn(NI)}),H({kind:U(`cancelled`)}),H({kind:U(`outcome_unknown`)})]);var HI=H({jobId:MI,cancellationId:MI,onlyIfQueued:K(wt)}),UI=Dn([H({status:U(`absent`)}),H({status:U(`present`),cancellation:HI})]);Dn([H({status:U(`found`),job:VI,cancellation:UI}),H({status:U(`missing`)})]),Dn([H({state:U(`idle`)}),H({state:Ht([`queued`,`running`]),jobId:MI,cancellationRequested:wt})]),Dn([H({status:U(`queued`)}),H({status:U(`duplicate`)})]),Dn([H({status:Ht([`recorded`,`replayed`])}),H({status:Ht([`conflict`,`missing`])})]);var WI=Dn([zt(ArrayBuffer),W,Jt,Et]);Zt(W,WI);function GI(e){return st({try:()=>{let t=e.concurrentLane===void 0?void 0:Hn(rI)(e.concurrentLane),n=jI(e.owner,e.project,t===void 0?void 0:{lane:t,include:!1}),r=nI(e,n.store),i={...r,transactional:n.transactional};if(t===void 0)return Object.freeze(i);let a=nI(e,n.partition({lane:t,include:!0}));return Object.freeze({...i,tickConcurrent:a.tick,failLane:e=>e.lane===t?a.failLane(e):r.failLane(e),cancel:e=>r.read(e.jobId).pipe(it(n=>n.status===`found`&&n.job.lane===t?a.cancel(e):r.cancel(e)))})},catch:e=>new $F(`store_unavailable`,e)})}var KI=e=>({owner:e.owner,project:e.project,isAlive:t=>$e({try:()=>e.isAlive(t),catch:e=>new $F(`liveness_unavailable`,e)}),executor:{execute:t=>$e({try:n=>e.execute(t,n),catch:()=>new $F(`execution_failed`)})},wake:{recompute:()=>$e({try:()=>e.wake.recompute(),catch:()=>new $F(`wake_unavailable`)})}}),qI=e=>Ke(e).then(e=>{if(Xt(e))return e.value;let t=fe(_n(e.cause))??Fn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))});function JI(e){let t=KI(e);return e.concurrentLane===void 0?qI(GI(t)).then(YI):qI(GI({...t,concurrentLane:e.concurrentLane})).then(e=>Object.freeze({...YI(e),tickConcurrent:()=>qI(e.tickConcurrent())}))}function YI(e){return Object.freeze({hasPendingWork:()=>qI(e.hasPendingWork),ingest:t=>qI(e.ingest(t)),read:t=>qI(e.read(t)),readQueueHead:t=>qI(e.readQueueHead(t)),tick:()=>qI(e.tick()),cancel:t=>qI(e.cancel(t)),failLane:t=>qI(e.failLane(t)),purge:t=>qI(e.purge(t)),transactional:e.transactional})}Object.freeze({make:JI});function XI(e){return R(()=>ir(()=>import(`./runtime-core-CqqxD70n.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]))).pipe(it(({openRuntimeCore:t})=>t(e)),_(({agent:e})=>e))}function ZI(e){return e instanceof kn?e:new kn(`model`,`rejected`,`Model acquisition failed`,void 0,e)}function QI(e){return new kn(`model`,`rejected`,`Model release failed`,void 0,e)}function $I(e){let t=$e({try:()=>e.release(),catch:QI}),n={model:e.model,release:t,retryable:e.retryable};return e.failureReason!==void 0&&(n={...n,failureReason:e.failureReason}),e.providerError!==void 0&&(n={...n,providerError:e.providerError}),e.rejection!==void 0&&(n={...n,rejection:e.rejection}),e.stream===void 0?e.retryAfterMs===void 0?Object.freeze(n):Object.freeze({...n,retryAfterMs:e.retryAfterMs}):e.retryAfterMs===void 0?Object.freeze({...n,stream:e.stream}):Object.freeze({...n,stream:e.stream,retryAfterMs:e.retryAfterMs})}function eL(e){return Ne((t,n)=>{if(n.aborted)return;let r;try{r=Promise.resolve(e(n))}catch(e){t(De(ZI(e)));return}let i=r.then(e=>{if(n.aborted)return Promise.resolve(e.release()).then(()=>void 0);t(xe($I(e)))},e=>{n.aborted?Wt(`late-model-acquisition`,e):t(De(ZI(e)))});return $e({try:()=>i,catch:QI}).pipe(le)})}function tL(e){let t,n=rt(n=>it(n(e),e=>Ue(()=>(t=e,e))));return Ye(n,()=>t===void 0?ee:t.release.pipe(le),{interruptible:!0})}function nL(e){let t=({sessionId:t,preference:n})=>eL(r=>e.acquire({sessionId:t,preference:n,signal:r})),n=e.describe;return Object.freeze(n===void 0?{acquire:t}:{acquire:t,describe:({sessionId:e,preference:t})=>$e({try:r=>n({sessionId:e,preference:t,signal:r}),catch:ZI})})}function rL(e,t){return new kn(e,`rejected`,t)}var iL=W.pipe(q(In(1)),q(G(256))),aL=W.pipe(q(In(1)),q(an(e=>new TextEncoder().encode(e).byteLength<=32e3))),oL=H({revision:iL,text:aL,modules:zn(Bn(e=>Array.isArray(e)&&e.every(Le)))}),sL=Bn(e=>Fe(e)),cL=Bn(e=>Fe(e)),lL=H({bind:sL}),uL=Bn(e=>Fe(e)),dL=H({commit:uL,requestWake:cL,close:cL}),fL=H({close:cL}),pL=$t(oL),mL=$t(lL),hL=$t(dL),gL=$t(fL);function _L(e){return new kn(`runtime`,`invalid`,`Runtime host is invalid`,void 0,e)}function vL(){return new kn(`runtime`,`unavailable`,`Runtime host is unavailable`)}function yL(e,t){return st({try:()=>t.call(e),catch:vL}).pipe(it(e=>$e({try:()=>Promise.resolve(e),catch:vL})),it(e=>e===void 0?ee:De(_L())))}function bL(e,t,n){let r=gL({close:t});return r._tag===`Failure`?De(_L(n)):ve(yL(e,r.success.close)).pipe(re({onFailure:e=>De(_L({cause:n,cleanup:e})),onSuccess:()=>De(_L(n))}))}function xL(e){return Ee(()=>{if(!Le(e))return De(_L());let t=e,n;try{n=t.close}catch(e){return De(_L(e))}let r;try{r=t.requestWake}catch(e){return bL(t,n,e)}let i=hL({commit:t.commit,requestWake:r,close:n});return i._tag===`Failure`?bL(t,n):xe(Object.freeze({commit:e=>$e({try:()=>t.commit(()=>On(e)),catch:e=>e instanceof kn?e:vL()}),requestWake:yL(t,i.success.requestWake),close:yL(t,i.success.close)}))})}function SL(e){return st({try:()=>{let t=e.runtime;if(!Le(t))throw _L();let n=mL(t);if(n._tag===`Failure`)throw _L();return{receiver:t,bind:n.success.bind}},catch:_L}).pipe(_(({receiver:e,bind:t})=>Object.freeze({bind:({reconcile:n,pendingWork:r})=>st({try:()=>t.call(e,{reconcile:()=>On(n),pendingWork:()=>On(r)}),catch:vL}).pipe(it(e=>$e({try:()=>Promise.resolve(e),catch:vL})),it(xL))})))}function CL(e,t){let n={store:e.store,runtime:t,extensions:e.extensions,instructions:{load:({sessionId:t,commandId:n})=>$e({try:r=>e.instructions.load({sessionId:t,commandId:n,signal:r}),catch:()=>rL(`instructions`,`Instruction acquisition failed`)}).pipe(it(e=>{let t=pL(e);return t._tag===`Success`?xe(t.success):De(new kn(`contract`,`invalid`,`Instruction revision is invalid`))}))},model:nL(e.model)};e.meta!==void 0&&Object.assign(n,{meta:e.meta}),e.storagePressure!==void 0&&Object.assign(n,{storagePressure:e.storagePressure}),e.admission!==void 0&&Object.assign(n,{admission:e.admission}),e.compaction!==void 0&&Object.assign(n,{compaction:e.compaction});let r=e.tools;return r===void 0?n:{...n,tools:dn(r)}}function wL(e,t){return On(SL(e).pipe(it(n=>t(CL(e,n))))).then(Cn)}Object.freeze({make:e=>wL(e,XI)});var TL=200,EL=He({action:Ve(`list`)}),DL=Te(V(),Oe()).parse(structuredClone(nt(EL))),OL=120,kL=He({title:V()}).optional().transform(e=>e?.title.trim().replaceAll(/\s+/gu,` `)??``),AL=4096,jL=He({instructions:V()}).optional().transform(e=>e?.instructions.trim()??``);function ML(e,t){return e?.notify({type:`info`,message:t}),t}function NL(e,t,n){let r=e=>{throw Error(`${e} is unavailable in this host.`)},i={sourceId:n.sourceId,namespace:n.namespace,commands:[{id:`session`,title:`Session status`,category:`Advanced`,projections:{help:{order:1},palette:{order:1},slash:{aliases:[`session`],order:1}},handler:async({interaction:e})=>{let n=await t.read();return ML(e,`Session ${n.sessionId} is ${uM(sM(n))}; ${String(n.pending.prompts.length)} queued prompt${n.pending.prompts.length===1?``:`s`}.`)}},{id:`queue`,title:`Queued prompts`,category:`Advanced`,projections:{help:{order:3},palette:{order:3},slash:{aliases:[`queue`],order:3,arguments:{hint:`list`,words:[{word:`list`,description:`List accepted queued prompts`,arguments:{action:`list`}}]}}},action:{inputSchema:DL},handler:async({arguments:e,interaction:n})=>{if(!EL.safeParse(e??{action:`list`}).success)throw Error(`/queue requires list.`);let r=await t.read(),i=r.pending.prompts,a=r.terminals.map(e=>`${e.outcome} · ${e.commandId}`);ML(n,i.length===0&&a.length===0?`No queued prompts.`:[...i.map((e,t)=>`${String(t+1)}. queued · accepted: ${e.text}`),...a,...r.pending.hasMore===!0?[`More accepted prompts are waiting outside this view.`]:[]].join(`
140
140
  `))}},{id:`resume`,title:`Resume a conversation`,category:`Conversation`,projections:{help:{order:5},palette:{order:5},slash:{aliases:[`resume`],order:5}},handler:async()=>{if(!n.sessionResumeAvailable||n.sessionResume===void 0){r(`/resume`);return}await n.sessionResume()}},{id:`fork`,title:`Fork conversation`,category:`Conversation`,projections:{help:{order:7},palette:{order:7},slash:{aliases:[`fork`],order:7}},handler:async({interaction:e})=>{let i=n.onForked;if(!n.forkAvailable||i===void 0){r(`/fork`);return}let a=await t.read();if(uM(sM(a))!==`idle`)throw Error(`Wait for the current run to finish, then fork.`);let o=HP(a.messages??[],a.compactions??[]).items.filter(e=>e.kind===`user_message`);if(o.length===0)throw Error(`No messages to fork from.`);if(e===void 0)throw Error(`Forking a Session needs a person.`);let s=[...o].reverse().slice(0,TL),c=Date.now(),l=await e.prompt({type:`choice`,message:`Fork from which message?`,summary:`Start a new conversation from your message.`,options:s.map(e=>({value:e.id,label:jA(e.text,44)||`(empty message)`,description:e.at===void 0?void 0:AA(e.at,c)}))}),u=await e.run(async()=>{try{return await t.command({type:`fork`,entryId:l})}catch(e){if(e instanceof kn){if(e.boundary===`runtime`&&e.cause===`conflict`)throw Error(`Wait for the current run to finish, then fork.`,{cause:e});if(e.boundary===`store`&&e.cause===`unavailable`)throw Error(`That message is no longer available to fork from.`,{cause:e});if(e.boundary===`runtime`&&e.cause===`rejected`)throw Error(`This Session is bound to a channel and cannot be forked.`,{cause:e})}throw e}});await e.run(async()=>{await i(u.sessionId)})}},{id:`compact`,title:`Compact conversation`,category:`Conversation`,description:`Summarize older context now; optional text sets its focus`,projections:{help:{order:8},palette:{order:8},slash:{aliases:[`compact`],order:8,arguments:{hint:`[instructions]`,text:{field:`instructions`,arguments:{}}}}},handler:async({arguments:e})=>{let n=jL.safeParse(e);if(!n.success)throw Error(`Use /compact, or /compact <what to focus on>.`);let r=n.data;if(r.length>AL)throw Error(`Compaction instructions are at most ${String(AL)} characters.`);return await t.command(r.length===0?{type:`compact`,requestId:yn()}:{type:`compact`,requestId:yn(),instructions:r}),`Compaction queued; it runs after any current work.`}},{id:`name`,title:`Name conversation`,category:`Conversation`,description:`Set the conversation title; no text restores it`,projections:{help:{order:9},palette:{order:9},slash:{aliases:[`name`],order:9,arguments:{hint:`[title]`,text:{field:`title`,arguments:{}}}}},handler:async({arguments:e})=>{let r=kL.safeParse(e);if(!r.success)throw Error(`Use /name <title>, or /name to clear it.`);let i=r.data;if(Array.from(i).length>OL)throw Error(`A conversation title is at most ${String(OL)} characters.`);let a=i.length===0?null:i;return await t.command({type:`title`,title:a}),await n.onTitled?.(a),a===null?`Conversation title cleared; it follows the first prompt again.`:`Conversation named "${a}".`}}]};return e.contribute(i)}var PL=new Set([`Esc`,`Ctrl+C`]);function FL(e){let{completion:t}=e;if(t.kind===`commands`&&t.items.length>0)return[{keys:`↑↓`,label:`choose`,priority:1},{keys:`Tab`,label:`complete`,priority:0},{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}];if(t.kind===`arguments`)return t.items.length>0?[{keys:`↑↓`,label:`choose`,priority:1},{keys:`Tab`,label:`complete`,priority:0},{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}]:[{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}];let n=[{keys:`Enter`,label:`send`,priority:0}];e.busy&&e.keys.queue!==void 0&&n.push({keys:e.keys.queue,label:`queue`,priority:0}),e.keys.newline!==void 0&&n.push({keys:e.keys.newline,label:`newline`,priority:1}),e.keys.scroll!==void 0&&n.push({keys:e.keys.scroll,label:`scroll`,priority:2});for(let t of e.bindings){let r=t.keys.split(`, `).some(e=>PL.has(e));r&&!e.busy||n.push({keys:t.keys,label:t.title.toLocaleLowerCase(),priority:r?0:3})}return n.push({keys:`/`,label:`commands`,priority:4}),n}var IL=` · `;function LL(e){return e.map(e=>`${e.keys} ${e.label}`).join(IL)}function RL(e,t,n){t!==void 0&&setTimeout(()=>{e.execute(t,{origin:n})},0)}function zL(e,t){return[{id:`help`,title:`Show commands`,category:`Advanced`,projections:{help:{order:-3},slash:{aliases:[`help`],order:-3}},handler:async n=>{if(t.showCommands!==void 0){await t.showCommands();return}let r=eF(e.snapshot()).filter(e=>e.alias!==`help`);if(n.interaction===void 0)return r.map(e=>`/${e.alias}`);let i=await n.interaction.prompt({type:`choice`,message:`Commands`,options:r.map(e=>({value:e.commandId,label:`/${e.alias}`,description:e.keys.length===0?e.title:`${e.title} · ${e.keys.join(`, `)}`}))});RL(e,r.find(e=>e.commandId===i)?.command,n.origin)}},{id:`keys`,title:`Show key bindings`,category:`Advanced`,projections:{help:{order:-2},slash:{aliases:[`keys`],order:-2,consumesDraft:!0}},handler:async t=>{let n=tF(e.snapshot());if(t.interaction===void 0)return n.map(e=>`${e.keys} ${e.title}`);if(n.length===0){t.interaction.notify({type:`info`,message:`No key bindings are active.`});return}let r=await t.interaction.prompt({type:`choice`,message:`Key bindings`,options:n.map(e=>({value:e.commandId,label:e.title,description:e.keys}))});RL(e,n.find(e=>e.commandId===r)?.command,t.origin)}},{id:`clear`,title:`Clear the composer`,category:`Advanced`,projections:{help:{order:-1},slash:{aliases:[`clear`],order:-1}},handler:()=>{t.clear()}}]}var BL=_t(H({cancelled:U(!0)})),VL=_t(tn(Zt(W,xt)));function HL(e,t,n,r){let i=new Map,a=(e,t)=>n().find(t=>t.entryId===e)?.value.panel.flatMap(e=>e.actions??[]).filter(e=>e.id===t)??[],o=e=>JSON.stringify([e.id,e.input??{}]),s=new Set,c=()=>{for(let e of s){let t=new Set(a(e.entryId,e.commandId).map(o));i.has(e.entryId)&&e.intents.every(e=>t.has(e))||(e.execution.withdrawn=!0,e.controller.abort())}},l=e=>{i.get(e)?.lease.dispose(),i.delete(e)};return{update:n=>{let u=[];for(let e of i.keys()){let t=Object.hasOwn(n,e)?n[e]:void 0;(t?.status!==`running`||t.catalog===void 0)&&l(e)}for(let[d,f]of Object.entries(n)){if(f.status!==`running`||f.catalog===void 0)continue;let n=JSON.stringify(f.catalog);if(i.get(d)?.catalog!==n){l(d);try{let l=t.extension(d),u=QA(f.catalog),p=rj(u,(e,t)=>l.call(e,t));i.set(d,{catalog:n,lease:e.contribute({sourceId:`extension:${d}`,namespace:d,commands:p.map(e=>({...e,handler:async t=>{let f=a(d,e.id),p={intents:f.map(o),withdrawn:!1},m=rj(u,async(e,t)=>{let n=await l.call(e,t),r=ej(n);if(r.type===`prompt`){let e=f.filter(e=>Object.entries(e.input??{}).every(([e,n])=>JSON.stringify(Object.hasOwn(r.next.arguments,e)?r.next.arguments[e]:t[e])===JSON.stringify(n)));p.intents=(e.length>0?e:f).map(o)}return n}).find(t=>t.id===e.id);if(m===void 0)throw Error(`The advertised command is unavailable`);let h=t,g=t.interaction;if(g!==void 0){let t={...g,prompt:(t,n)=>{let r={entryId:d,commandId:e.id,intents:p.intents,execution:p,controller:new AbortController};return s.add(r),c(),g.prompt(t,{signal:n?.signal===void 0?r.controller.signal:AbortSignal.any([n.signal,r.controller.signal])}).finally(()=>s.delete(r))}};h={...h,interaction:t}}let _;try{_=await m.handler(h)}catch(e){if(p.withdrawn)return{cancelled:!0};throw e}finally{for(let e of s)e.execution===p&&s.delete(e)}return t.origin!==`agent`&&VL(t.arguments)&&!BL(_)&&!t.signal?.aborted&&i.get(d)?.catalog===n&&r?.(d,e.id),_}}))})})}catch(e){u.push({extensionId:d,message:e instanceof Error?e.message:`The advertised catalog is invalid`})}}}return c(),u},dispose:()=>{for(let e of i.keys())l(e);c()}}}function UL(e,t){let n=e.map((e,t)=>({item:e,index:t})).sort((e,t)=>e.item.arrivedAt-t.item.arrivedAt||e.index-t.index).map(({item:e})=>e),r=n.find(e=>!t.has(e.key));return{items:n,current:r,position:r===void 0?0:n.indexOf(r)+1,total:n.length}}function WL(e,t){return t===``||e.forced?e.current:void 0}function GL(){return{highlight:0,toggled:new Set,other:``,phase:`choose`,details:!1}}var KL=e=>({state:e});function qL(e,t,n){return{...e,highlight:n,phase:n===t.options.length?`other`:`choose`,refusal:void 0}}function JL(e,t,n){let r=n.options.length,i=n.other,a=r+(i===void 0?0:1);if(t.type===`refused`)return{state:{...e,phase:`refused`,refusal:t.message}};if(e.phase===`sending`||e.details&&t.type!==`details`&&t.type!==`escape`)return KL(e);switch(t.type){case`move`:return{state:qL(e,n,(e.highlight+t.delta+a)%a)};case`pick`:return t.number>=1&&t.number<=a?{state:qL(e,n,t.number-1)}:KL(e);case`toggle`:{let t=n.options[e.highlight];if(n.multiple!==!0||t===void 0)return KL(e);let r=new Set(e.toggled);return r.delete(t.value)||r.add(t.value),{state:{...e,toggled:r,phase:`choose`,refusal:void 0}}}case`type`:case`append`:return i===void 0?KL(e):{state:{...e,other:(t.type===`append`?`${e.other}${t.text}`:t.text).slice(0,i.maxLength),highlight:r,phase:`other`,refusal:void 0}};case`details`:return{state:{...e,details:!e.details}};case`enter`:{let t=e.other.trim(),a=t===``?{}:{text:t};if(n.multiple===!0){let r=n.options.map(e=>e.value).filter(t=>e.toggled.has(t));return r.length===0&&t===``?{state:qL(e,n,e.highlight)}:{state:{...e,phase:`sending`,refusal:void 0},effect:{type:`answer`,selected:r,...a}}}let o=n.options[e.highlight];return o===void 0?t===``?i?.blank===void 0?{state:qL(e,n,r)}:{state:{...e,phase:`sending`,refusal:void 0},effect:{type:`answer`,selected:[i.blank]}}:{state:{...e,phase:`sending`,refusal:void 0},effect:{type:`answer`,selected:[],text:t}}:{state:{...e,phase:`sending`,refusal:void 0},effect:{type:`answer`,selected:[o.value]}}}case`escape`:return e.details?{state:{...e,details:!1}}:e.phase===`other`||e.phase===`confirm`?{state:{...e,highlight:0,phase:`choose`},effect:{type:`back`}}:n.escape===void 0?{state:e,effect:{type:`later`}}:{state:{...e,phase:`sending`,refusal:void 0},effect:{type:`answer`,selected:[n.escape]}}}}var YL={question:`question`,approval:`approval`};function XL(e,t,n){let r=t.multiple===!0,i=t.options.length,a=e.other.trim(),o=[...t.options.map((t,n)=>{let i=e.toggled.has(t.value),a=r?i?`[x]`:`[ ]`:`${String(n+1)}.`,o=`${t.label}${n===0?` (recommended)`:``}`;return{index:n,kind:`option`,marker:a,label:t.label,description:t.description,recommended:n===0,highlighted:e.highlight===n,toggled:i,destructive:t.destructive===!0,caption:o,text:`${a} ${o}`}}),...t.other===void 0?[]:[(t=>{let n=r&&a!==``,o=r?n?`[x]`:`[ ]`:`${String(i+1)}.`;return{index:i,kind:`other`,marker:o,label:t.label,description:void 0,recommended:!1,highlighted:e.highlight===i,toggled:n,destructive:!1,caption:t.label,text:`${o} ${t.label}`}})(t.other)]],s=e.phase===`other`,c=t.options.find(e=>e.value===t.other?.blank)?.label.toLowerCase(),l=t.options.find(e=>e.value===t.escape)?.label.toLowerCase(),u=e.phase===`sending`,d=(t.details?.length??0)>0||t.body!==void 0,f=u?[]:e.details?[{keys:`d`,label:`back`,priority:0},{keys:`Esc`,label:`back`,priority:1}]:[{keys:`↑↓`,label:`move`,priority:1},...r&&!s?[{keys:`Space`,label:`toggle`,priority:1}]:[],{keys:`Enter`,label:s&&a===``&&c!==void 0?c:r||s?`send`:e.highlight===i?`write`:`choose`,priority:0},...d?[{keys:s?`Alt+D`:`d`,label:`details`,priority:2}]:[],{keys:`Esc`,label:s?`back`:l??`later`,priority:2}];return{kind:n.kind,label:`Agent ${YL[n.kind]} ${String(n.position)} of ${String(n.total)}`,title:t.message,counter:n.total>1?`${String(n.position)} of ${String(n.total)}`:void 0,summary:t.summary,facts:t.facts??[],body:t.body,bodyLabel:t.bodyLabel,details:t.details??[],detailsOpen:e.details,rows:o,other:t.other===void 0?void 0:{label:t.other.label,placeholder:t.other.placeholder,text:e.other,focused:s,maxLength:t.other.maxLength},multiple:r,phase:e.phase,canSend:!u&&!e.details&&(r?e.toggled.size>0||a!==``:e.highlight<i||a!==``||t.other?.blank!==void 0),status:u?{tone:`info`,text:`Sending…`}:e.phase===`refused`?{tone:`error`,text:e.refusal??`That answer was refused.`}:void 0,hints:f}}function ZL(e){return e.flatMap(({entryId:e,value:t})=>t.panel.flatMap(t=>(t.actions??[]).filter(e=>e.awaiting!==void 0).map(n=>({key:JSON.stringify([e,t.id]),command:{namespace:e,id:n.id},title:t.title,action:n}))))}function QL(e){if(e.status!==`handled`)return e.status===`failed`?e.error.message:e.status===`unavailable`?e.reason:`The question could not be opened (${e.status}).`}function $L(e){let{enabled:t,commands:n,store:r,contributions:i,online:a,requests:o,commandsVersion:s}=e,c=(0,J.useRef)(new Map),l=(0,J.useRef)(o);(0,J.useEffect)(()=>{let e=new Map((t&&a?ZL(i):[]).map(e=>[e.key,e])),s=l.current!==o;l.current=o;for(let[t,n]of c.current)(!e.has(t)||s&&n.failed())&&(n.stop(),c.current.delete(t));for(let t of e.values()){if(c.current.has(t.key))continue;let e=lj({title:t.title}),i=e.begin(),a=new AbortController,o,s=!1,l=e.subscribe(()=>{o===void 0&&e.snapshot().prompt!==void 0&&(o=r.awaiting.add({key:t.key,kind:`question`,arrivedAt:Date.now(),host:e}))}),u={origin:`menu`,signal:a.signal,interaction:i.interaction};n.execute(t.command,t.action.input===void 0?u:{...u,arguments:t.action.input}).then(n=>{if(l(),o?.(),n.status===`missing`||n.status===`unavailable`){i.settle({status:`cancelled`}),c.current.get(t.key)?.failed()===!1&&c.current.delete(t.key);return}let u=QL(n);if(u===void 0){i.settle({status:`handled`});let t=e.snapshot().message;t?.type===`info`&&r.toast({variant:`info`,message:t.message});return}if(a.signal.aborted){i.settle({status:`cancelled`});return}s=!0,i.settle({status:`failed`,message:u}),r.report({tone:`error`,message:u})}),c.current.set(t.key,{failed:()=>s,stop:()=>{l(),o?.(),a.abort(),e.cancel()}})}},[t,a,i,n,r,o,s]),(0,J.useEffect)(()=>()=>{for(let e of c.current.values())e.stop();c.current.clear()},[n,r,t])}function eR(e){if(e!==void 0&&e.status!==`handled`)return e.status===`failed`?e.error.message:e.status===`unavailable`?e.reason:`Command ${e.status}`}function tR(e){let{commands:t,origin:n}=e,r=e.enabled??!0,i=qF(),a=GF(),o=JF(),s=XF(),c=(0,J.useRef)(s);c.current=s;let l=ZF(),u=(0,J.useMemo)(()=>e.interactionStore??l,[e.interactionStore,l]),d=(0,J.useSyncExternalStore)(u.subscribe,u.snapshot,u.snapshot);(0,J.useEffect)(()=>{let e=d.inspection;e!==void 0&&!s.some(t=>t.entryId===e.entryId&&t.value.panel.some(t=>t.id===e.rowId&&t.inspection!==void 0))&&u.inspect(void 0)},[s,d.inspection,u]);let f={...UL(d.awaiting.items,d.awaiting.later),forced:d.awaiting.forced},p=(0,J.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),m=(0,J.useRef)(a);m.current=a;let h=(0,J.useRef)(e.showCommands);h.current=e.showCommands;let g=e.showCommands!==void 0;(0,J.useEffect)(()=>{if(r)return u.attach(t.present)},[t,r,u]),(0,J.useEffect)(()=>{if(!r)return;let e=t.contribute({sourceId:`parakeet`,namespace:`parakeet`,commands:zL(t,{showCommands:g?()=>h.current?.():void 0,clear:()=>{m.current.setDraft(``),u.report(void 0)}})});return()=>{e.dispose()}},[t,r,u,g]);let _=(0,J.useMemo)(()=>HL(t,i,()=>c.current,(e,t)=>{let n=c.current.find(t=>t.entryId===e)?.value.panel.find(e=>e.inspection?.commandId===t);n!==void 0&&u.inspect({entryId:e,rowId:n.id})}),[t,i,u]);(0,J.useEffect)(()=>()=>{_.dispose()},[_]),(0,J.useEffect)(()=>{if(!r){_.dispose();return}let[e]=_.update(o);e!==void 0&&u.report({tone:`error`,message:`${e.extensionId} commands are unavailable: ${e.message}`})},[_,r,o,s,u]);let{observation:v}=YF();$L({enabled:r,commands:t,store:u,contributions:s,online:v.status===`live`,requests:d.awaiting.requests,commandsVersion:p});let y=d.awaiting.items.length>0;(0,J.useEffect)(()=>{if(!r||!y)return;let e=t.contribute({sourceId:`parakeet-awaiting`,namespace:`parakeet-awaiting`,commands:[{id:`answer`,title:`Answer a question`,category:`Conversation`,description:`Answer what the Agent is waiting on`,projections:{help:{order:5},palette:{order:5},slash:{aliases:[`answer`],order:5,consumesDraft:!0}},handler:()=>{u.awaiting.focus()}}]});return()=>{e.dispose()}},[t,r,u,y]);let b=(0,J.useMemo)(()=>eF(p),[p]),[x,S]=(0,J.useState)(),[C,w]=(0,J.useState)({draft:``,index:0}),T=a.draft,E=!r||x===T||d.open!==void 0?{kind:`none`}:sF(b,T),D=E.kind===`none`?0:E.items.length,O=E.kind===`arguments`||E.kind===`commands`&&D>0,k=C.draft===T?Math.min(C.index,Math.max(0,D-1)):0,A=FL({completion:E,busy:e.busy,bindings:tF(p),keys:e.keys}),j=(0,J.useCallback)((e,i)=>{let a=m.current;if(!r){a.send(e);return}i!==void 0&&a.setDraft(i);let o=i??a.draft;u.report(void 0),S(o),a.submitCommand((r,i)=>uF(r,t,()=>{a.send(e)},n,i)).then(e=>{let t=eR(e);t!==void 0&&u.snapshot().open===void 0&&u.lastEnd()!==`cancelled`&&u.report({tone:`error`,message:`${o}: ${t}`})})},[t,r,n,u]),M=e=>{if(E.kind===`commands`||E.kind===`arguments`)return E.items[e]?.insert};return{completion:E,open:O,selected:k,hints:A,interactions:d,store:u,awaiting:f,move:e=>D!==0&&(w({draft:T,index:(k+e+D)%D}),!0),highlight:e=>{w({draft:T,index:e})},complete:()=>{let e=M(k);return e!==void 0&&(a.setDraft(e),!0)},dismiss:()=>d.open===void 0?d.inspection===void 0?O?(S(T),!0):d.notice!==void 0&&(u.report(void 0),!0):(u.inspect(void 0),!0):(u.close(),!0),submit:(t=e.busy?`followUp`:`steer`)=>{let n=(E.kind===`commands`||E.kind===`arguments`&&E.query.length>0)&&D>0?M(k):void 0;j(t,n?.trimEnd())},choose:t=>{let n=M(t);n!==void 0&&j(e.busy?`followUp`:`steer`,n.trimEnd())},available:e=>b.some(t=>t.alias===e&&t.availability.status===`available`),runCommand:e=>{u.report(void 0),uF(`/${e}`,t,()=>void 0,n).then(t=>{let n=eR(t);n!==void 0&&u.snapshot().open===void 0&&u.lastEnd()!==`cancelled`&&u.report({tone:`error`,message:`/${e}: ${n}`})})}}}function nR(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
141
141
  `)}function rR(e){return/^\s*$/.test(e)}function iR(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function aR(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=aR(n.children):n.type===`image`&&(t+=n.alt);return t}function oR(){let e=new Map;return t=>{let n=t.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`,r=e.get(n)??0;return e.set(n,r+1),r===0?n:`${n}-${r+1}`}}function sR(e){let t=e.trim().replace(/[\u0000-\u001F\u007F\s]+/g,``);return t?/^(#|\/|\.\/|\.\.\/)/.test(t)||/^(https?:|mailto:|tel:)/i.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?``:t:``}function cR(e){return e.trim().toLowerCase()}function lR(e){return cR(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function uR(e,t={}){let n=AR(pR(e,t));for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var dR=32,fR=16;function pR(e,t,n={scans:Math.max(e.length*fR,1024),depth:0}){if(n.depth>=dR)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
142
142
  `){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[\\`*_[\]{}()#+\-.!|~<>]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=yR(e,i,"`"),s=bR(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\s+/g,` `).trim()}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`!`&&c===`[`){let a=hR(e,i+1,t,n);if(a){o(),r.push({type:`image`,src:sR(a.href),alt:kR(a.label,n),...a.title?{title:a.title}:{}}),i=a.end;continue}}if(s===`[`){let a=mR(e,i,t,n);if(a){o(),r.push(a.node),i=a.end;continue}let s=hR(e,i,t,n);if(s){let e=sR(s.href);o(),e?r.push({type:`link`,href:e,...s.title?{title:s.title}:{},children:pR(s.label,t,n)}):r.push(...pR(s.label,t,n)),i=s.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=xR(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:pR(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`*`&&c===`*`||s===`_`&&c===`_`){let l=s===`_`&&!TR(e,i,2,!0)?-1:xR(e,i+2,s+s,n);if(l!==-1){o(),r.push({type:`strong`,children:pR(e.slice(i+2,l),t,n)}),i=l+2;continue}a+=s+c,i+=2;continue}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=yR(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`~`&&c===`~`){let s=xR(e,i+2,`~~`,n);if(s!==-1){o(),r.push({type:`strike`,children:pR(e.slice(i+2,s),t,n)}),i=s+2;continue}a+=`~~`,i+=2;continue}if(s===`~`){let a=SR(e,i+1,n);if(a!==-1){o(),r.push({type:`strike`,children:pR(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`*`||s===`_`){let a=s===`_`&&!TR(e,i,1,!0)?-1:xR(e,i+1,s,n);if(a!==-1){o(),r.push({type:`emphasis`,children:pR(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`<`&&t.allowHtml){let t=CR(e,i+1,`>`,n);if(t!==-1&&gR(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}a+=s,i++}return o(),n.depth--,r}function mR(e,t,n,r){if(e[t+1]!==`^`)return;let i=CR(e,t+2,`]`,r);if(i===-1)return;let a=cR(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a);s===-1&&(n.footnoteOrder.push(a),s=n.footnoteOrder.length-1);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??(lR(o.label)||`footnote`),number:s+1,...c>1?{referenceIndex:c}:{}},end:i+1}}function hR(e,t,n,r){let i=vR(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i);if(e[i+1]===`(`){let t=vR(e,i+1,`(`,`)`,r);if(t===-1)return;let n=_R(e.slice(i+2,t).trim());return n?{label:a,href:n.href,...n.title?{title:n.title}:{},end:t+1}:void 0}if(e[i+1]===`[`){let t=vR(e,i+1,`[`,`]`,r);if(t===-1)return;let o=e.slice(i+2,t),s=n.references?.[cR(o||a)];return s?{label:a,href:s.href,...s.title?{title:s.title}:{},end:t+1}:void 0}let o=n.references?.[cR(a)];if(o)return{label:a,href:o.href,...o.title?{title:o.title}:{},end:i+1}}function gR(e){return/^<!--(?:[\s\S]*--|-?)>$/.test(e)||/^<\?[\s\S]*\?>$/.test(e)||/^<![A-Z][\s\S]*>$/.test(e)||/^<!\[CDATA\[[\s\S]*\]\]>$/.test(e)||/^<\/[A-Za-z][\w:-]*\s*>$/.test(e)?!0:/^<[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>$/.test(e)}function _R(e){let t=e.match(/^(\S+)(?:\s+["']([^"']*)["'])?$/);return t?{href:t[1].replace(/^<|>$/g,``),...t[2]?{title:t[2]}:{}}:{href:e}}function vR(e,t,n,r,i){let a=0;for(let o=t;o<e.length;o++){if(!wR(i))return-1;if(e[o-1]!==`\\`&&(e[o]===n&&a++,e[o]===r&&(a--,a===0)))return o}return-1}function yR(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&!wR(r));)i++;return i}function bR(e,t,n,r,i){for(let a=t;a<e.length;a++){if(!wR(i))return-1;if(e[a]===n&&yR(e,a,n,i)>=r)return a}return-1}function xR(e,t,n,r){for(let i=t;i<e.length;i++){if(!wR(r))return-1;if(e[i-1]!==`\\`&&(n!==`~~`||e[i-1]!==`~`&&e[i+2]!==`~`)&&!(n[0]===`_`&&!TR(e,i,n.length,!1))&&e.startsWith(n,i))return i}return-1}function SR(e,t,n){if(OR(e[t]??``)||/\d/.test(e[t]??``))return-1;for(let r=t;r<e.length;r++){if(!wR(n))return-1;if(e[r-1]!==`\\`&&e[r]===`~`&&e[r-1]!==`~`&&e[r+1]!==`~`)return OR(e[r-1]??``)?-1:r}return-1}function CR(e,t,n,r){for(let i=t;i<e.length;i++){if(!wR(r))return-1;if(e[i]===n)return i}return-1}function wR(e){return e.scans<=0?!1:(e.scans--,!0)}function TR(e,t,n,r){let i=e[t-1],a=e[t+n],o=!ER(a)&&(!DR(a)||ER(i)||DR(i)),s=!ER(i)&&(!DR(i)||ER(a)||DR(a));return r?o&&(!s||DR(i)):s&&(!o||DR(a))}function ER(e){return e===void 0||/\s/.test(e)}function DR(e){return e!==void 0&&/[^\p{L}\p{N}\s]/u.test(e)}function OR(e){return/\s/.test(e)}function kR(e,t){return pR(e,{},t).map(e=>e.type===`text`||e.type===`inlineCode`?e.value:``).join(``)}function AR(e){let t=[];for(let n of e){let e=t.at(-1);e?.type===`text`&&n.type===`text`?e.value+=n.value:t.push(n)}return t}var jR=64;function MR(e,t={}){let n=nR(e),r=t.frontmatter!==!1,i=n.split(`
@@ -149,7 +149,7 @@ Error generating stack: `+e.message+`
149
149
  `)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(rR(t)||e.length>0&&VR(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:uR(e.join(`
150
150
  `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=aR(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function PR(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=LR(a?.[1]??a?.[2]??``),s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function FR(e){let t=Object.create(null),n=Object.create(null),r=new Map,i=[],a,o=0,s=0;for(;s<e.length;){let c=e[s],l=c.match(/^ {0,3}(`{3,}|~{3,})/);if(l){let e=l[1][0];a?e===a&&l[1].length>=o&&(a=void 0,o=0):(a=e,o=l[1].length),i.push(c),s++;continue}if(!a){let i=c.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(s++;s<e.length;){let t=e[s];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),s++}let o=cR(t);if(!n[o]){let e=lR(t)||`footnote`,i=(r.get(e)??0)+1;r.set(e,i),n[o]={label:t,content:a.join(`
151
151
  `),id:i===1?e:`${e}-${i}`}}continue}let a=c.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S+)(?:[ \t]+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?[ \t]*$/);if(a){let e=a[3]??a[4]??a[5];t[cR(a[1])]={href:a[2].replace(/^<|>$/g,``),...e===void 0?{}:{title:e}},s++;continue}}i.push(c),s++}return{lines:i,references:t,footnotes:n}}function IR(e,t,n){let r=[];for(let i=0;i<t.length;i++){let a=e[t[i]];a&&r.push({id:a.id??(lR(a.label)||`footnote`),number:i+1,children:new NR(nR(a.content).split(`
152
- `),n,oR()).parse()})}for(let e of r){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:r}}function LR(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function RR(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function zR(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function BR(e){return e.match(/^ */)?.[0].length??0}function VR(e,t){let n=RR(e);return/^ {0,3}(`{3,}|~{3,})/.test(e)||/^ {0,3}#{1,6}(?:\s+|$)/.test(e)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)||/^ {0,3}>\s?/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&HR(e,t)}function HR(e,t){if(!e.includes(`|`))return!1;let n=UR(t);return n.length===UR(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function UR(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return n.push(r.trim()),n}function WR(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function GR(e,t){return{type:`tableCell`,children:uR(e,t)}}function KR(e){return[...e.value.panel.flatMap(e=>e.actions??[]),...e.value.timeline.cells.flatMap(e=>e.rows.flatMap(e=>e.actions??[])),...e.value.waiting===null?[]:[e.value.waiting.cancel]]}function qR(e){let t=new AbortController,n=()=>t.signal.aborted,r=new Set,i=new Map,a=new Map,o=(e,t)=>JSON.stringify([e,t.id,t.input??{}]),s=()=>{if(n())return;let t=new Map,s=new Set;for(let n of e.contributions())for(let e of KR(n)){let r=o(n.entryId,e);s.add(r);let i=a.get(r);i!==void 0&&t.set(e,i)}for(let[e,t]of a)!s.has(e)&&!t.pending&&a.delete(e);i=t;for(let e of r)e()},c=(e,t)=>{n()||(a.set(e,t),s())};return{snapshot:()=>i,refresh:s,subscribe:e=>(r.add(e),()=>{r.delete(e)}),execute:async(r,i,s=!1)=>{let l=e.contributions().find(e=>e.entryId===r);if(n()||!e.online()||l===void 0||!KR(l).includes(i)||s&&l.value.waiting?.cancel!==i)return;if(i.awaiting!==void 0){e.interactions.awaiting.focus();return}let u=o(r,i);if(a.get(u)?.pending)return;c(u,{pending:!0});let d;try{let n={origin:`menu`,signal:t.signal};i.input!==void 0&&(n={...n,arguments:i.input}),d=await e.commands.execute({namespace:r,id:i.id},n)}catch(t){if(SN(`client row command`,t),n())return;let r=t instanceof Error?t:Error(`Client row command failed`,{cause:t});c(u,{pending:!1,error:r.message}),e.interactions.report({tone:`error`,message:r.message});return}if(n())return;let f=d.status===`handled`?void 0:d.status===`failed`?d.error.message:d.status===`unavailable`?d.reason:`Client row command ${d.status}`;c(u,f===void 0?{pending:!1}:{pending:!1,error:f}),f!==void 0&&e.interactions.report({tone:`error`,message:f})},dispose:()=>{t.abort(),i=new Map,a.clear(),r.clear()}}}var JR=new Map,YR=()=>JR,XR=()=>()=>void 0;function ZR(e){let t=XF(),{observation:n}=YF(),r=ZF(),i=qF(),[a,o]=(0,J.useState)(),s=(0,J.useRef)({contributions:t,observation:n});return s.current={contributions:t,observation:n},(0,J.useEffect)(()=>{let t=qR({commands:e,contributions:()=>s.current.contributions,online:()=>s.current.observation.status===`live`,interactions:r});return o(t),()=>{t.dispose()}},[e,r,i]),(0,J.useEffect)(()=>{a?.refresh()},[a,t]),{state:(0,J.useSyncExternalStore)(a?.subscribe??XR,a?.snapshot??YR,a?.snapshot??YR),enabled:a!==void 0&&n.status===`live`,execute:(e,t,n=!1)=>a?.execute(e,t,n)??Promise.resolve()}}function QR(e,t){return t.prompt===void 0?t.status===`failed`?{...e,phase:`refused`,refusal:t.failure??`Something went wrong.`}:{...e,phase:`sending`}:e}function $R(e,t){let{host:n}=e,r=(0,J.useSyncExternalStore)(n.subscribe,n.snapshot),i=(0,J.useRef)(),a=r.prompt;a?.request.type===`decision`&&(i.current={sequence:a.sequence,prompt:a.request});let[,o]=(0,J.useState)(),s=(0,J.useRef)(),c=i.current,l=()=>c!==void 0&&s.current?.sequence===c.sequence?s.current.state:GL(),u=e=>{c!==void 0&&(s.current={sequence:c.sequence,state:e},o(s.current))};return{view:c===void 0?void 0:XL(QR(l(),r),c.prompt,{kind:e.kind,position:t.position,total:t.total}),later:t.later,dispatch:e=>{if(c===void 0)return;let r=n.snapshot();if(r.prompt===void 0&&r.status===`failed`){e.type===`enter`?n.retry():e.type===`escape`&&t.later();return}let i=JL(QR(l(),r),e,c.prompt);u(i.state);let a=i.effect;if(a?.type===`later`)t.later();else if(a?.type===`answer`){let e={selected:a.selected};a.text!==void 0&&(e.text=a.text),n.answer(c.sequence,e)||u(JL(i.state,{type:`refused`,message:`That answer was not accepted. Choose again.`},c.prompt).state)}}}}function ez(e){let t=new Map;for(let n of e){let e=t.get(n.entryId);e===void 0?t.set(n.entryId,[n]):e.push(n)}for(let e of t.values())e.sort((e,t)=>e.cell.sequence-t.cell.sequence);let n=[];for(;t.size>0;){let e=[...t.values()].flatMap(e=>e[0]===void 0?[]:[e[0]]);e.sort((e,t)=>e.cell.at-t.cell.at||(e.entryId<t.entryId?-1:+(e.entryId>t.entryId))||e.cell.sequence-t.cell.sequence);let r=e[0];if(r===void 0)break;n.push(r);let i=t.get(r.entryId);i?.shift(),i?.length===0&&t.delete(r.entryId)}return n}function tz(e,t,n=new Map){let r=new Map,i=[],a=[];for(let{entryId:o,value:s}of e)for(let e of s.timeline.cells){let s={entryId:o,cell:e};if(e.afterSequence===void 0&&e.commandId===null){a.push(s);continue}let c=e.afterSequence===void 0?e.commandId===null?void 0:t.get(e.commandId):n.get(e.afterSequence);if(c===void 0)continue;if(c===null){i.push(s);continue}let l=r.get(c);l===void 0?r.set(c,[s]):l.push(s)}return{before:ez(i),after:new Map([...r].map(([e,t])=>[e,ez(t)])),unanchored:ez(a),omitted:e.flatMap(({entryId:e,value:t})=>t.timeline.omitted===0?[]:[{entryId:e,count:t.timeline.omitted}])}}var nz=J.createContext(void 0);function rz(e){let t=J.useContext(nz);if(!e&&t===void 0)throw Error(nE(27));return t}var iz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=rz(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ME(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:dO,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),az=J.createContext(void 0);function oz(e=!1){let t=J.useContext(az);if(t===void 0&&!e)throw Error(nE(16));return t}function sz(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:J.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function cz(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(iD(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function lz(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=oz(!0),c=a??s!==void 0,{props:l}=sz({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;uz(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return zk(u,[u]),{getButtonProps:J.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return yE({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kE(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=uz(r),s=!i&&dz(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),cz(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),cz(r,e)))},onKeyUp(e){if(!t){if(kE(e),a?.(e),e.target===e.currentTarget&&i&&c&&uz(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),cz(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:GT(e=>{o.current=e,u()})}}function uz(e){return cD(e)&&e.tagName===`BUTTON`}function dz(e){return cD(e)&&e.tagName===`A`&&!!e.href}function fz(e,t,n,r){let i=!1,a=!1,o=r??XT;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var pz=`none`,mz=`trigger-press`,hz=`trigger-hover`,gz=`outside-press`,_z=`close-press`,vz=`focus-out`,yz=`escape-key`,bz=`imperative-action`,xz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=rz(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=lz({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,fz(_z,e.nativeEvent))}return ME(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Sz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=rz(),c=qE(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),ME(`p`,e,{ref:t,props:[{id:c},o]})});function Cz(e,t){return t!=null&&!EO(t)?0:typeof e==`function`?e():e}function wz(e,t,n){let r=Cz(e,n);return typeof r==`number`?r:r?.[t]}function Tz(e){return typeof e==`function`?e():e}function Ez(e,t){return t||e===`click`||e===`mousedown`}function Dz(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Oz(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function kz(e){let t=HT(Az,e).current;return t.next=e,zk(t.effect),t}function Az(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var jz=null;globalThis.requestAnimationFrame;var Mz=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Nz=class e{static create(){return new e}static request(e){return Mz.request(e)}static cancel(e){return Mz.cancel(e)}currentId=jz;request(e){this.cancel(),this.currentId=Mz.request(()=>{this.currentId=jz,e()})}cancel=()=>{this.currentId!==jz&&(Mz.cancel(this.currentId),this.currentId=jz)};disposeEffect=()=>this.cancel};function Pz(){let e=HT(Nz.create).current;return ZT(e.disposeEffect),e}var Fz={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Iz={...Fz,position:`fixed`,margin:0,top:0,left:0};({...Fz});var Lz=J.forwardRef(function(e,t){let[n,r]=J.useState();zk(()=>{zD&&RD&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:Iz,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function Rz(e){return`data-base-ui-${e}`}var zz=0;function Bz(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(zz);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),JT;let o=requestAnimationFrame(a);return zz=o,()=>{zz===o&&(cancelAnimationFrame(o),zz=0)}}var Vz=`data-base-ui-inert`,Hz=new WeakMap,Uz=new WeakSet,Wz=new WeakMap,Gz=0;function Kz(e){return e?lD(e)?e.host:Kz(e.parentNode):null}var qz=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Kz(t);return e.contains(n)?n:null}).filter(e=>e!=null),Jz=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Yz=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{rD(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Xz(e,t,n,{mark:r=!0}){let i=qz(t,e),a=r?Yz(t,Jz(i),new Set(i)):[],o=[],s=[];if(n){let e=qz(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);Yz(t,Jz(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(Hz.get(e)||0)+1;Hz.set(e,r),o.push(e),r===1&&n&&Uz.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(Wz.get(e)||0)+1;Wz.set(e,t),s.push(e),t===1&&e.setAttribute(Vz,``)}),Gz+=1,()=>{o.forEach(e=>{let t=(Hz.get(e)||0)-1;Hz.set(e,t),t||(Uz.has(e)||e.removeAttribute(`aria-hidden`),Uz.delete(e))}),r&&s.forEach(e=>{let t=(Wz.get(e)||0)-1;Wz.set(e,t),t||e.removeAttribute(Vz)}),--Gz,Gz||(Hz=new WeakMap,Uz=new WeakSet,Wz=new WeakMap)}}function Zz(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=rk(e[0]).body;return Xz(e,i,n,{mark:r})}var Qz={style:{transition:`none`}},$z=`data-base-ui-click-trigger`,eB={fallbackAxisSide:`end`},tB={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},nB=J.createContext(null),rB=()=>J.useContext(nB),iB=Rz(`portal`);function aB(e={}){let{ref:t,container:n,componentProps:r=XT,elementProps:i}=e,a=KE(),o=rB()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=GT(e=>{e!==null&&u(e)}),f=J.useRef(null);zk(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(oD(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=ME(`div`,r,{ref:[t,d],props:[{id:a,[iB]:``},i]}),m=s&&p?QF.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var oB=J.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=aB({container:o,ref:t,componentProps:e,elementProps:c}),f=J.useRef(null),p=J.useRef(null),m=J.useRef(null),h=J.useRef(null),[g,_]=J.useState(null),v=J.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;J.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&wk(e)&&(e.type===`focusin`?v.current&&=(Ek(l),!1):(Tk(l),v.current=!0))}return Oz(oA(l,`focusin`,e,!0),oA(l,`focusout`,e,!0))},[l,y]),zk(()=>{!l||b!==!0||!v.current||(Ek(l),v.current=!1)},[b,l]);let S=J.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,X.jsxs)(J.Fragment,{children:[d,(0,X.jsxs)(nB.Provider,{value:S,children:[x&&l&&(0,X.jsx)(Lz,{"data-type":`outside`,ref:f,onFocus:e=>{wk(e,l)?m.current?.focus():Sk(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:tB}),l&&QF.createPortal(a,l),x&&l&&(0,X.jsx)(Lz,{"data-type":`outside`,ref:p,onFocus:e=>{wk(e,l)?h.current?.focus():(xk(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,fz(`focus-out`,e.nativeEvent)))}})]})]})});function sB(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var cB=class{nodesRef={current:[]};events=sB();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},lB=J.createContext(null),uB=J.createContext(null),dB=()=>J.useContext(lB)?.id||null,fB=e=>{let t=J.useContext(uB);return e??t};function pB(e){let t=KE(),n=fB(e),r=dB();return zk(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function mB(e){let{children:t,id:n}=e,r=dB();return(0,X.jsx)(lB.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function hB(e){let{children:t,externalTree:n}=e,r=HT(()=>n??new cB).current;return(0,X.jsx)(uB.Provider,{value:r,children:t})}function gB(e){return e==null?e:`current`in e?e.current:e}function _B(e,t){let n=iD(WD(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(wO(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var vB=20,yB=[];function bB(){yB=yB.filter(e=>e.deref()?.isConnected)}function xB(e){bB(),e&&rD(e)!==`body`&&(yB.push(new WeakRef(e)),yB.length>vB&&(yB=yB.slice(-20)))}function SB(){return bB(),yB[yB.length-1]?.deref()}function CB(e){return e?_k(e)?e:yk(e)[0]||e:null}function wB(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=vk(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return _k(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function TB(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=GT(()=>b.current.floatingContext?.nodeId),S=i===!1,C=vO(_)&&S,w=kz(i),T=kz(a),E=kz(o),D=kz(u),O=kz(g),k=fB(m),A=rB(),j=J.useRef(!1),M=J.useRef(!1),N=J.useRef(!1),P=J.useRef(null),F=J.useRef(``),ee=J.useRef(``),I=J.useRef(null),te=J.useRef(null),ne=aE(I,p,A?.beforeInsideRef),re=aE(te,A?.afterInsideRef),ie=eE(),L=eE(),ae=Pz(),oe=A!=null,R=yO(v),se=GT((e=R)=>e?yk(e):[]),ce=GT(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&HD(R,VD(rk(R)))&&se().length===0&&!C&&SO(e)}return oA(rk(R),`keydown`,e)},[r,R,c,C,se]),J.useEffect(()=>{if(r||!g)return;let e=rk(R);function t(){N.current=!1}function n(e){let t=WD(e),n=ce(),r=HD(v,t)||HD(_,t)||HD(A?.portalNode,t)||n.some(e=>e===t||HD(e,t));N.current=!r,ee.current=e.pointerType||`keyboard`,UD(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,L.start(0,()=>{M.current=!1}))}function i(){ee.current=`keyboard`}return Oz(oA(e,`pointerdown`,n,!0),oA(e,`pointerup`,t,!0),oA(e,`pointercancel`,t,!0),oA(e,`keydown`,i,!0),t)},[r,v,_,R,g,A,L,ce]),J.useEffect(()=>{if(r||!l)return;let e=rk(R);function n(){M.current=!0,L.start(0,()=>{M.current=!1})}function i(e){let t=WD(e);_k(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=WD(n);c&&r==null&&a!=null&&HD(v,a)&&xB(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ce(),p=r?.hasAttribute(Rz(`focus-guard`))&&[I.current,te.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,gB(f),gB(d)].includes(r),m=!(HD(_,r)||HD(v,r)||HD(r,v)||HD(A?.portalNode,r)||u.some(e=>e===r||HD(e,r))||l.hasMatchingElement(e=>HD(e,r))||p||k&&(bO(k.nodesRef.current,o).find(e=>HD(e.context?.elements.floating,r)||HD(e.context?.elements.domReference,r))||xO(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,yO(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&R&&wB(R),s&&i!==_&&!nk(a)&&VD(e)===e.body){if(cD(R)&&(R.focus(),s===`popup`)){ae.request(()=>{R.focus()});return}let e=se(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||R;cD(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==SB())&&(j.current=!0,t.setOpen(!1,fz(vz,n)))})}function o(){N.current||(b.current.insideReactTree=!0,ie.start(0,()=>{b.current.insideReactTree=!1}))}let u=cD(_)?_:null;if(!(!v&&!u))return Oz(u&&oA(u,`focusout`,a),u&&oA(u,`pointerdown`,n),v&&oA(v,`focusin`,i),v&&oA(v,`focusout`,a),v&&A&&oA(v,`focusout`,o,!0))},[r,_,v,R,c,k,A,t,l,s,se,C,x,b,ie,L,ae,d,f,ce]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${Rz(`portal`)}]`)||[]),t=(k?xO(k.nodesRef.current,x()):[]).find(e=>vO(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Zz([v,...e,I.current,te.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ce(),t,gB(f),gB(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=Zz([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ce]),zk(()=>{if(!g||r||!cD(R))return;F.current=``,ee.current=``;let e=rk(R),t=VD(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||HD(R,t))return;let i=null,a=()=>(i??=se(R),i[0]||R),o;o=r===!0||r===null?a():gB(r),o||=a();let s=HD(R,VD(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&wO(c);Bz(o,{sync:l,preventScroll:o===R,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=VD(e);return!(t!==o&&HD(R,t))}})})},[r,g,R,se,w,D,O,b]);let le=J.useRef(null);zk(()=>{if(r||!R){le.current=null;return}le.current&&=(le.current.cancelled=!0,null);let e=rk(R),t=VD(e),n=D.current==null;xB(t);function i(e){if(e.open||(F.current=_B(e.nativeEvent,ee.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(Rz(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(wO(e.nativeEvent)||TO(e.nativeEvent))j.current=!1;else{let e=!1;rk(R).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&rD(t)!==`body`?t:null,s=n?o||a:a||o;return s||=SB()||null,typeof i==`boolean`?s:gB(i)||s||null}return()=>{y.off(`openchange`,i);let t=VD(e),n=ce(),r=HD(v,t)||n.some(e=>e===t||HD(e,t))||k&&bO(k.nodesRef.current,x(),!1).some(e=>HD(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};le.current=l,queueMicrotask(()=>{le.current===l&&(le.current=null);let n=CB(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&cD(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,R,T,E,D,y,k,_,x,ce]),zk(()=>{if(!RD||g||!v)return;let e=VD(rk(v));!cD(e)||!gO(e)||HD(v,e)&&e.blur()},[g,v]),zk(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),zk(()=>{if(!(r||!R))return wB(R),()=>{queueMicrotask(bB)}},[r,R]);let z=!r&&(!c||!C)&&(oe||c);return(0,X.jsxs)(J.Fragment,{children:[z&&(0,X.jsx)(Lz,{"data-type":`inside`,ref:ne,onFocus:e=>{if(c){let e=se();Bz(e[e.length-1])}else A?.portalNode&&(j.current=!1,wk(e,A.portalNode)?xk(_)?.focus():gB(f??A.beforeOutsideRef)?.focus())}}),n,z&&(0,X.jsx)(Lz,{"data-type":`inside`,ref:re,onFocus:e=>{c?Bz(se()[0]):A?.portalNode&&(l&&(j.current=!0),wk(e,A.portalNode)?Sk(_)?.focus():gB(d??A.afterOutsideRef)?.focus())}})]})}function EB(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=mz}=t,l=e.context.dataRef,u=J.useRef(void 0),d=Pz(),f=eE(),p=J.useMemo(()=>{function t(t,n,r,i){let a=fz(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=EO(e.pointerType,!0)&&TO(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||EO(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=WD(s),p=gO(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}EO(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return J.useMemo(()=>n?{reference:p}:XT,[n,p])}function DB(){return!1}function OB(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function kB(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=DB,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=fB(c),m=GT(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=GT(()=>a),{escapeKey:v,outsidePress:y}=OB(s),b=J.useRef(!1),x=J.useRef(!1),S=J.useRef(!1),C=J.useRef(!1),w=J.useRef(!1),T=J.useRef(``),E=J.useRef(null),D=eE(),O=eE(),k=eE(),A=GT(()=>{O.clear(),d.current.insideReactTree=!1}),j=GT(e=>{let t=d.current.floatingContext?.nodeId;return(p?bO(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=GT(t=>mO(t,e.select(`floatingElement`))||mO(t,e.select(`domReferenceElement`))),N=GT(t=>{o()&&e.setOpen(!1,fz(mz,t.nativeEvent))}),P=GT(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=CO(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=fz(yz,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=GT(()=>{d.current.insideReactTree=!0,O.start(0,A)}),ee=GT(t=>{if(!l||!n||t.button!==0)return;let r=WD(t.nativeEvent);HD(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),I=GT(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});J.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),J.useEffect(()=>A,[A]),J.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new $T,i=rk(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(RD?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&bO(p.nodesRef.current,t).some(t=>mO(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=WD(n),i=`[${Rz(`inert`)}]`,a=sD(r)?r.getRootNode():null,o=Array.from((lD(a)?a:rk(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>HD(e,r))))return;let c=sD(r)?r:null;for(;c&&!bD(c);){let e=CD(c);if(bD(e)||!sD(e))break;c=e}if(!(o.length&&sD(r)&&!hO(r)&&!HD(r,e.select(`floatingElement`))&&o.every(e=>!HD(c,e)))){if(cD(r)&&!(`touches`in n)){let e=bD(r),t=xD(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!wO(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,fz(gz,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function ee(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function I(e,t){let n=WD(e);if(!n)return;let r=oA(n,e.type,()=>{t(e),r()})}function te(e){T.current=`touch`,I(e,ee)}function ne(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&I(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function re(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function ie(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function L(e){I(e,ie)}function ae(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function oe(e){I(e,ae)}let R=Oz(r&&Oz(oA(i,`keydown`,P),oA(i,`compositionstart`,a),oA(i,`compositionend`,o)),g&&Oz(oA(i,`click`,ne,!0),oA(i,`pointerdown`,ne,!0),oA(i,`pointerup`,re,!0),oA(i,`pointercancel`,re,!0),oA(i,`mousedown`,ne,!0),oA(i,`mouseup`,re,!0),oA(i,`touchstart`,te,{capture:!0,passive:!0}),oA(i,`touchmove`,L,{capture:!0,passive:!0}),oA(i,`touchend`,oe,{capture:!0,passive:!0})));return()=>{R(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let te=J.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ne=J.useMemo(()=>({onKeyDown:P,onPointerDown:I,onMouseDown:I,onClickCapture:F,onMouseDownCapture(e){F(),ee(e)},onPointerDownCapture(e){F(),ee(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,ee,I]);return J.useMemo(()=>n?{reference:te,floating:ne,trigger:te}:{},[n,te,ne])}function AB(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),zk(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};sD(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function jB(e,t=!1,n=!1,r=!1){let[i,a]=J.useState(e&&t?`idle`:void 0),[o,s]=J.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),zk(()=>{if(!e&&o&&i!==`ending`&&n){let e=Nz.request(()=>{a(`ending`)});return()=>{Nz.cancel(e)}}},[e,o,i,n]),zk(()=>{if(!e||t||i===void 0)return;let n=Nz.request(()=>{a(void 0)});return()=>{Nz.cancel(n)}},[t,e,i]),zk(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Nz.request(()=>{a(`idle`)});return()=>{Nz.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var MB=null;function NB(e){if(!MB){let e=[];MB=e,queueMicrotask(()=>{MB=null,QF.flushSync(()=>{for(let t of e)t()})})}MB.push(e)}function PB(e,t=!1,n=!1){let r=Pz();return GT((i,a=null)=>{r.cancel();let o=gB(e);if(o==null)return;let s=o,c=()=>{if(!n){QF.flushSync(i);return}NB(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(Kk(s).map(e=>e.finished.then(JT))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(Kk(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=qD;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function FB(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=GT(a),s=PB(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function IB(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=GT(i),{mounted:c,setMounted:l,transitionStatus:u}=jB(t,!1,!1,o),d=!t&&r;zk(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=HE(),h=()=>{f.current=!1,l(!1),a()};zk(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=GT(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return FB({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var LB={tabIndex:-1,[GD]:``};function RB(e){return t=>t!==`touch`||e.current}function zB(e,t=!1){let n=KE(),r=dB()!=null,i=HT(()=>e(n,r)).current;return AB({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function BB({handle:e,store:t}){return zk(()=>e.attachStore(t),[e,t]),null}function VB(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function HB(e,t){let n=J.useRef(null);return GT(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),VB(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),VB(t))})}function UB(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function WB(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function GB(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=HB(e,n),o=GT(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=GT(e=>{a(e),e&&o(e)});return zk(()=>(s(t.current),()=>s(null)),[s,t,n,e]),zk(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function KB(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`);zk(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=fz(pz);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function qB(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=IB({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return HT(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function JB(e,t){e.useSyncedValues(t),zk(()=>()=>{e.update({activeTriggerProps:XT,inactiveTriggerProps:XT,popupProps:XT})},[e])}function YB(e,t){zk(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),zk(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var XB=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},ZB=t((e=>{var t=dr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),QB=t(((e,t)=>{t.exports=ZB()})),$B=t((e=>{var t=dr(),n=QB();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),eV=t(((e,t)=>{t.exports=$B()})),tV=[],nV=void 0;function rV(){return nV}function iV(e){tV.push(e)}function aV(e){let t=(t,n)=>{let r=HT(sV).current,i;try{nV=r;for(let e of tV)e.before(r);i=e(t,n);for(let e of tV)e.after(r);r.didInitialize=!0}finally{nV=void 0}return i};return t.displayName=e.displayName||e.name,t}function oV(e){return J.forwardRef(aV(e))}function sV(){return{didInitialize:!1}}var cV=QB(),lV=eV(),uV=fE(19)?pV:mV;function dV(e,t,n,r,i){return uV(e,t,n,r,i)}function fV(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,cV.useSyncExternalStore)(e.subscribe,a,a)}iV({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,cV.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pV(e,t,n,r,i){let a=rV();if(!a)return fV(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function mV(e,t,n,r,i){return(0,lV.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var hV=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return dV(this,e,t,n,r)}},gV=class extends hV{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;zk(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;zk(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;zk(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;zk(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return J.useDebugValue(e),dV(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=GT(t??JT);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},_V={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},vV=class extends gV{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:sB(),nested:n,triggerElements:i},_V),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&DO(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function yV(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new vV({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:XT,inactiveTriggerProps:XT,popupProps:XT}}var bV=e=>e.triggerIdProp??e.activeTriggerId,xV=e=>e.openProp??e.open,SV=e=>(e.popupElement?.id??e.floatingId)||void 0;function CV(e,t){return t!==void 0&&xV(e)&&bV(e)===t}function wV(e,t){return CV(e,t)?!0:t!==void 0&&xV(e)&&bV(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var TV={open:xV,mounted:e=>e.mounted,transitionStatus:e=>xV(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:bV,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:SV,isTriggerActive:(e,t)=>t!==void 0&&bV(e)===t,isOpenedByTrigger:(e,t)=>CV(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&bV(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>wV(e,t)?SV(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function EV(e){let t=J.useCallback(t=>e===void 0?JT:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,cV.useSyncExternalStore)(t,n,()=>e?.serverStore)}var DV=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new $T;restTimeout=new $T;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},OV=new WeakMap;function kV(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&OV.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),OV.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function AV(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=OV.get(n);a&&a!==e&&kV(a),kV(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,OV.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function jV(e){let t=e.context.dataRef.current,n=HT(()=>t.hoverInteractionState??DV.create()).current;return t.hoverInteractionState||=n,ZT(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function MV(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=fB(),u=dB(),d=jV(e),f=eE(),p=GT(()=>Ez(c.current.openEvent?.type,d.interactedInside)),m=GT(()=>Dz(c.current.openEvent?.type)),h=GT(()=>{kV(d)});zk(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),zk(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&sD(s)&&o){let e=s,t=o,n=rk(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??UD(e,`[data-rootownerid]`)??n.body;return AV(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),J.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&bO(l.nodesRef.current,u).length>0)}function a(t){let n=wz(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,fz(hz,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=WD(e);if(!_O(t)){d.interactedInside=!1;return}d.interactedInside=UD(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(pO(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&sD(o)&&bO(l.nodesRef.current,r,!1).some(e=>HD(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,fz(hz,n)),l.events.emit(`floating.closed`,n)})}let y=o;return Oz(y&&oA(y,`mouseenter`,g),y&&oA(y,`mouseleave`,_),y&&oA(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var NV={current:null};function PV(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=NV,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=fB(l),v=jV(e),y=J.useRef(!1),b=kz(i),x=kz(r),S=kz(o),C=kz(n),w=kz(p),T=kz(f),E=GT(()=>Ez(h.current.openEvent?.type,v.interactedInside)),D=GT(()=>w.current?.()!==!1),O=GT((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!HD(t,n);if(!sD(r))return!1;let a=r;return i.hasMatchingElement(e=>HD(e,a))&&(!t||!HD(t,a))}),k=GT(()=>{v.handler&&=(rk(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=GT(()=>{kV(v)});return u&&(v.handleCloseOptions=i?.__options),J.useEffect(()=>k,[k]),J.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===hz,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),J.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=wz(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,fz(hz,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,fz(hz,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!sD(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!EO(v.pointerType))return;let n=Tz(S.current),r=wz(x.current,`open`,v.pointerType),i=WD(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(sD(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(HD(t,i)){c=t;break}}sD(o)&&sD(s)&&!e.context.triggerElements.hasElement(o)&&HD(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&sD(c)&&sD(s)&&HD(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,fz(hz,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,fz(hz,t,c))}):g&&D()&&e.setOpen(!0,fz(hz,t,c)))}function o(n){if(E()){A();return}k();let r=rk(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!pO(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!HD(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){HD(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?oA(r,`mouseout`,l):void 0;return s?Oz(oA(r,`mousemove`,i,{once:!0}),oA(r,`mouseenter`,i),oA(r,`mouseleave`,o),f):Oz(oA(r,`mouseenter`,i),oA(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),J.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!EO(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;AV(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Tz(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,fz(hz,n,r))}v.pointerType===`touch`?QF.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var FV=.1,IV=FV*FV,LV=.5;function RV(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function zV(e,t,n,r,i,a,o,s,c,l){let u=!1;return RV(e,t,n,r,i,a)&&(u=!u),RV(e,t,i,a,o,s)&&(u=!u),RV(e,t,o,s,c,l)&&(u=!u),RV(e,t,c,l,n,r)&&(u=!u),u}function BV(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function VV(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function HV(e={}){let{blockPointerEvents:t=!1}=e,n=new $T,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*IV;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=WD(r),g=r.type===`mouseleave`,_=HD(u,h),v=HD(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&sD(r.relatedTarget)&&HD(u,r.relatedTarget))return;function y(){return!!(s&&bO(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=VV(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=VV(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=VV(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=VV(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!BV(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?LV/2:LV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+LV+1,o=C||T?S.bottom-LV:S.top,s=C?T?S.bottom-LV:S.top:S.bottom-LV;M=zV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?LV/2:LV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-LV,o=C||T?S.top+LV:S.bottom,s=C?T?S.top+LV:S.bottom:S.top+LV;M=zV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?LV/2:LV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+LV+1,o=w||E?S.right-LV:S.left,s=w?E?S.right-LV:S.left:S.right-LV;M=zV(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?LV/2:LV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-LV,o=w||E?S.left+LV:S.right,s=w?E?S.left+LV:S.right:S.left+LV;M=zV(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function UV(e,t,n){let{reference:r,floating:i}=e,a=BO(t),o=VO(t),s=zO(o),c=IO(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=LO(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function WV(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=FO(t,e),p=$O(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ek(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ek(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var GV=50,KV=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:WV},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=UV(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<GV&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=UV(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},qV=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=FO(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=IO(r),_=BO(o),v=IO(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ZO(o)]:UO(o)),x=p!==`none`;!d&&x&&b.push(...XO(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=HO(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===BO(t)||T.every(e=>BO(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=BO(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},JV=new Set([`left`,`top`]);async function YV(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=IO(n),s=LO(n),c=BO(n)===`y`,l=JV.has(o)?-1:1,u=a&&c?-1:1,d=FO(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var XV=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await YV(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ZV=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=FO(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=BO(i),p=RO(f),m=u[p],h=u[f],g=(e,t)=>PO(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},QV=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=FO(e,t),u={x:n,y:r},d=BO(i),f=RO(d),p=u[f],m=u[d],h=FO(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=JV.has(IO(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$V=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=FO(e,t),c=await i.detectOverflow(t,s),l=IO(n),u=LO(n),d=BO(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=OO(p-c[m],g),y=OO(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*kO(c.left,c.right):S=p-2*kO(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function eH(e){let t=xD(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cD(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=AO(n)!==a||AO(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tH(e){return sD(e)?e:e.contextElement}function nH(e){let t=tH(e);if(!cD(t))return MO(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=eH(t),o=(a?AO(n.width):n.width)/r,s=(a?AO(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rH=MO(0);function iH(e){let t=iD(e);return!yD()||!t.visualViewport?rH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aH(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===iD(e)}function oH(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tH(e),o=MO(1);t&&(r?sD(r)&&(o=nH(r)):o=nH(e));let s=aH(a,n,r)?iH(a):MO(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=iD(a),t=sD(r)?iD(r):r,n=e,i=ED(n);for(;i&&t!==n;){let e=nH(i),t=i.getBoundingClientRect(),r=xD(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=iD(i),i=ED(n)}}return ek({width:u,height:d,x:c,y:l})}function sH(e,t){let n=SD(e).scrollLeft;return t?t.left+n:oH(aD(e)).left+n}function cH(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sH(e,n),y:n.top+t.scrollTop}}function lH(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=aD(r),s=t?fD(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=MO(1),u=MO(0),d=cD(r);if((d||!a)&&((rD(r)!==`body`||uD(o))&&(c=SD(r)),d)){let e=oH(r);l=nH(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cH(o,c):MO(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function uH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dH(e){let t=SD(e),n=e.ownerDocument.body,r=kO(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=kO(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+sH(e),o=-t.scrollTop;return xD(n).direction===`rtl`&&(a+=kO(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var fH=25;function pH(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=iD(e),a=aD(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yD()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(sH(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=fH&&(s-=o)}return{width:s,height:c,x:l,y:u}}function mH(e,t){let n=oH(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=nH(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hH(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=pH(e,n,t);else if(t===`document`)r=dH(aD(e));else if(sD(t))r=mH(t,n);else{let n=iH(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ek(r)}function gH(e,t){let n=t.get(e);if(n)return n;let r=TD(e,[],!1).filter(e=>sD(e)&&rD(e)!==`body`),i=null,a=xD(e).position===`fixed`,o=a?CD(e):e;for(;sD(o)&&!bD(o);){let e=xD(o),t=_D(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=CD(o)}return t.set(e,r),r}function _H(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fD(t)?[]:gH(t,this._c):[].concat(n),r],o=hH(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=hH(t,a[e],i);s=kO(n.top,s),c=OO(n.right,c),l=OO(n.bottom,l),u=kO(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function vH(e){let{width:t,height:n}=eH(e);return{width:t,height:n}}function yH(e,t,n){let r=cD(t),i=aD(t),a=n===`fixed`,o=oH(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=MO(0);if((r||!a)&&((rD(t)!==`body`||uD(i))&&(s=SD(t)),r)){let e=oH(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=sH(i));let l=i&&!r&&!a?cH(i,s):MO(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function bH(e){return xD(e).position===`static`}function xH(e,t){if(!cD(e)||xD(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return aD(e)===n&&(n=n.ownerDocument.body),n}function SH(e,t){let n=iD(e);if(fD(e))return n;if(!cD(e)){let t=CD(e);for(;t&&!bD(t);){if(sD(t)&&!bH(t))return t;t=CD(t)}return n}let r=xH(e,t);for(;r&&dD(r)&&bH(r);)r=xH(r,t);return r&&bD(r)&&bH(r)&&!_D(r)?n:r||vD(e)||n}var CH=async function(e){let t=this.getOffsetParent||SH,n=this.getDimensions,r=await n(e.floating);return{reference:yH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wH(e){return xD(e).direction===`rtl`}var TH={convertOffsetParentRelativeRectToViewportRelativeRect:lH,getDocumentElement:aD,getClippingRect:_H,getOffsetParent:SH,getElementRects:CH,getClientRects:uH,getDimensions:vH,getScale:nH,isElement:sD,isRTL:wH};function EH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function DH(e,t,n){let r=null,i,a=aD(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=jO(d),h=jO(a.clientWidth-(u+f)),g=jO(a.clientHeight-(d+p)),_=jO(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:kO(0,OO(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!EH(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=iD(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function OH(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tH(e),u=i||a?[...l?TD(l):[],...t?TD(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?DH(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?oH(e):null;c&&g();function g(){let t=oH(e);h&&!EH(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kH=XV,AH=ZV,jH=qV,MH=$V,NH=QV,PH=(e,t,n)=>{let r=new Map,i=n??{},a={...TH,...i.platform,_c:r};return KV(e,t,{...i,platform:a})},FH=typeof document<`u`?J.useLayoutEffect:function(){};function IH(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!IH(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!IH(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function LH(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RH(e,t){let n=LH(e);return Math.round(t*n)/n}function zH(e){let t=J.useRef(e);return FH(()=>{t.current=e}),t}function BH(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);IH(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=zH(c),D=zH(i),O=zH(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),PH(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!IH(w.current,t)&&(w.current=t,QF.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);FH(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);FH(()=>(A.current=!0,()=>{A.current=!1}),[]),FH(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=RH(M.floating,u.x),r=RH(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...LH(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var VH=(e,t)=>{let n=kH(e);return{name:n.name,fn:n.fn,options:[e,t]}},HH=(e,t)=>{let n=AH(e);return{name:n.name,fn:n.fn,options:[e,t]}},UH=(e,t)=>({fn:NH(e).fn,options:[e,t]}),WH=(e,t)=>{let n=jH(e);return{name:n.name,fn:n.fn,options:[e,t]}},GH=(e,t)=>{let n=MH(e);return{name:n.name,fn:n.fn,options:[e,t]}},KH=J.createContext(void 0);function qH(){let e=J.useContext(KH);if(e===void 0)throw Error(nE(26));return e}var JH=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),YH=`--nested-dialogs`,XH=`data-nested-dialog-open`,ZH={...uO,...ZD,nestedDialogOpen(e){return e?{[XH]:``}:null}},QH=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=rz(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);qH(),FB({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?RB(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=ME(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...LB,hidden:!m,onKeyDown(e){JH.has(e.key)&&e.stopPropagation()},style:{[YH]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ZH});return(0,X.jsx)(TB,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function $H(e){return fE(19)?e:e?`true`:void 0}var eU=J.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(0,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),tU=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=rz(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(KH.Provider,{value:n,children:(0,X.jsxs)(oB,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(eU,{ref:i.context.internalBackdropRef,inert:$H(!s)}),e.children]})}):null}),nU={},rU={},iU=``;function aU(e,t){return uD(e)?e:t}function oU(e,t,n){return/hidden|clip/.test(e.getComputedStyle(aU(t,n)).overflowY)}function sU(e){if(typeof document>`u`)return!1;let t=rk(e);return iD(t).innerWidth-t.documentElement.clientWidth>0}function cU(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=rk(e),n=t.documentElement,r=t.body,i=aU(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 lU(e){let t=rk(e),n=t.documentElement,r=t.body,i=aU(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 uU(e){let t=rk(e),n=t.documentElement,r=t.body,i=iD(n),a=0,o=0,s=!1,c=Nz.create();if(RD&&(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,nU={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},iU=n.style.scrollBehavior,rU={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=aU(n,r);if(s=cU(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}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,nU),Object.assign(r.style,rU),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=iU)}function d(){u(),c.request(l)}l();let f=oA(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var dU=new class{lockCount=0;restore=null;timeoutLock=$T.create();timeoutUnlock=$T.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=rk(e),n=t.documentElement,r=t.body,i=iD(n);if(oU(i,n,r)){let t=new i.MutationObserver(()=>{oU(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=ND||!sU(e);this.restore=a?lU(e):uU(e)}};function fU(e=!0,t=null){zk(()=>{if(e)return dU.acquire(t)},[e,t])}function pU({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=J.useState(0),[d,f]=J.useState(0),p=l===0,m=kB(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=WD(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||HD(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return fU(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),zk(()=>{!r&&!i&&(u(0),f(0))},[r,i]),zk(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),JB(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var mU={...TV,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},hU=class extends gV{constructor(e,t,n){let r=new XB,i=gU(e,r,t,n);super(i,_U(r),mU)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(UB(this.state,e,t.trigger)))}};function gU(e,t,n,r=!1){return{...yV(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function _U(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function vU(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=rz(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=zB((e,t)=>new hU({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);YB(b,x),KB(b);let{forceUnmount:w}=qB(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,fz(bz))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(nz.Provider,{value:b,children:[u&&(0,X.jsx)(BB,{handle:u,store:b}),T&&(0,X.jsx)(pU,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var yU=aV(function(e){return vU(`dialog`,e)}),bU=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=rz(),c=qE(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ME(`h2`,e,{ref:t,props:[{id:c},o]})});function xU(e){let t=J.useRef(``),n=J.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:J.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function SU(e,t){let{onClick:n,onPointerDown:r}=xU(GT((n,r)=>{(typeof e==`function`?e():e)||t(r||(ND?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var CU=oV(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=rz(!0),f=EV(l)??d;if(!f)throw Error(nE(79));let p=qE(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=GB(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=lz({disabled:a,native:o}),S=EB(m),C=SU(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return ME(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[$z]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:cO})}),wU=(0,J.createContext)(void 0),TU=(0,J.createContext)(null);function EU(e){let t=(0,J.useContext)(TU);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function DU(e){let t=(0,J.useContext)(wU),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var OU=(0,J.createContext)(null);function kU({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(OU.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(yU,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function AU(){let e=(0,J.useContext)(OU);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(CU,{...n,className:t=>Q(`btn`,Ax(e,t)),ref:r,type:t})});var jU=(0,J.forwardRef)(function({container:e,...t},n){let r=EU(`dialog`);return e==null&&r===null?null:(0,X.jsx)(tU,{...t,container:e??r,ref:n})}),MU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(iz,{...t,ref:n,className:t=>Q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,Ax(e,t))})}),NU=(0,J.forwardRef)(function({className:e,finalFocus:t,size:n=`default`,...r},i){let a=AU();return(0,X.jsx)(QH,{...r,"data-size":n,className:t=>Q(`caps-dialog-popup overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,n===`fill`?`fixed inset-0 h-full w-full max-w-none`:`max-h-screen w-11/12 max-w-(--container-lg)`,Ax(e,t)),finalFocus:a.interactionOwner===`host`?!1:t??!0,ref:i})}),PU=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,size:r=`default`,...i},a){let{modal:o}=AU();return(0,X.jsxs)(jU,{container:e,keepMounted:t,children:[o===!0?(0,X.jsx)(MU,{}):null,(0,X.jsx)(NU,{...i,size:r,className:e=>Q(r==="default"&&`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,Ax(n,e)),ref:a})]})});function FU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex justify-end gap-sm`,e)})}function IU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex flex-col gap-sm`,e)})}var LU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(bU,{...t,className:t=>Q(`text-lg font-semibold`,Ax(e,t)),ref:n})}),RU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Sz,{...t,className:t=>Q(`text-sm text-base-content`,Ax(e,t)),ref:n})}),zU=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(xz,{...n,className:t=>Q(`btn btn-ghost`,Ax(e,t)),ref:r,type:t})}),BU=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),VU=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),HU={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},UU=(0,J.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,J.createElement)(`svg`,{ref:c,...HU,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:VU(`lucide`,i),...s},[...o.map(([e,t])=>(0,J.createElement)(e,t)),...Array.isArray(a)?a:[a]])),WU=(e,t)=>{let n=(0,J.forwardRef)(({className:n,...r},i)=>(0,J.createElement)(UU,{ref:i,iconNode:t,className:VU(`lucide-${BU(e)}`,n),...r}));return n.displayName=`${e}`,n},GU=WU(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),KU=WU(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),qU=WU(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),JU=WU(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),YU=WU(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),XU=WU(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ZU=WU(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),QU=WU(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),$U=WU(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),eW=WU(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),tW=WU(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),nW=WU(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),rW=WU(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),iW=WU(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),aW=WU(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),oW=WU(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),sW=WU(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),cW=WU(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function lW(e,t){return Math.max(0,t===`reverse`?-e.scrollTop:e.scrollHeight-e.clientHeight-e.scrollTop)}function uW(){return{phase:`hidden`,shown:!1,jumped:!1,velocity:0,y:0,vy:0,volume:0,vv:0,opacity:0,unread:0,bead:0}}function dW(e){return 1+Math.min(.15,.06*Math.log2(1+Math.max(0,e)))}function fW(e,t,n,r,i,a){let o=t+(-i*i*(e-n)-2*a*i*t)*r;return[e+o*r,o]}function pW(e,t,n,r){let i={...e},a=Math.max(1,Math.min(64,n)),o=t.jump===!0||e.jumped;i.jumped=o,o?(i.phase=`merging`,i.shown=!1,i.unread=0,i.velocity=0):(t.distance>48?i.shown=!0:t.distance<8&&(i.shown=!1),i.unread=i.shown?Math.max(0,t.unread):0,i.unread>e.unread&&i.shown&&!r.reduced&&(i.bead=1),i.velocity+=(t.delta/a-i.velocity)*(1-Math.exp(-a/50))),!i.shown&&e.phase!==`hidden`&&(i.phase=`merging`),i.shown&&!e.shown&&(i.phase=`welling`);let s=i.shown?dW(i.unread):0;if(e.phase===`hidden`&&i.shown&&(i.phase=`welling`,i.y=r.reduced?0:5),r.reduced){i.y=0,i.vy=0,i.velocity=0,i.vv=0,i.bead=0,i.volume=dW(i.unread);let e=a/Math.max(1,r.fast);i.opacity=i.shown?Math.min(1,i.opacity+e):Math.max(0,i.opacity-e)}else{let e=2*Math.PI/Math.max(.08,r.springDuration/1e3),t=Math.max(.08,1-r.bounce),n=Math.max(-9,Math.min(9,-i.velocity*7)),c=o?12:i.shown?n:4,l=Math.ceil(a/8);for(let n=0;n<l;n++)[i.y,i.vy]=fW(i.y,i.vy,c,a/l/1e3,e,t),[i.volume,i.vv]=fW(i.volume,i.vv,s,a/l/1e3,o?e/1.7:e,o?1:t);i.opacity=Math.min(1,Math.max(0,i.volume*1.4)),i.bead=Math.max(0,i.bead-a/580)}return!i.shown&&(r.reduced?i.opacity===0:i.volume<.002&&Math.abs(i.vv)<.02)?uW():(i.shown&&Math.abs(i.volume-s)<.001&&Math.abs(i.vv)<.01&&Math.abs(i.y)<.02&&Math.abs(i.vy)<.2&&i.bead===0?(i.phase=`resting`,i.volume=s,i.vv=0,i.y=0,i.vy=0,i.velocity=0):i.shown&&i.volume>.95&&(i.phase=`tugged`),i)}var mW=(0,J.memo)(function({direction:e=`forward`,scrollerRef:t,onJump:n,unread:r=0,focusAfterJump:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(uW()),p=(0,J.useRef)(()=>void 0),m=(0,J.useRef)(!1),h=(0,J.useRef)(r),g=sS(a),_=`caps-drop-${(0,J.useId)().replaceAll(`:`,``)}`;return(0,J.useEffect)(()=>{h.current=r,p.current()},[r]),(0,J.useEffect)(()=>{let n=t.current,r=o.current,i=s.current,_=c.current,v=l.current,y=u.current,b=d.current,x=a.current;if(!n||!r||!i||!_||!v||!y||!b||!x)return;let S=0,C=0,w=n.scrollTop,T=!0,E=()=>{let e=f.current;if(r.dataset.motionState=e.phase,r.style.display=e.phase===`hidden`?`none`:``,y.tabIndex=e.phase===`hidden`||e.phase===`merging`?-1:0,y.disabled=e.phase===`merging`,y.setAttribute(`aria-label`,`Jump to bottom${e.unread?`, ${String(e.unread)} new message${e.unread===1?``:`s`}`:``}`),r.style.opacity=g.reduced?String(e.opacity):``,_.style.display=g.reduced||e.phase===`resting`||e.phase===`hidden`?`none`:``,v.style.display=g.reduced||e.bead===0?`none`:``,g.reduced){i.style.transform=``,i.style.transformOrigin=``,i.style.width=e.unread?`${String(y.clientWidth*e.volume)}px`:``,i.style.height=e.unread?`${String(y.clientWidth*e.volume)}px`:``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}if(i.style.width=``,i.style.height=``,e.phase===`resting`&&e.unread===0){i.style.transform=``,i.style.transformOrigin=``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}let t=Math.min(1,Math.abs(e.y)/9*.7+Math.abs(e.vy)/120*.3),n=1+g.stretch*t,a=Math.max(.001,e.volume),o=Math.max(0,1-a);i.style.transformOrigin=e.y>=0?`50% 0%`:`50% 100%`,i.style.transform=`translateY(${String(e.y)}px) scale(${String(a/Math.sqrt(n)*(1-.12*o))}, ${String(a*n*(1+.1*o))})`,_.style.transform=`scale(${String(Math.min(1,Math.abs(e.y)/3)*a*.55)})`,v.style.transform=`translateY(${String(-34*e.bead*e.bead)}px) scale(${String(.62*Math.min(1,e.bead*3))})`,b.style.transform=`translateY(${String(e.y*.8)}px)`,b.style.opacity=String(e.opacity)},D=t=>{S=0;let r=C?t-C:16;C=t;let i=n.scrollTop;f.current=pW(f.current,{distance:lW(n,e),delta:i-w,unread:h.current,jump:m.current},r,g),w=i,m.current=!1,E();let a=f.current;a.phase!==`hidden`&&(!a.shown||a.phase!==`resting`||a.opacity<1)&&O()};function O(){!T||S||(S=requestAnimationFrame(D))}let k=()=>{S||(C=0),O()};p.current=k;let A=ST(x,e=>{T=e,e?(C=0,w=n.scrollTop,O()):(cancelAnimationFrame(S),S=0)}),j=globalThis,M=j.ResizeObserver?new j.ResizeObserver(k):void 0;return M?.observe(n),n.firstElementChild&&M?.observe(n.firstElementChild),n.addEventListener(`scroll`,k,{passive:!0}),O(),()=>{p.current=()=>void 0,cancelAnimationFrame(S),n.removeEventListener(`scroll`,k),M?.disconnect(),A()}},[e,t,g]),(0,X.jsx)(`div`,{ref:a,className:`absolute bottom-4 right-4 z-1 h-8 w-8 md:h-6 md:w-6`,children:(0,X.jsxs)(`div`,{ref:o,className:`relative h-full w-full`,"data-motion-state":`hidden`,style:{display:`none`},children:[(0,X.jsxs)(`div`,{className:`absolute -inset-1.5`,style:{filter:`url(#${_})`,willChange:`filter`},children:[(0,X.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,children:(0,X.jsx)(`defs`,{children:(0,X.jsxs)(`filter`,{id:_,x:`-60%`,y:`-60%`,width:`220%`,height:`220%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,result:`blur`,stdDeviation:`4`}),(0,X.jsx)(`feColorMatrix`,{in:`blur`,type:`matrix`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9`})]})})}),(0,X.jsx)(`div`,{className:`absolute inset-0 m-auto h-8 w-8 md:h-6 md:w-6`,ref:s,"data-drop-body":``,children:(0,X.jsx)(`div`,{className:`absolute inset-0 rounded-full border border-base-300 bg-base-200 shadow-sm`})}),(0,X.jsx)(`div`,{ref:c,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`}}),(0,X.jsx)(`div`,{ref:l,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`},"data-drop-incoming":``})]}),(0,X.jsx)(`button`,{ref:u,"aria-label":`Jump to bottom`,className:`absolute inset-0 z-1 grid place-items-center rounded-full caps-focus-color`,"data-testid":`jump-to-bottom`,onClick:()=>{if(f.current.phase!==`hidden`&&f.current.phase!==`merging`){if(m.current=!0,h.current=0,p.current(),document.activeElement===u.current){let e=i?.current??t.current;e&&(e===t.current&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=-1),e.focus({preventScroll:!0}))}n()}},title:`Jump to bottom`,type:`button`,tabIndex:-1,children:(0,X.jsx)(GU,{ref:d,className:`text-base-content`,size:13})})]})})});function hW(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function gW(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function _W(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var vW=(e,t)=>Math.abs(e-t)<1.01,yW=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},bW,xW=()=>{if(bW!==void 0)return bW;if(typeof navigator>`u`)return bW=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return bW=!0;let e=navigator.maxTouchPoints;return bW=navigator.platform===`MacIntel`&&e!==void 0&&e>0},SW=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},CW=e=>e,wW=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},TW=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(SW(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(SW(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},EW={passive:!0},DW=typeof window>`u`||`onscrollend`in window,OW=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&DW,o=0,s=a?null:yW(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,EW),a&&r.addEventListener(`scrollend`,u,EW),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},kW=(e,t)=>OW(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),AW=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},jW=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},MW=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:CW,rangeExtractor:wW,onChange:()=>{},measureElement:AW,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=gW(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!xW()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,EW),e.addEventListener(`touchend`,n,EW),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(xW()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=gW(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=gW(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=hW(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=gW(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=FW(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=gW(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=gW(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return _W(t[NW(0,t.length-1,r?e=>n[e*2]:e=>_W(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:xW()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&vW(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},NW=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function PW(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function FW(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=PW(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=NW(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var IW=typeof document<`u`?J.useLayoutEffect:J.useEffect;function LW({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=J.useReducer(e=>e+1,0)[1],a=J.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,QF.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=J.useState(()=>{let e=new MW(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),IW(()=>l._didMount(),[]),IW(()=>(o(l),l._willUpdate())),IW(()=>{s(l)}),l}function RW(e){return LW({observeElementRect:TW,observeElementOffset:kW,scrollToFn:jW,...e})}function zW(e){return e.kind===`user_message`&&e.requestId!==void 0?e.requestId:e.id}function BW(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function VW(e,t){let n=[...e,...t].map(zW),[r,i]=(0,J.useState)(n),a=BW(r,n)?r:n;return a!==r&&i(a),(0,J.useCallback)(e=>a[e]??e,[a])}function HW(e){return e<1e3?`${String(e)} tok`:`${(e/1e3).toFixed(1)}K`}var UW={"anthropic-messages":JSON.parse(`{"chat:claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsStrictTools":true,"allowedFallbackModels":[{"provider":"anthropic","model":"claude-opus-4-8","cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25}},{"provider":"anthropic","model":"claude-opus-5","cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25}}]},"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-fable-5-1":{"id":"claude-fable-5-1","name":"Claude Fable 5.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsStrictTools":true},"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-5-5":{"id":"claude-haiku-5-5","name":"Claude Haiku 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"tiers":[{"inputTokensAbove":100000,"input":0.5,"output":2.5,"cacheRead":0.05,"cacheWrite":0.625}]},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-5-5":{"id":"claude-opus-5-5","name":"Claude Opus 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-5-5":{"id":"claude-sonnet-5-5","name":"Claude Sonnet 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)};function WW(e,t){return Object.fromEntries(Object.values(e).flatMap(e=>Object.values(e)).filter(e=>e.type===t).map(e=>[e.id,e]))}function GW(e,t){return WW(t,`chat`)}function KW(e,t){return WW(t,`image`)}function qW(e,t){return WW(t,`classifier`)}var JW=GW(`anthropic`,UW);KW(`anthropic`,UW),qW(`anthropic`,UW);var YW={"cloudflare-workers-ai-system-one":{"classifier:@cf/cloudflare/clef":{type:`classifier`,id:`@cf/cloudflare/clef`,name:`Clef`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:.24,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536},"classifier:@cf/cloudflare/clef-flash":{type:`classifier`,id:`@cf/cloudflare/clef-flash`,name:`Clef Flash`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:.09,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536},"classifier:typesafe/jev":{type:`classifier`,id:`typesafe/jev`,name:`Jev`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:32e3}},"openai-completions":JSON.parse(`{"chat:@cf/deepseek-ai/deepseek-v4-flash-0731":{"id":"@cf/deepseek-ai/deepseek-v4-flash-0731","name":"DeepSeek V4 Flash 0731","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.44,"output":1.32,"cacheRead":0.014,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek"},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"},"chat:@cf/deepseek-ai/deepseek-v4-pro-0813":{"id":"@cf/deepseek-ai/deepseek-v4-pro-0813","name":"DeepSeek V4 Pro 0813","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.32,"output":3.96,"cacheRead":0.044,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek"},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"},"chat:@cf/google/gemma-4-26b-a4b-it":{"id":"@cf/google/gemma-4-26b-a4b-it","name":"Gemma 4 26B A4B IT","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.3,"cacheRead":0.05,"cacheWrite":0},"contextWindow":256000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/ibm-granite/granite-4.0-h-micro":{"id":"@cf/ibm-granite/granite-4.0-h-micro","name":"Granite 4.0 H Micro","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text"],"cost":{"input":0.017,"output":0.112,"cacheRead":0,"cacheWrite":0},"contextWindow":131000,"maxTokens":131000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/meta/llama-3.3-70b-instruct-fp8-fast":{"id":"@cf/meta/llama-3.3-70b-instruct-fp8-fast","name":"Llama 3.3 70B Instruct fp8 Fast","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text"],"cost":{"input":0.293,"output":2.253,"cacheRead":0,"cacheWrite":0},"contextWindow":24000,"maxTokens":24000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/meta/llama-4-scout-17b-16e-instruct":{"id":"@cf/meta/llama-4-scout-17b-16e-instruct","name":"Llama 4 Scout 17B 16E Instruct","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.27,"output":0.85,"cacheRead":0,"cacheWrite":0},"contextWindow":131000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/mistralai/mistral-small-3.1-24b-instruct":{"id":"@cf/mistralai/mistral-small-3.1-24b-instruct","name":"Mistral Small 3.1 24B Instruct","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.351,"output":0.555,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":128000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/moonshotai/kimi-k2.6":{"id":"@cf/moonshotai/kimi-k2.6","name":"Kimi K2.6","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.95,"output":4,"cacheRead":0.16,"cacheWrite":0},"contextWindow":262144,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/moonshotai/kimi-k2.7-code":{"id":"@cf/moonshotai/kimi-k2.7-code","name":"Kimi K2.7 Code","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.95,"output":4,"cacheRead":0.19,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/nvidia/nemotron-3-120b-a12b":{"id":"@cf/nvidia/nemotron-3-120b-a12b","name":"Nemotron 3 Super 120B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.5,"output":1.5,"cacheRead":0,"cacheWrite":0},"contextWindow":256000,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/openai/gpt-oss-120b":{"id":"@cf/openai/gpt-oss-120b","name":"GPT OSS 120B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.35,"output":0.75,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/openai/gpt-oss-20b":{"id":"@cf/openai/gpt-oss-20b","name":"GPT OSS 20B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.2,"output":0.3,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/qwen/qwen3-30b-a3b-fp8":{"id":"@cf/qwen/qwen3-30b-a3b-fp8","name":"Qwen3 30B A3b fp8","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.0509,"output":0.335,"cacheRead":0,"cacheWrite":0},"contextWindow":32768,"maxTokens":32768,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/qwen/qwen3.8-27b":{"id":"@cf/qwen/qwen3.8-27b","name":"Qwen3.8 27B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.45,"output":3.2,"cacheRead":0.05,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/zai-org/glm-4.7-flash":{"id":"@cf/zai-org/glm-4.7-flash","name":"GLM-4.7-Flash","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.0605,"output":0.4,"cacheRead":0,"cacheWrite":0},"contextWindow":131072,"maxTokens":131072,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/zai-org/glm-5.2":{"id":"@cf/zai-org/glm-5.2","name":"Glm 5.2","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":262144,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:@cf/zai-org/glm-5.3":{"id":"@cf/zai-org/glm-5.3","name":"Glm 5.3","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:@cf/zai-org/glm-5.3-flash":{"id":"@cf/zai-org/glm-5.3-flash","name":"Glm 5.3 Flash","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)},XW=GW(`cloudflare-workers-ai`,YW);KW(`cloudflare-workers-ai`,YW);var ZW=qW(`cloudflare-workers-ai`,YW),QW={"openai-decisions":{"classifier:gpt-6-luna":{type:`classifier`,id:`gpt-6-luna`,name:`GPT-6 Luna`,api:`openai-decisions`,provider:`openai`,baseUrl:`https://api.openai.com/v1`,input:[`text`,`image`],cost:{input:.1,output:0,cacheRead:0,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:.2,output:0,cacheRead:0,cacheWrite:0}]},contextWindow:922e3}},"openai-responses":JSON.parse(`{"chat:gpt-4":{"id":"gpt-4","name":"GPT-4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text"],"cost":{"input":30,"output":60,"cacheRead":0,"cacheWrite":0},"contextWindow":8192,"maxTokens":8192,"compat":{"supportsStrictMode":true},"type":"chat"},"chat:gpt-4-turbo":{"id":"gpt-4-turbo","name":"GPT-4 Turbo","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":10,"output":30,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1":{"id":"gpt-4.1","name":"GPT-4.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1-mini":{"id":"gpt-4.1-mini","name":"GPT-4.1 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.4,"output":1.6,"cacheRead":0.1,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1-nano":{"id":"gpt-4.1-nano","name":"GPT-4.1 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o":{"id":"gpt-4o","name":"GPT-4o","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-05-13":{"id":"gpt-4o-2024-05-13","name":"GPT-4o (2024-05-13)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":15,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-08-06":{"id":"gpt-4o-2024-08-06","name":"GPT-4o (2024-08-06)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-11-20":{"id":"gpt-4o-2024-11-20","name":"GPT-4o (2024-11-20)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-mini":{"id":"gpt-4o-mini","name":"GPT-4o mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.075,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5":{"id":"gpt-5","name":"GPT-5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-chat-latest":{"id":"gpt-5-chat-latest","name":"GPT-5 Chat Latest","api":"openai-responses","baseUrl":"https://api.openai.com/v1","provider":"openai","reasoning":false,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-mini":{"id":"gpt-5-mini","name":"GPT-5 Mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":2,"cacheRead":0.025,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-nano":{"id":"gpt-5-nano","name":"GPT-5 Nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.05,"output":0.4,"cacheRead":0.005,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-pro":{"id":"gpt-5-pro","name":"GPT-5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":120,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.1":{"id":"gpt-5.1","name":"GPT-5.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2":{"id":"gpt-5.2","name":"GPT-5.2","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2-chat-latest":{"id":"gpt-5.2-chat-latest","name":"GPT-5.2 Chat","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":null,"xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2-pro":{"id":"gpt-5.2-pro","name":"GPT-5.2 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":21,"output":168,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-chat-latest":{"id":"gpt-5.3-chat-latest","name":"GPT-5.3 Chat (latest)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"xhigh":"xhigh"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-codex":{"id":"gpt-5.3-codex","name":"GPT-5.3 Codex","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-codex-spark":{"id":"gpt-5.3-codex-spark","name":"GPT-5.3 Codex Spark","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4":{"id":"gpt-5.4","name":"GPT-5.4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2.5,"output":15,"cacheRead":0.25,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":5,"output":22.5,"cacheRead":0.5,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-mini":{"id":"gpt-5.4-mini","name":"GPT-5.4 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.75,"output":4.5,"cacheRead":0.075,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-nano":{"id":"gpt-5.4-nano","name":"GPT-5.4 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.25,"cacheRead":0.02,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-pro":{"id":"gpt-5.4-pro","name":"GPT-5.4 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.5-pro":{"id":"gpt-5.5-pro","name":"GPT-5.5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-luna":{"id":"gpt-5.6-luna","name":"GPT-5.6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.2,"cacheRead":0.02,"cacheWrite":0.25,"tiers":[{"inputTokensAbove":272000,"input":0.4,"output":1.8,"cacheRead":0.04,"cacheWrite":0.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.4,"cacheWrite":5,"tiers":[{"inputTokensAbove":272000,"input":8,"output":30,"cacheRead":0.8,"cacheWrite":10}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-terra":{"id":"gpt-5.6-terra","name":"GPT-5.6 Terra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":18,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-astra":{"id":"gpt-6-astra","name":"GPT-6 Astra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5,"tiers":[{"inputTokensAbove":272000,"input":20,"output":75,"cacheRead":2,"cacheWrite":25}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-luna":{"id":"gpt-6-luna","name":"GPT-6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"tiers":[{"inputTokensAbove":272000,"input":0.2,"output":0.75,"cacheRead":0.02,"cacheWrite":0.25}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-sol":{"id":"gpt-6-sol","name":"GPT-6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":15,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6.1-sol":{"id":"gpt-6.1-sol","name":"GPT-6.1 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":15,"cacheRead":0.2,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-daybreak-blue-latest":{"id":"gpt-daybreak-blue-latest","name":"Daybreak Blue","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.4,"cacheWrite":5,"tiers":[{"inputTokensAbove":272000,"input":8,"output":30,"cacheRead":0.8,"cacheWrite":10}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-daybreak-red-latest":{"id":"gpt-daybreak-red-latest","name":"Daybreak Red","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":12.5,"output":75,"cacheRead":1.25,"cacheWrite":15.625},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-realtime-2.1":{"id":"gpt-realtime-2.1","name":"GPT-Realtime-2.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":24,"cacheRead":0.4,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o1":{"id":"o1","name":"o1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":60,"cacheRead":7.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o1-pro":{"id":"o1-pro","name":"o1-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":150,"output":600,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o3":{"id":"o3","name":"o3","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o3-mini":{"id":"o3-mini","name":"o3-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.55,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"type":"chat"},"chat:o3-pro":{"id":"o3-pro","name":"o3-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":20,"output":80,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o4-mini":{"id":"o4-mini","name":"o4-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.275,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)},$W=GW(`openai`,QW);KW(`openai`,QW);var eG=qW(`openai`,QW),tG={"openai-codex-responses":{"chat:gpt-5.3-codex-spark":{id:`gpt-5.3-codex-spark`,name:`GPT-5.3 Codex Spark`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0},type:`chat`},"chat:gpt-5.5":{id:`gpt-5.5`,name:`GPT-5.5`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-luna":{id:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:272e3,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-sol":{id:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-terra":{id:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-astra":{id:`gpt-6-astra`,name:`GPT-6 Astra`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:null,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-luna":{id:`gpt-6-luna`,name:`GPT-6 Luna`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:`none`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-sol":{id:`gpt-6-sol`,name:`GPT-6 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:`none`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6.1-sol":{id:`gpt-6.1-sol`,name:`GPT-6.1 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:5e5,maxTokens:128e3,thinkingLevelMap:{off:null,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`}}},nG=GW(`openai-codex`,tG);KW(`openai-codex`,tG),qW(`openai-codex`,tG);var rG=new Map([...Object.values(JW),...Object.values(XW),...Object.values($W),...Object.values(nG)].map(e=>[xA({provider:e.provider,model:e.id}),e.name]));function iG(e){let t=xA(e);return rG.get(t)??t}var aG=b_({keyCode:D_(229)});function oG(e){return e.nativeEvent.isComposing||h(aG,e.nativeEvent).success}var sG={admission:`Your prompt didn’t make it through. Let’s give it another go.`,failed:`The run stopped. Check the message above before trying again.`,interrupted:`The worker stopped before this run finished. Your prompt is still here.`,cancelled:`The run was cancelled. Send a new prompt when you’re ready.`};function cG({failure:e,cause:t,onRetry:n}){let r=t===void 0?void 0:Kn(t),i=r!==void 0&&!r.startsWith(`reason_unavailable:`)&&!/\b(?:run|session)=/iu.test(r)?r:void 0;return(0,X.jsx)(Mx,{tone:`warning`,title:e===`cancelled`?`Taking a breather`:`A little tangle`,description:e===`interrupted`&&i!==void 0?(0,X.jsxs)(X.Fragment,{children:[`This turn stopped before it finished: `,i,`. Your prompt is still here.`]}):(0,X.jsxs)(X.Fragment,{children:[sG[e],` If the model didn’t start, there’s no charge. Model work already done can still use credits.`,i?(0,X.jsx)(`span`,{className:`block`,children:i}):null]}),action:e===`cancelled`?void 0:(0,X.jsx)(NT,{"aria-label":`Retry prompt`,variant:`outline`,onClick:n,children:`Retry`})})}var lG=(0,J.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,X.jsx)(`kbd`,{...i,ref:a,className:Q(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})}),uG=(0,J.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,X.jsxs)(`button`,{...l,ref:u,type:c,className:Q(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,X.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,X.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,X.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,X.jsx)(lG,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function dG(e,t){return e.animate(t.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(-120%)`}],{duration:t.reduced?t.fast:t.normal,easing:dS(t,t.easeExit),fill:`backwards`})}function fG(e,t){let n=-12*Math.min(1.5,t.bounce/.3);return e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(70%)`},{opacity:1,transform:`translateY(${String(n)}%)`,offset:.6},{opacity:1,transform:`none`}],{duration:t.reduced?t.fast:t.springDuration,easing:dS(t,t.ease),fill:`backwards`})}function pG(e,t,n){return e.animate([{opacity:1-n},{opacity:n}],{duration:t.reduced?t.fast:t.normal,delay:n===1&&!t.reduced?t.fast/2:0,easing:dS(t,t.ease),fill:`backwards`})}function mG(e,t){let n=1+.05*Math.min(1.5,.4+t.bounce/.3);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(n)})`,offset:.4},{transform:`scale(1)`}],{duration:t.springDuration,easing:dS(t,`ease-out`)})}var hG=(0,J.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...l},u){let d=(0,J.useRef)(null);(0,J.useImperativeHandle)(u,()=>d.current);let f=(0,J.useRef)(e);(0,J.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!fS(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=oS(t),o=[];return e===`busy`?o.push(dG(r,a),pG(i,a,1)):n===`busy`&&o.push(pG(i,a,0),fG(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(mG(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,X.jsx)(uG,{...l,ref:d,className:Q(`caps-send-action`,o),tone:s,"aria-busy":p?!0:void 0,"aria-label":m?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||p&&!m,onClick:m?t:i,label:null,icon:(0,X.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,X.jsx)(`span`,{"data-glyph":`arrow`,children:(0,X.jsx)(KU,{"aria-hidden":`true`,size:r})}),(0,X.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,X.jsx)(AT,{decorative:!0,size:`sm`}):(0,X.jsx)(oW,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),gG=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),_G=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function vG(e,t){if(!Number.isFinite(e))throw RangeError(`Money amount must be finite`);let n=e!==0&&Math.abs(e)<.01;return n&&(t?.precision!==`exact`||Math.abs(e)<1e-5)?e<0?`>-$0.01`:`<$0.01`:n?_G.format(e):gG.format(e)}var yG={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function bG({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(yG[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=sS(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=yG[t],n=h||p.current===t;p.current=t;let r=oS(i.current),o=n?{duration:0}:pA(r,{bounce:.3,duration:360}),s=fT(i.current,{y:e.y,height:e.height,...o}),u=fT(a.current,{cy:e.cy,...n?{duration:0}:{delay:cS(r,35),...pA(r,{bounce:.3,duration:420})}}),d=fT(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=fT(l.current,{opacity:+(t===`bang`),...n?fA:mA(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,J.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?fT(o.current,{opacity:[1,.45],...mA(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):fT(o.current,{keyframes:{"0%":{translateY:0,scaleX:1,scaleY:1},"18%":{translateY:.25,scaleX:1.1,scaleY:.91},"42%":{translateY:-1.3,scaleX:.94,scaleY:1.06},"62%":{translateY:-1.65,scaleX:1,scaleY:1},"82%":{translateY:.15,scaleX:1.06,scaleY:.95},"100%":{translateY:0,scaleX:1,scaleY:1}},...mA(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=ST(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,X.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(xT,{id:r,values:bT}),(0,X.jsx)(_T,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,X.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,X.jsx)(vT,{id:`${r}-shadow`}),(0,X.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,X.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,X.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,X.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,X.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,X.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,X.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,X.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var xG=.28;function SG(e,t){switch(e){case`ring`:return{dashes:1,track:0,arc:0,sweep:0,disc:0,tick:0,cross:0};case`arc`:return{dashes:0,track:1,arc:1,sweep:t===void 0?xG:Math.min(1,Math.max(0,t)),disc:0,tick:0,cross:0};case`check`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:1,cross:0};case`cross`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:0,cross:1}}}var CG=7.25;function wG({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(SG(t,n)).current,p=(0,J.useRef)(t),m=_S();(0,J.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=SG(t,n),y=p.current;p.current=t;let b=oS(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:fA:mA(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=mA(b,{ease:`inOutSine`,duration:220}),T=[fT(r,{opacity:v.dashes,...S}),fT(c,{opacity:v.track*.28,...S}),fT(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?fA:S:w}),fT(h,{r:v.disc*CG,...C?{delay:w.duration*.7,...pA(b,{bounce:.35,duration:360})}:m?fA:mA(b,{ease:`inCubic`,duration:140})}),fT(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...mA(b,{ease:`outCubic`,duration:240})}:fA}),fT(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...mA(b,{ease:`outCubic`,duration:240})}:fA})];return t===`cross`&&C&&b.shake>0&&T.push(fT(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...mA(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,J.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=oS(i.current),t=fT(c.current,{rotate:[0,360],...mA(e,{ease:`linear`,duration:900}),loop:!0}),n=ST(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,X.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,X.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,X.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,X.jsx)(`path`,{ref:u,d:`M4.9 8.3 7.1 10.5 11.2 5.9`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.tick}),(0,X.jsx)(`path`,{ref:d,d:`M5.4 5.4 10.6 10.6 M10.6 5.4 5.4 10.6`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.cross})]})]}),(0,X.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,X.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,X.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,X.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,X.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*CG,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var TG=new Set([`ring`,`arc`,`check`,`cross`]);function EG(e){return TG.has(e)}var DG={neutral:`text-base-content`,primary:`text-primary`,secondary:`text-secondary`,accent:`text-accent`,success:`text-success`,info:`text-info`,warning:`text-warning`,error:`text-error`},OG=(0,J.forwardRef)(function({className:e,label:t,glyph:n=`dot`,motion:r=`none`,tone:i=`neutral`,size:a=`default`,appearance:o=`plain`,progress:s,...c},l){return(0,X.jsxs)(`span`,{...c,className:Q(`caps-status`,a===`compact`&&`caps-status-compact`,o===`chip`&&`caps-status-chip`,e),"data-tone":o===`chip`?i:void 0,"data-glyph":n,"data-motion":r,ref:l,children:[EG(n)?(0,X.jsx)(wG,{className:DG[i],glyph:n,progress:s}):(0,X.jsx)(bG,{className:DG[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),kG={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},AG=(0,J.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,X.jsx)(NT,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Q(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Q(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,kG[n]),children:t})})}),jG=(0,J.forwardRef)(function({className:e,label:t,...n},r){return(0,X.jsx)(uG,{...n,ref:r,className:Q(`parakeet-composer-model-key`,e),label:t,readout:(0,X.jsx)(JU,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),MG=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),NG=(0,J.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,X.jsx)(`div`,{...r,ref:i,className:Q(`caps-popover`,e),"data-side":n}):null}),PG=(0,J.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function FG({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,J.useId)(),f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,J.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,J.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,J.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{e.target instanceof Node&&!f.current?.contains(e.target)&&n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[g,n]),(0,X.jsxs)(MG,{...u,ref:f,className:Q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,X.jsxs)(NG,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,X.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,X.jsx)(OG,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,X.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,X.jsx)(AG,{"aria-label":`Close tray`,icon:(0,X.jsx)(cW,{"aria-hidden":`true`}),onClick:_})]}),(0,X.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,X.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,X.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,X.jsxs)(X.Fragment,{children:[e.tone?(0,X.jsx)(OG,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,X.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,X.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,X.jsxs)(J.Fragment,{children:[a?a(r):(0,X.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function IG({children:e,className:t,...n}){return(0,X.jsx)(`div`,{...n,className:Q(`caps-status-tray-list`,t),children:e})}function LG({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,X.jsxs)(`div`,{...a,className:Q(`caps-status-tray-item`,i),children:[e?(0,X.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,X.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,X.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,X.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,X.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}var RG=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function zG(e,t){return`${e}-${String(t)}`}function BG(e){switch(e.key){case`ArrowDown`:return`next`;case`ArrowUp`:return`previous`;case`Enter`:return e.shiftKey?null:`accept`;case`Tab`:return`accept`;case`Escape`:return`dismiss`;default:return null}}function VG(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?zG(e.listId,e.selected):void 0}}function HG({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,X.jsx)(NG,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,X.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,X.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,X.jsxs)(PG,{id:zG(r,t),active:t===n,"aria-disabled":e.disabled===!0||void 0,"data-disabled":e.disabled===!0,onMouseEnter:()=>{c(t)},onClick:()=>{l(t)},children:[e.media===void 0?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,X.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,X.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,X.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var UG={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},WG={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function GG({state:e}){let t=`caps-checkbox-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=_S();return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=oS(n.current),c=mA(s,{ease:`inCubic`,duration:160}),l=fT(n.current,{d:{to:UG[e],...o?fA:mA(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?fA:t?mA(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...mA(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:cS(s,120),...pA(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,X.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(xT,{id:`${t}-goo`,values:WG}),(0,X.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,X.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,X.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,X.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,X.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,X.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,X.jsx)(`path`,{ref:n,d:UG[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,X.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,X.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,X.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var KG=(0,J.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,J.useRef)(null),[d,f]=(0,J.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,J.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,J.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,J.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,X.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,X.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Q(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,X.jsx)(GG,{state:m}):n]})}),qG=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`input caps-input w-full`,e),ref:r})});(0,J.forwardRef)(function({leading:e,className:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,X.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,X.jsx)(qG,{...n,type:`search`,className:t,ref:r})]})});var JG=`data-glide-stand-in`;function YG(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function XG(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function ZG(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?QG(n,e):null},[e])}function QG(e,t){if(!fS(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?YG(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(JG);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=oS(e),u=YG(e,t),d=o&&a?YG(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(JG,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(JG,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([XG(d),XG(u)],{duration:r.normal,easing:dS(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function $G({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,J.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}function eK(e){let{className:t,defaultValue:n,emptyMessage:r=`No options`,getKey:i,getLabel:a,id:o,isDisabled:s=()=>!1,items:c,multiple:l,onClick:u,onKeyDown:d,renderItem:f,rootRef:p,value:m,...h}=e,g=(0,J.useId)(),_=o??g,v=(0,J.useRef)(null);(0,J.useImperativeHandle)(p,()=>v.current);let y=ZG(`[role="option"][data-active]`),b=(0,J.useCallback)(e=>{v.current=e,y(e)},[y]),x=l===!0,S=x?[]:null,[C,w]=(0,J.useState)(()=>n??S),T=tK(nK(m,C),x),E=$G({getKey:i,isDisabled:s,items:c}),{enabledItems:D}=E,O=c.find(e=>T.includes(i(e))),{activeKey:k,activeItem:A,setActiveKey:j}=E,M=A,N=m===void 0?void 0:JSON.stringify(x?[...new Set(T)].sort():T),P=(0,J.useRef)(N),F=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(F.current||k!==null)return;let e=O??D[0];e&&(F.current=!0,j(i(e)))},[k,D,O,i,j]),(0,J.useEffect)(()=>{if(N!==void 0&&N!==P.current){let e=c.find(e=>T.includes(i(e))&&!s(e));j(e?i(e):null)}P.current=N},[N,i,s,c,T]);let ee=t=>{if(!t||s(t))return;let n=i(t),r;if(r=x?T.includes(n)?T.filter(e=>e!==n):[...T,n]:[n],e.multiple)m===void 0&&w(r),e.onValueChange?.(r,c.filter(e=>r.includes(i(e))));else{let n=r[0]??null;m===void 0&&w(n),e.onValueChange?.(n,t)}},I=e=>{if(d?.(e),!e.defaultPrevented&&e.key!==`Escape`){if(e.key===`Enter`||e.key===` `){e.preventDefault(),ee(M);return}if(D.length!==0){if(e.key===`ArrowDown`)E.move(1);else if(e.key===`ArrowUp`)E.move(-1);else if(e.key===`Home`)E.move(-1,`start`);else if(e.key===`End`)E.move(1,`end`);else return;e.preventDefault()}}};return(0,X.jsx)(`div`,{...h,"aria-activedescendant":M?`${_}-option-${encodeURIComponent(i(M))}`:void 0,"aria-multiselectable":x?!0:void 0,className:Q(`max-h-72 w-full overflow-auto rounded-box border border-base-300 bg-base-100 p-xs shadow-lg focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,t),id:_,onClick:u,onKeyDown:I,ref:b,role:`listbox`,tabIndex:h.tabIndex??0,children:c.length===0?(0,X.jsx)(`div`,{className:`px-md py-sm text-sm text-base-content`,children:r}):c.map(e=>{let t=i(e),n=s(e),r=T.includes(t),o=M?i(M)===t:!1,c={active:o,disabled:n,selected:r};return(0,X.jsx)(`div`,{"aria-disabled":n||void 0,"aria-selected":r,"data-active":o&&!n||void 0,className:Q(`cursor-pointer rounded-field px-md py-sm text-sm outline-none`,o&&`bg-base-200`,r&&`font-medium`,n&&`cursor-not-allowed bg-base-200 text-base-content outline outline-1 outline-dashed outline-base-300`),id:`${_}-option-${encodeURIComponent(t)}`,onClick:r=>{if(n){r.preventDefault();return}j(t),ee(e)},role:`option`,children:f?.(e,o,c)??a(e)},t)})})}function tK(e,t){return t?Array.isArray(e)?e.slice():[]:e==null||Array.isArray(e)?[]:[e]}function nK(e,t){switch(e){case void 0:return t;default:return e}}function rK({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(()=>t);return[i&&e!==void 0?e:a,J.useCallback(e=>{i||o(e)},[])]}function iK(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=rK({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=jB(a,!0,!0),u=qE(),[d,f]=J.useState(),p=d===null?void 0:d??u,m=GT(e=>{let t=!a,n=fz(mz,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return J.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var aK=J.createContext(void 0);function oK(){let e=J.useContext(aK);if(e===void 0)throw Error(nE(15));return e}var sK=`data-open`,cK=`data-closed`,lK=qD,uK=`data-panel-open`,dK={[sK]:``},fK={[cK]:``},pK={open(e){return e?{[uK]:``}:null}},mK={open(e){return e?dK:fK},...ZD},hK=J.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=GT(o),d=iK({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=J.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=J.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=ME(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:mK});return(0,X.jsx)(aK.Provider,{value:p,children:m})}),gK={...pK,...ZD},_K=J.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=oK(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=lz({disabled:c,native:u});return ME(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:gK})}),vK={height:void 0,width:void 0};function yK(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=J.useRef(null),f=J.useRef(null),[p,m]=J.useState(vK),h=J.useRef(vK),g=J.useRef(!1),_=J.useRef(s),v=J.useRef(!1),[y,b]=J.useState(!1),x=J.useRef(null),S=aE(t,d),C=kz(s),w=PB(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=GT((e,t=!0)=>{t&&(h.current=e),m(e)}),j=GT(()=>{x.current?.(),x.current=null}),M=GT(e=>{j(),x.current=()=>{x.current=null,e()}}),N=GT(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});zk(()=>{!y||u===`starting`||b(!1)},[y,u]),J.useEffect(()=>()=>{N(),j()},[N,j]),zk(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&j();let t=xK(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=bK(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(bK(e)),b(!0);return}if(t===`css-transition`){let t=wK(e);if(A(bK(e)),!n)return t;let r=CK(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(bK(e));let r=CK(e,`animation-name`,`none`);if(!n){r();return}let i=CK(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){A(vK,!1),c(!1);return}A(bK(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=bK(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&CK(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),FB({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(vK,!1)}}),J.useEffect(()=>{if(s||!a||E!==`ending`)return;if(!d.current){c(!1),A(vK,!1);return}let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(vK,!1))}return t=Nz.request(()=>{w(n,e.signal)}),()=>{Nz.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),zk(()=>{let e=d.current;!e||!n||!T||e.setAttribute(`hidden`,`until-found`)},[T,n]),J.useEffect(function(){let e=d.current;if(!e)return;let t=$T.create(),n=-1,r=(r,i)=>{t.start(0,()=>{C.current||(n=Nz.request(()=>{C.current||(r&&(g.current=!1),i&&e.setAttribute(lK,``),e.setAttribute(`hidden`,`until-found`))}))})},i=oA(e,`beforematch`,t=>{let n=fz(pz,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(lK);e.removeAttribute(lK),l(!0),r(!0,i)});return()=>{t.clear(),Nz.cancel(n),i()}},[C,o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[lK]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function bK(e){return{height:e.scrollHeight,width:e.scrollWidth}}function xK(e,t){let n=iD(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&SK(n.animationDuration),i=SK(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function SK(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function CK(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function wK(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=Nz.request(n);return()=>{Nz.cancel(r),n()}}var TK=`--collapsible-panel-height`,EK=`--collapsible-panel-width`,DK=J.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=oK(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;zk(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=yK({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=_E(s,k),j=ME(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[TK]:S===void 0?`auto`:`${S}px`,[EK]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:mK});return E?j:null}),OK=ib(`caps-disclosure`,{variants:{tone:{neutral:``,error:`caps-disclosure-error`},size:{group:`caps-disclosure-group`,row:`caps-disclosure-row`}},defaultVariants:{tone:`neutral`,size:`group`}});function kK({open:e,onOpenChange:t,summary:n,leading:r,trailing:i,children:a,tone:o,size:s,className:c}){return(0,X.jsxs)(hK,{className:Q(OK({tone:o,size:s}),c),onOpenChange:t,open:e,children:[(0,X.jsxs)(_K,{className:`caps-disclosure-trigger`,children:[r===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-leading`,children:r}),(0,X.jsx)(`span`,{className:`caps-disclosure-summary`,children:n}),i===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-trailing`,children:i}),(0,X.jsx)(YU,{"aria-hidden":`true`,className:`caps-disclosure-chevron`,size:12})]}),(0,X.jsx)(DK,{className:`caps-disclosure-panel`,children:a})]})}var AK=(0,J.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,X.jsxs)(`label`,{...i,className:Q(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,X.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),jK=(0,J.forwardRef)(function({children:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:J.Children.map(e,e=>(0,J.isValidElement)(e)?(0,J.cloneElement)(e,{className:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),MK=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function NK(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,J.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=_S(),[c,l]=(0,J.useState)(e),u=(0,J.useRef)(!0);return e&&!c&&l(!0),(0,J.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!fS(n)){e||l(!1);return}let i=oS(n),a=`translateY(${String(i.distance)}px)`,c=dS(i,i.ease),d=n.getBoundingClientRect().height,f=NK(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:dS(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,X.jsx)(`div`,{...i,ref:o,className:Q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var PK=(0,J.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,X.jsx)(`div`,{...r,ref:i,className:Q(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,X.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,J.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=_S(),[c,l]=(0,J.useState)({key:e,content:n}),[u,d]=(0,J.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,J.useRef)(null);return(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!fS(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=oS(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:dS(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:dS(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:dS(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,X.jsx)(`div`,{...i,ref:o,className:Q(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function FK({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(PK,{...t,className:Q(`caps-field-error-reveal`,t.className),open:!!e,children:(0,X.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function IK({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,X.jsxs)(`footer`,{...a,className:Q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,X.jsx)(FK,{children:n}),(0,X.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,X.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,X.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var LK=(0,J.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,X.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Q(`caps-form`,n),"data-layout":r,ref:a,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),RK={2:`h2`,3:`h3`,4:`h4`},zK=(0,J.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,J.useId)(),l=RK[i];return(0,X.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Q(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,X.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,X.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,X.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,X.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),BK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,layout:i,legend:a,legendTitle:o,...s},c){let l=(0,J.useId)(),u=[n?`${l}-description`:s[`aria-describedby`],r?`${l}-error`:null].filter(Boolean).join(` `)||void 0;return(0,X.jsxs)(`fieldset`,{...s,"aria-describedby":u,"aria-invalid":r?!0:s[`aria-invalid`],className:Q(`caps-fieldset`,t),"data-layout":i,ref:c,children:[(0,X.jsx)(`legend`,{className:`caps-fieldset-legend`,title:o,children:a}),n?(0,X.jsx)(`p`,{className:`caps-fieldset-description`,id:`${l}-description`,children:n}):null,(0,X.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,X.jsx)(FK,{id:`${l}-error`,children:r})]})});function VK(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==MK&&t.push(e)}),t[0]??null}var HK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,J.useId)(),m=(0,J.isValidElement)(e)?e:null,h=m?.type===jK,g=h?VK(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,J.cloneElement)(m,void 0,J.Children.map(m.props.children,e=>e===g?(0,J.cloneElement)(g,w):e)):(0,J.cloneElement)(m,w):e,E=a?(0,X.jsx)(AK,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,X.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,X.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,X.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,X.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,X.jsxs)(`div`,{...d,className:Q(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,X.jsxs)(X.Fragment,{children:[O,T]}),(0,X.jsx)(FK,{id:y,children:r})]})});function UK(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var WK=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,GK=6,KK=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),qK=(0,J.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,J.useState)(n),[y,b]=(0,J.useState)(null),x=p===void 0?_:p,S=UK(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,J.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/GK),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,X.jsxs)(`span`,{className:Q(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,X.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,X.jsx)(`path`,{className:`caps-number-field-dial-track`,d:WK,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:WK,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,X.jsx)(eW,{"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,X.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=KK.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,X.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,X.jsx)(nW,{"aria-hidden":`true`})})]})});function JK({request:e,trailing:t}){let[n,r]=(0,J.useState)(!1),i=e=>e===void 0?null:(0,X.jsx)(Nx,{density:`compact`,children:e.map(e=>(0,X.jsxs)(Px,{className:`after:hidden`,children:[(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:e.label}),` `,(0,X.jsx)(`span`,{className:`break-words`,children:e.value})]},e.label))});return(0,X.jsxs)(X.Fragment,{children:[t===void 0?(0,X.jsx)(`p`,{className:`font-medium`,children:e.message}):(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:e.message}),t]}),e.summary===void 0?null:(0,X.jsx)(`p`,{className:`text-sm opacity-70`,children:e.summary}),i(e.facts),e.body===void 0?null:(0,X.jsxs)(`p`,{className:`line-clamp-3 whitespace-pre-line break-words`,children:[e.bodyLabel===void 0?null:(0,X.jsxs)(`span`,{className:`text-sm opacity-70`,children:[e.bodyLabel,` `]}),e.body]}),e.details===void 0&&e.body===void 0?null:(0,X.jsxs)(kK,{open:n,onOpenChange:r,summary:`Details`,children:[e.body===void 0?null:(0,X.jsx)(`p`,{className:`whitespace-pre-line break-words`,children:e.body}),i(e.details)]})]})}function YK({host:e,pending:t}){let[n,r]=(0,J.useState)(``),i=t.request;return i.type===`choice`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(JK,{request:i}),(0,X.jsx)(eK,{"aria-label":i.message,items:i.options,getKey:e=>e.value,getLabel:e=>e.label,onValueChange:n=>{n!==null&&e.answer(t.sequence,n)},renderItem:e=>(0,X.jsxs)(`span`,{className:`flex flex-col${e.destructive===!0?` text-error`:``}`,children:[(0,X.jsxs)(`span`,{children:[e.value===i.current?`● `:``,e.label]}),e.description===void 0?null:(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:e.description})]})})]}):i.type===`confirmation`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(JK,{request:i}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[(0,X.jsx)(NT,{autoFocus:i.destructive===!0,variant:`ghost`,onClick:()=>e.answer(t.sequence,!1),children:i.cancelLabel??`Cancel`}),(0,X.jsx)(NT,{variant:i.destructive===!0?`destructive`:`primary`,onClick:()=>e.answer(t.sequence,!0),children:i.confirmLabel??`Confirm`})]})]}):i.type===`decision`?null:(0,X.jsxs)(`form`,{className:`flex flex-col gap-sm`,onSubmit:r=>{r.preventDefault(),e.answer(t.sequence,n)},children:[i.summary===void 0&&i.facts===void 0&&i.body===void 0?null:(0,X.jsx)(JK,{request:i}),(0,X.jsx)(HK,{label:i.message,children:(0,X.jsx)(qG,{autoComplete:`off`,autoFocus:!0,placeholder:i.placeholder,type:i.secret===!0?`password`:`text`,value:n,onChange:e=>{r(e.target.value)}})}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(NT,{type:`submit`,children:`Continue`})})]})}function XK({host:e,onClose:t}){let n=(0,J.useSyncExternalStore)(e.subscribe,e.snapshot),r=n.status===`working`||n.status===`prompting`;return(0,X.jsxs)(`section`,{"aria-label":n.title,className:`flex flex-col gap-sm`,"data-status":n.status,children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:n.title}),n.handoff===void 0?null:(0,X.jsx)(yA,{density:`compact`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs p-sm`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:n.handoff.message??(n.handoff.code===void 0?`Continue in your browser`:`Open this page and enter the code`)}),(0,X.jsx)(`a`,{className:`link break-all font-mono`,href:n.handoff.url,rel:`noreferrer`,target:`_blank`,children:n.handoff.url}),n.handoff.code===void 0?null:(0,X.jsx)(`span`,{className:`font-mono text-2xl tracking-widest`,children:n.handoff.code})]})}),n.message===void 0||n.status===`failed`?null:(0,X.jsxs)(`p`,{className:`flex items-center gap-xs`,children:[(0,X.jsx)(OG,{tone:n.message.type===`success`?`success`:`info`,motion:n.message.type===`progress`&&r?`pulse`:`none`}),n.message.message]}),n.links.map(e=>(0,X.jsx)(`a`,{className:`link break-all`,href:e.url,rel:`noreferrer`,target:`_blank`,children:e.label??e.url},e.url)),n.prompt===void 0?null:(0,X.jsx)(YK,{host:e,pending:n.prompt},n.prompt.sequence),n.status===`failed`?(0,X.jsx)(Mx,{tone:`error`,title:`That did not work`,description:n.failure}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[r?(0,X.jsx)(NT,{variant:`ghost`,onClick:e.cancel,children:`Cancel`}):null,n.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(NT,{variant:`ghost`,onClick:()=>{e.cancel(),t?.()},children:`Close`}),n.retryable?(0,X.jsx)(NT,{onClick:e.retry,children:`Try again`}):null]}):null,n.status===`done`||n.status===`cancelled`?(0,X.jsx)(NT,{onClick:t,children:`Done`}):null]})]})}var ZK={question:`Question`,approval:`Approval`};function QK({item:e,position:t,total:n,onLater:r,takeFocus:i}){let a=$R(e,{position:t,total:n,later:r});return a.view===void 0?null:(0,X.jsx)($K,{view:a.view,dispatch:a.dispatch,onLater:a.later,takeFocus:i})}function $K({view:e,dispatch:t,onLater:n,takeFocus:r}){let i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=e.phase===`other`,s=(0,J.useRef)(!1);(0,J.useEffect)(()=>{r&&i.current?.focus()},[r]),(0,J.useEffect)(()=>{o?a.current?.focus():s.current&&document.activeElement===a.current&&i.current?.focus(),s.current=o},[o]);let c=e.rows,l=e.other,u=e.phase===`sending`,d=(e,t,n)=>t?(e.preventDefault(),n(),!0):!1,f=e=>{if(e.target instanceof HTMLInputElement||oG(e)||e.ctrlKey||e.metaKey||e.altKey)return;let{key:n}=e;d(e,n===`ArrowDown`,()=>{t({type:`move`,delta:1})})||d(e,n===`ArrowUp`,()=>{t({type:`move`,delta:-1})})||d(e,n===`Enter`,()=>{t({type:`enter`})})||d(e,n===` `,()=>{t({type:`toggle`})})||d(e,n===`Escape`,()=>{t({type:`escape`})})||d(e,/^[1-9]$/u.test(n),()=>{t({type:`pick`,number:Number(n)})})||d(e,n.length===1,()=>{t({type:`append`,text:n})})},p=e=>{if(oG(e))return;let{key:n}=e;d(e,n===`ArrowDown`,()=>{t({type:`move`,delta:1})})||d(e,n===`ArrowUp`,()=>{t({type:`move`,delta:-1})})||d(e,n===`Enter`,()=>{t({type:`enter`})})||d(e,n===`Escape`,()=>{t({type:`escape`})})},m=e=>(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none flex shrink-0`,children:(0,X.jsx)(KG,{checked:e.toggled,readOnly:!0,tabIndex:-1})}),h=t=>(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:t.destructive?`text-error`:void 0,children:e.multiple?t.caption:t.text}),t.description===void 0?null:(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:t.description})]}),g=t=>e.multiple?(0,X.jsxs)(`span`,{className:`flex items-start gap-xs`,children:[m(t),h(t)]}):h(t),_=c.find(e=>e.highlighted);return(0,X.jsxs)(`div`,{"aria-label":e.label,className:`parakeet-decision flex flex-col gap-xs p-sm`,"data-kind":e.kind,"data-phase":e.phase,role:`group`,children:[(0,X.jsx)(JK,{request:{message:e.title,summary:e.summary,facts:e.facts,body:e.body,bodyLabel:e.bodyLabel,details:e.details.length===0?void 0:e.details},trailing:(0,X.jsx)(`span`,{className:`shrink-0 text-sm opacity-70`,children:e.counter??ZK[e.kind]})}),(0,X.jsx)(eK,{"aria-label":e.title,className:`parakeet-decision-list`,getKey:e=>String(e.index),getLabel:e=>e.label,isDisabled:()=>u,items:c,rootRef:i,renderItem:n=>n.kind===`other`&&l!==void 0?(0,X.jsxs)(`span`,{className:`flex items-center gap-xs`,"data-highlight":n.highlighted||void 0,"data-row":`other`,children:[e.multiple?m(n):null,(0,X.jsx)(`span`,{className:`shrink-0`,children:e.multiple?n.caption:n.text}),n.highlighted||l.text!==``?(0,X.jsx)(qG,{"aria-label":l.label,autoComplete:`off`,disabled:u,maxLength:l.maxLength,onChange:e=>{t({type:`type`,text:e.target.value})},onKeyDown:p,placeholder:l.placeholder,ref:a,value:l.text}):null]}):(0,X.jsx)(`span`,{"data-highlight":n.highlighted||void 0,children:g(n)}),onKeyDown:f,...e.multiple?{multiple:!0,value:c.filter(e=>e.toggled).map(e=>String(e.index)),onValueChange:(e,n)=>{let r=c.find(e=>n.some(t=>t.index===e.index)!==e.toggled);r!==void 0&&(t({type:`pick`,number:r.index+1}),r.kind===`option`&&t({type:`toggle`}))}}:{value:_===void 0?null:String(_.index),onValueChange:(e,n)=>{n!==null&&t({type:`pick`,number:n.index+1})}}}),e.status===void 0?null:(0,X.jsx)(`p`,{className:e.status.tone===`error`?`text-sm text-error`:`text-sm opacity-70`,role:e.status.tone===`error`?`alert`:`status`,children:e.status.text}),(0,X.jsxs)(`div`,{className:`parakeet-decision-actions`,children:[(0,X.jsx)(uG,{label:`Later`,tone:`neutral`,onClick:n}),(0,X.jsx)(uG,{disabled:!e.canSend,label:`Send`,onClick:()=>{t({type:`enter`})},tone:`primary`})]})]})}function eq(e,t){if(t.length===0)return e;let n=new Set(t),r=[];for(let t=0;t<e.length;t+=1){let i=n.has(t),a=r.at(-1);a?.marked===i?a.text+=e.charAt(t):r.push({text:e.charAt(t),marked:i,start:t})}return r.map(e=>e.marked?(0,X.jsx)(`mark`,{className:`parakeet-slash-match`,children:e.text},e.start):(0,X.jsx)(`span`,{children:e.text},e.start))}function tq({slash:e,listId:t}){let{completion:n}=e;if(n.kind===`none`)return null;let r=n.kind===`commands`?n.items.map(e=>({key:e.command.commandId+e.label,label:eq(e.label,e.matches),detail:e.command.grammar===void 0?e.command.title:`${e.command.title} · ${e.command.grammar.hint}`,keys:e.command.keys.join(`, `),disabled:e.command.availability.status===`unavailable`})):n.items.map(e=>({key:e.label,label:eq(e.label,e.matches),detail:e.word.description??``,keys:``,disabled:!1}));return(0,X.jsx)(HG,{open:e.open,rows:r,selected:e.selected,listId:t,label:`Commands`,kind:n.kind,hint:n.kind===`arguments`?n.hint:void 0,onHighlight:e.highlight,onChoose:e.choose})}var nq=(0,J.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Q(`caps-composer`,n),children:[t===void 0?null:(0,X.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,X.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,X.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,X.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function rq({draft:e,hasAttachments:t=!1,busy:n,queueWhileBusy:r=!1,blocked:i=!1}){let a=!i&&(e.trim().length>0||t);return n&&(!r||!a)?`busy`:a?`ready`:`empty`}function iq({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,X.jsxs)(MG,{className:`parakeet-composer-anchor`,children:[a,(0,X.jsxs)(Lx,{...s,className:Q(`parakeet-composer-shell`,r),children:[(0,X.jsx)(nq,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,X.jsx)(FG,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,X.jsx)(uG,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,X.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,X.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,X.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}function aq(e,t){(0,J.useLayoutEffect)(()=>{let t=e.current;t&&(t.style.height=`auto`,t.style.height=`${String(t.scrollHeight)}px`)},[e,t])}var oq={connecting:{busy:!1,tone:`neutral`},cancelling:{busy:!0,tone:`warning`},error:{busy:!1,tone:`error`},idle:{busy:!1,tone:`neutral`},queued:{busy:!0,tone:`warning`},retrying:{busy:!0,tone:`warning`},sending:{busy:!0,tone:`success`},streaming:{busy:!0,tone:`success`},thinking:{busy:!0,tone:`warning`},disconnected:{busy:!1,tone:`neutral`}};function sq({placeholder:e,onChange:t,onSend:n,onAbort:r,slash:i,slashListId:a,textareaId:o,textareaRef:s,value:c,queuedRecall:l}){let u=(0,J.useRef)(c),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(-1);u.current=c;let h=l?.recallState,g=h?.kind===`recalling`;(0,J.useLayoutEffect)(()=>{if(h?.kind!==`restored`)return;m(-1);let e=s.current;e!==null&&e.setSelectionRange(e.value.length,e.value.length)},[h,s]),aq(s,c);let _=(0,J.useCallback)(()=>{let e=u.current.trim();!e&&(l?.images?.length??0)===0||(n(),e&&f(t=>t.at(-1)===e?t:[...t,e]),m(-1))},[n,l?.images?.length]),v=(0,J.useCallback)(e=>{if(!oG(e)&&!g){if(i?.open===!0){let t=BG(e);if(t===`next`?i.move(1):t===`previous`?i.move(-1):e.key===`Tab`?i.complete():t===`dismiss`&&i.dismiss()){e.preventDefault();return}}if(e.key===`Escape`){e.preventDefault(),r();return}if(l!==void 0&&e.key===`ArrowUp`&&!e.repeat&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&i?.open!==!0&&u.current===``&&(l.images?.length??0)===0&&document.activeElement===e.currentTarget){e.preventDefault();let n=e.currentTarget;l.recall().then(e=>{if(e!==`empty`||!n.isConnected||n.value!==``||s.current!==n||d.length===0)return;let r=p===-1?d.length-1:p-1,i=d[r];i!==void 0&&(m(r),t(i))});return}if(e.key===`Enter`&&!e.shiftKey&&!window.matchMedia(`(pointer: coarse)`).matches){e.preventDefault(),_();return}if(e.key===`ArrowUp`&&s.current?.selectionStart===0&&d.length>0&&(p===-1||p>0)){e.preventDefault();let n=p===-1?d.length-1:p-1;m(n);let r=d[n];r!==void 0&&t(r);return}if(e.key===`ArrowDown`&&p!==-1){e.preventDefault();let n=p+1;if(n>=d.length)m(-1),t(``);else{m(n);let e=d[n];e!==void 0&&t(e)}}}},[d,p,r,t,_,i,s,l,g]),y=i?.open===!0&&i.completion.kind!==`none`&&i.completion.items.length>0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:o,children:`Message`}),(0,X.jsx)(RG,{"aria-describedby":[i===void 0?void 0:`${o}-guidance`,l===void 0?void 0:`${o}-recall-guidance`].filter(e=>e!==void 0).join(` `)||void 0,"aria-busy":g,readOnly:g,...i===void 0?{}:VG({open:y,listId:a,selected:i.selected}),className:`font-sans text-base-content`,id:o,onChange:e=>{t(e.target.value),m(-1)},onKeyDown:v,placeholder:e??(i===void 0?`Ask agent...`:`Ask agent… (/ for commands)`),ref:s,rows:1,value:c}),l===void 0?null:(0,X.jsx)(`span`,{id:`${o}-recall-guidance`,className:`sr-only`,children:`Press Up on an empty composer to recall your newest queued message.`})]})}function cq(e,t){if(t.kind===`connecting`)return`connecting`;if(t.kind===`disconnected`)return`unavailable`;if(e===`sending`)return`sending prompt`;if(e===`queued`&&(t.kind===`idle`||t.kind===`waiting_for_you`||t.kind===`error`))return`prompt accepted`;switch(t.kind){case`waiting_for_you`:return`waiting for you`;case`responding`:return`writing`;case`running_tool`:return`running ${t.tool}`;case`retrying`:return`retrying ${String(t.attempt)}/${String(t.maxAttempts)}`;case`error`:return`failed`;case`queued`:return`queued`;case`cancelling`:return`cancelling`;case`compacting`:return`compacting`;case`thinking`:return`thinking`;case`idle`:return`idle`}}async function lq(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e of t)n+=String.fromCharCode(e);return{type:`image`,mimeType:e.type,data:btoa(n)}}var uq=[{alias:`thinking`,label:`Thinking level…`},{alias:`compact`,label:`Compact context`}];function dq({showFooter:e,statusChips:t,model:n,status:r,viewState:i,usage:a,context:o,slash:s,attach:c,send:l}){let[u,d]=(0,J.useState)(null);if(!e)return;let f=i.kind===`error`?`error`:oq[r].tone,p=cq(`idle`,i),m=i.kind===`waiting_for_you`||i.kind===`error`,h=n===void 0?void 0:iG(n),g=o===void 0?void 0:DA(o),_=a===void 0?void 0:`${HW(a.tokens)} · ${vG(a.cost)}`,v=uq.filter(({alias:e})=>s?.available(e)===!0);return{items:_===void 0&&g===void 0&&v.length===0&&h===void 0?[]:[{id:`settings`,label:(0,X.jsxs)(`span`,{className:`composer-settings-chip`,children:[(0,X.jsx)(iW,{"aria-hidden":`true`}),`Settings`]}),accessibleLabel:`Session settings`,title:`Settings`,content:(0,X.jsxs)(IG,{className:`composer-settings`,children:[h===void 0?null:(0,X.jsx)(LG,{primary:`Model`,secondary:h}),g===void 0?null:(0,X.jsx)(LG,{primary:`Context`,secondary:g,title:`Context used / model context`}),_===void 0?null:(0,X.jsx)(LG,{primary:`Usage`,secondary:_}),v.map(({alias:e,label:t})=>(0,X.jsx)(LG,{primary:t,actions:(0,X.jsx)(NT,{size:`xs`,variant:`ghost`,onClick:()=>{d(null),s?.runCommand(e)},children:`Open`})},e))]})}],openId:u,onOpenChange:d,action:l,controls:(0,X.jsxs)(X.Fragment,{children:[c,h===void 0?null:(0,X.jsx)(jG,{"aria-label":`Model: ${h}. Open settings`,"aria-haspopup":`dialog`,expanded:u===`settings`,label:h,onClick:()=>{d(e=>e===`settings`?null:`settings`)},title:`${h} · Settings`}),t?.map((e,t)=>(0,X.jsx)(`span`,{className:`composer-status-chip min-w-0 truncate`,title:e,children:e},t))]}),status:m?(0,X.jsx)(OG,{className:`parakeet-composer-status`,label:(0,X.jsx)(`span`,{className:`composer-attention-label`,children:p}),title:p,tone:f}):null,readout:_===void 0?void 0:(0,X.jsx)(`span`,{title:`Tokens · cost`,children:_})}}function fq({images:e,onRemove:t}){return(0,X.jsx)(`ul`,{"aria-label":`Attached images`,className:`composer-attachments`,children:e.map((e,n)=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`img`,{alt:`Attached image ${String(n+1)}`,className:`mask mask-squircle`,src:`data:${e.mimeType};base64,${e.data}`}),t===void 0?null:(0,X.jsx)(AG,{"aria-label":`Remove attached image ${String(n+1)}`,className:`composer-attachment-remove`,icon:(0,X.jsx)(cW,{}),onClick:()=>{t(n)},size:`xs`,variant:`outline`})]},n))})}var pq=(0,J.memo)(function({queuedRecall:e,onImagesChange:t,placeholder:n,showFooter:r=!0,statusChips:i,actionVariant:a=`primary`,draft:o,failure:s,failureCause:c,admissionError:l,model:u,onAbort:d,onChange:f,onRetry:p,onSend:m,status:h,viewState:g,textareaRef:_,usage:v,context:y,slash:b}){let x=(0,J.useId)(),S=`${x}-commands`,C=(0,J.useRef)(null),{busy:w}=oq[h],T=b===void 0?void 0:WL(b.awaiting,o),E=T?.key,D=(0,J.useRef)(void 0),O=(0,J.useRef)(!1);D.current!==E&&(D.current=E,O.current=E!==void 0&&document.activeElement===_.current);let k=O.current;(0,J.useEffect)(()=>{E===void 0&&k&&_.current?.focus()},[E,k,_]);let A=e?.images??[],j=e?.recallState.kind===`recalling`,M=rq({draft:o,hasAttachments:A.length>0,busy:w,queueWhileBusy:!0,blocked:j}),N=w?`Queue follow-up`:`Send message`,P=(0,X.jsx)(hG,{"aria-label":N,className:`composer-send-key`,disabled:M===`busy`&&(j||h===`queued`||h===`cancelling`),onClick:()=>{m(w?`followUp`:`steer`)},onStop:d,state:M,stopLabel:`Stop current turn`,title:M===`busy`?`Stop the current turn. Queued messages keep running in order.`:N,tone:a===`primary`?`primary`:`neutral`}),F=t===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{accept:`image/png,image/jpeg,image/gif,image/webp`,"aria-label":`Choose images to attach`,hidden:!0,multiple:!0,onChange:e=>{let n=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,Promise.all(n.map(lq)).then(e=>{t([...A,...e])})},ref:C,type:`file`}),(0,X.jsx)(uG,{"aria-label":`Attach images`,className:`composer-attach-key`,icon:(0,X.jsx)(nW,{}),label:null,onClick:()=>C.current?.click(),title:`Attach images`})]}),ee={status:h,viewState:g};ee.statusChips=i,u&&(ee.model=u),v&&(ee.usage=v),y&&(ee.context=y);let I=dq({...ee,showFooter:r,slash:b,attach:F,send:P});return(0,X.jsxs)(`div`,{className:`chat-composer not-prose flex-shrink-0`,children:[l===void 0?null:(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-error`,role:`alert`,children:l===`offline_queue_full`?`One prompt is already queued; it sends when the service is back.`:`Too many prompts are still awaiting admission. Try again shortly.`}),s===void 0?null:(0,X.jsx)(cG,{failure:s,cause:c,onRetry:p}),b?.interactions.notice===void 0?null:(0,X.jsx)(`div`,{className:`parakeet-command-notice px-3 py-1.5 text-xs`,"data-tone":b.interactions.notice.tone,role:b.interactions.notice.tone===`error`?`alert`:`status`,children:b.interactions.notice.message}),(0,X.jsx)(`div`,{"aria-live":`polite`,className:`sr-only`,children:T===void 0||b===void 0?``:`Agent ${T.kind} ${String(b.awaiting.position)} of ${String(b.awaiting.total)} needs your answer`}),(0,X.jsx)(iq,{"aria-label":`Message composer`,action:T===void 0&&I===void 0?P:void 0,menu:b===void 0?void 0:(0,X.jsx)(tq,{slash:b,listId:S}),attachments:T===void 0&&A.length>0?(0,X.jsx)(fq,{images:A,onRemove:t===void 0?void 0:e=>{t(A.filter((t,n)=>n!==e))}}):void 0,input:(0,X.jsxs)(X.Fragment,{children:[T===void 0||b===void 0?null:(0,X.jsx)(QK,{item:T,position:b.awaiting.position,total:b.awaiting.total,onLater:()=>{b.store.awaiting.later(T.key)},takeFocus:O.current},T.key),(0,X.jsx)(`div`,{hidden:T!==void 0,children:(0,X.jsx)(sq,{queuedRecall:e,placeholder:n,onChange:f,onAbort:d,onSend:()=>{m(w?`followUp`:`steer`)},slash:b,slashListId:S,textareaId:x,textareaRef:_,value:o})})]}),row:T===void 0?I:void 0}),b===void 0?null:(0,X.jsx)(`p`,{className:`sr-only`,id:`${x}-guidance`,children:LL(b.hints)})]})}),mq={attention:`text-warning`,running:`text-info`,error:`text-error`,settled:`text-success`,muted:`text-dim`};function hq({entryId:e,rows:t,actions:n,onOpen:r}){let i=ZF(),{inspection:a}=(0,J.useSyncExternalStore)(i.subscribe,i.snapshot,i.snapshot);return t.length===0?null:(0,X.jsx)(`div`,{className:`px-3 text-xs text-base-content`,"data-client-entry":e,children:t.map(t=>{let o=t.open===void 0&&t.inspection===void 0&&t.actions?.length===1&&t.actions[0]?.awaiting!==void 0?t.actions[0]:void 0;if(o!==void 0){let r=n.state.get(o);return(0,X.jsxs)(`div`,{"data-client-row":t.id,children:[(0,X.jsxs)(NT,{size:`xs`,variant:`ghost`,className:`-mx-xs flex w-[calc(100%+2*var(--spacing-xs))] justify-start gap-2 px-xs font-normal`,disabled:!n.enabled||r?.pending===!0,loading:r?.pending===!0,onClick:()=>{n.execute(e,o)},children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-client-row-dot":``,className:`w-3 shrink-0 text-center ${t.tone===void 0?``:mq[t.tone]}`,children:t.tone===void 0?``:`●`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-start ${t.tone===void 0?``:mq[t.tone]}`,children:[t.title,t.detail===void 0?null:(0,X.jsxs)(`span`,{className:`text-dim`,children:[` · `,t.detail]})]}),(0,X.jsx)(`span`,{className:`shrink-0 text-dim`,"data-client-row-action":``,children:o.label})]}),r?.error===void 0?null:(0,X.jsx)(`p`,{className:`text-error`,role:`alert`,children:r.error})]},t.id)}return(0,X.jsxs)(`div`,{"data-client-row":t.id,className:`py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-client-row-dot":``,className:`w-3 shrink-0 text-center leading-4 ${t.tone===void 0?``:mq[t.tone]}`,children:t.tone===void 0?``:`●`}),(0,X.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`summary`,{className:`cursor-pointer break-words leading-4 ${t.tone===void 0?``:mq[t.tone]}`,children:[t.title,t.inspection===void 0||t.detail===void 0?null:` · ${t.detail}`]}),t.detail===void 0?null:(0,X.jsx)(`p`,{className:`max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words pb-2`,children:t.detail})]}),t.open===void 0?null:(0,X.jsx)(NT,{size:`xs`,variant:`outline`,disabled:r===void 0,onClick:()=>{t.open!==void 0&&r?.(t.open)},children:`Open`}),t.actions?.map(t=>{let r=n.state.get(t);return(0,X.jsx)(NT,{size:`xs`,variant:`outline`,className:`shrink-0`,disabled:!n.enabled||r?.pending===!0,loading:r?.pending===!0,onClick:()=>{n.execute(e,t)},children:t.label},t.id)})]}),t.inspection!==void 0&&a?.entryId===e&&a.rowId===t.id?(0,X.jsxs)(`section`,{"aria-label":t.title,"data-client-inspection":t.id,children:[(0,X.jsx)(Fx,{aside:(0,X.jsx)(NT,{size:`xs`,variant:`ghost`,onClick:()=>{i.inspect(void 0)},children:`Close`}),children:t.title}),(0,X.jsx)(Nx,{density:`compact`,tabIndex:0,className:`max-h-64 overflow-y-auto overscroll-contain`,children:t.inspection.rows.map(e=>(0,X.jsxs)(Px,{children:[(0,X.jsx)(OG,{glyph:`dot`,size:`compact`,tone:e.tone===`settled`?`success`:e.tone===`running`?`info`:e.tone===`error`?`error`:e.tone===`attention`?`warning`:`neutral`,label:e.title}),e.detail===void 0?null:(0,X.jsx)(`span`,{children:e.detail})]},e.id))})]}):null,t.actions?.map(e=>{let t=n.state.get(e)?.error;return t===void 0?null:(0,X.jsx)(`p`,{className:`text-error`,role:`alert`,children:t},e.id)})]},t.id)})})}var gq={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},_q=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,vq=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function yq({transform:e,fill:t=_q}){return(0,X.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function bq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(yq,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(yq,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(yq,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function xq(){return(0,X.jsxs)(`g`,{style:{fill:gq.blue},children:[(0,X.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,X.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,X.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,X.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function Sq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,X.jsx)(`path`,{style:{fill:gq.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function Cq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function wq({fill:e}){return(0,X.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function Tq({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?vq:gq.ink},children:[(0,X.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,X.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function Eq(){return(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function Dq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,X.jsx)(`path`,{style:{fill:gq.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function Oq(){return(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function kq({transform:e}){return(0,X.jsx)(`path`,{style:{fill:gq.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function Aq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:_q},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,X.jsx)(`path`,{style:{fill:gq.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function jq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:_q},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,X.jsx)(`path`,{style:{fill:gq.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,X.jsx)(`path`,{style:{fill:gq.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function Mq(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,X.jsx)(`path`,{style:{fill:gq.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,X.jsxs)(`g`,{style:{fill:gq.cream},children:[(0,X.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,X.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,X.jsxs)(`g`,{style:{fill:gq.ink},transform:`rotate(-11 470 411)`,children:[(0,X.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function Nq(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:gq.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,X.jsxs)(`g`,{style:{fill:gq.coral},children:[(0,X.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,X.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,X.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,X.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,X.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,X.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,X.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,X.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function Pq(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:Fq,blue:Iq,mint:Lq,grape:Rq,yellow:zq,cream:Bq,ink:Vq}=gq,Hq={bonsai:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,X.jsx)(`path`,{fill:Lq,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:zq,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:zq,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,X.jsx)(`path`,{fill:Fq,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,X.jsx)(`rect`,{fill:Fq,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,X.jsx)(Mq,{}),prints:(0,X.jsx)(Nq,{}),inkcap:(0,X.jsx)(Pq,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Fq},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:Iq},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:zq},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(Aq,{}),generateMedia:(0,X.jsx)(jq,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:zq,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:Bq,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:Iq,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:Fq,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,X.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,X.jsx)(`rect`,{fill:Iq,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:Iq,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:Bq,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:Fq,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:Fq,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,X.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,X.jsx)(Sq,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:Iq,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(Tq,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:Iq},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:Bq},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,X.jsx)(`path`,{style:{fill:Fq},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:Fq},children:[(0,X.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,X.jsx)(`path`,{style:{stroke:Iq},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,X.jsx)(Cq,{})}),(0,X.jsx)(yq,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(yq,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,X.jsx)(xq,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(Sq,{})}),(0,X.jsx)(bq,{})]}),readConversations:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,X.jsx)(wq,{fill:Iq})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(Sq,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:_q},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,X.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,X.jsx)(Tq,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:Fq},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,X.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,X.jsx)(Tq,{})}),(0,X.jsx)(`path`,{style:{fill:Iq},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(Tq,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:_q},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,X.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,X.jsx)(Tq,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:Lq},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,X.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,X.jsx)(Tq,{})}),(0,X.jsx)(yq,{fill:zq,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,X.jsx)(wq,{fill:Fq})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(Eq,{})}),(0,X.jsx)(yq,{fill:Lq,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(yq,{fill:Lq,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Dq,{}),(0,X.jsx)(Oq,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:Iq},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:Bq},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),connected:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Iq},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Fq},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:zq},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{style:{fill:Lq},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:zq},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:Rq},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:_q},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Lq},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Vq},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:_q},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`rect`,{style:{fill:Iq},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:Lq},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:Rq},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:Fq},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Fq},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:Fq},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:Bq},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Fq},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Bq},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`g`,{fill:zq,children:[(0,X.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,X.jsx)(kq,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,X.jsx)(kq,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,X.jsx)(kq,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,X.jsx)(kq,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,X.jsx)(kq,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`31.9`,cy:`18.8`,r:`4`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`32`,cy:`32.3`,r:`4`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:Iq,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,X.jsx)(`ellipse`,{fill:Vq,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,X.jsx)(`path`,{fill:Vq,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,X.jsx)(`ellipse`,{fill:zq,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:Rq,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,X.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,X.jsx)(`path`,{fill:Rq,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Bq,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,X.jsx)(`path`,{fill:zq,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,X.jsx)(`path`,{fill:Iq,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,X.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,X.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,X.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,X.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,X.jsx)(`circle`,{fill:Fq,cx:`21.7`,cy:`26.6`,r:`1`}),(0,X.jsx)(`circle`,{fill:zq,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,X.jsxs)(`g`,{fill:Lq,children:[(0,X.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,X.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5L12 41Z`}),(0,X.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,X.jsx)(`ellipse`,{fill:Lq,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,X.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,X.jsx)(`path`,{fill:Fq,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Fq,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,X.jsx)(`rect`,{fill:Iq,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,X.jsx)(`rect`,{fill:Lq,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,X.jsx)(`rect`,{fill:zq,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:Iq,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Fq,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,X.jsx)(`ellipse`,{fill:Iq,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Fq,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,X.jsx)(`path`,{fill:Bq,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,X.jsx)(`circle`,{fill:zq,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Lq,cx:`32`,cy:`34.9`,r:`14.5`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:Bq,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,X.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:`none`,stroke:zq,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`32`,cy:`32`,r:`21.1`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:Bq,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,X.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`circle`,{fill:Iq,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,X.jsx)(`path`,{fill:Iq,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,X.jsx)(`path`,{fill:Fq,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,X.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:zq,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,X.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,X.jsx)(`path`,{fill:zq,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,X.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,X.jsx)(`path`,{fill:Fq,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,X.jsx)(yq,{fill:zq,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Bq,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,X.jsx)(`path`,{fill:Fq,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,X.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,X.jsxs)(`g`,{fill:Iq,children:[(0,X.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,X.jsxs)(`g`,{fill:Lq,children:[(0,X.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsxs)(`g`,{fill:Rq,children:[(0,X.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsx)(`circle`,{fill:zq,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Vq,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,X.jsx)(`circle`,{fill:Vq,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),fungi:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:Bq,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,X.jsx)(`path`,{fill:Fq,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,X.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,X.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,X.jsxs)(`g`,{fill:Vq,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,X.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,X.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,X.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function Uq({name:e,size:t}){return(0,X.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:Hq[e]})}function Wq({children:e,...t}){return(0,J.createElement)(J.Fragment,null,Gq(e,t))}function Gq(e,t={}){return(typeof e==`string`?MR(e,t):e).children.map((e,n)=>Kq(e,t,`b:${n}`))}function Kq(e,t={},n){switch(e.type){case`heading`:return rJ(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Jq(e.children,t),aJ(e.id,t));case`paragraph`:return rJ(t,`p`,{key:n},Jq(e.children,t));case`code`:return Yq(e,t,n);case`list`:return rJ(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>rJ(t,`li`,{key:r},Xq(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return rJ(t,`blockquote`,{key:n},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`)));case`table`:return rJ(t,`table`,{key:n},rJ(t,`thead`,null,rJ(t,`tr`,null,e.header.map((n,r)=>Qq(`th`,n,e.align[r],t,r)))),e.rows.length?rJ(t,`tbody`,null,e.rows.map((n,r)=>rJ(t,`tr`,{key:r},n.map((n,r)=>Qq(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return $q(e.items,t,n);case`thematicBreak`:return rJ(t,`hr`,{key:n});case`html`:return t.allowHtml?rJ(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):rJ(t,`p`,{key:n},e.value);case`callout`:return rJ(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},rJ(t,`p`,{className:`markdown-alert-title`},e.title),rJ(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`))));case`component`:return iJ(e,t,n)}}function qq(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return rJ(t,`code`,{key:n},e.value);case`strong`:return rJ(t,`strong`,{key:n},Jq(e.children,t));case`emphasis`:return rJ(t,`em`,{key:n},Jq(e.children,t));case`strike`:return rJ(t,`del`,{key:n},Jq(e.children,t));case`footnoteReference`:return rJ(t,`sup`,{key:n},rJ(t,`a`,{id:`user-content-fnref-${nJ(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return rJ(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Jq(e.children,t));case`image`:return rJ(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return rJ(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?rJ(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Jq(e,t){return e.map((e,n)=>qq(e,t,`i:${n}`))}function Yq(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=rJ(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},rJ(t,`code`,{...a,...s},o));return e.title?rJ(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},rJ(t,`figcaption`,null,e.title),c):rJ(t,J.Fragment,{key:n},c)}function Xq(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[rJ(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...Jq(a.children,r)];return[...n?[rJ(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>Zq(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>Zq(e,n,r,`${i}:${t}`))]}function Zq(e,t,n,r){return!t&&e.type===`paragraph`?Jq(e.children,n):[Kq(e,n,r)]}function Qq(e,t,n,r,i){return rJ(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Jq(t.children,r))}function $q(e,t,n){return rJ(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},rJ(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,aJ(`footnote-label`,t)),rJ(t,`ol`,null,e.map(e=>rJ(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},eJ(e,t)))))}function eJ(e,t){let n=e.children.length-1,r=tJ(e,t);return n<0?[rJ(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?rJ(t,`p`,{key:i},Jq(e.children,t),r):Kq(e,t,`${i}`))}function tJ(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=r===1?e.id:`${e.id}-${r}`,a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,rJ(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function nJ(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function rJ(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,J.createElement)(i,n,...r)}function iJ(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),rJ(t,r,{key:n,...i},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`)))}function aJ(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return rJ(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function oJ(e){return e}function sJ({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=dJ(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(dJ(n),t)}let i=dJ(e);function a(e){return r.get(dJ(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:fJ(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(dJ(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?pJ(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=lJ(cJ(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${wJ(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${wJ(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function cJ(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(hJ),a=r.filter(gJ);if(!(t.lineNumbers||a.length))return mJ(e,0,n.length,i);let o=[],s=_J(n);for(let t=0;t<s.length;t++){let r=t+1,c=s[t],l=s[t+1]??n.length,u=l>c&&n[l-1]===`
152
+ `),n,oR()).parse()})}for(let e of r){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:r}}function LR(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function RR(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function zR(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function BR(e){return e.match(/^ */)?.[0].length??0}function VR(e,t){let n=RR(e);return/^ {0,3}(`{3,}|~{3,})/.test(e)||/^ {0,3}#{1,6}(?:\s+|$)/.test(e)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)||/^ {0,3}>\s?/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&HR(e,t)}function HR(e,t){if(!e.includes(`|`))return!1;let n=UR(t);return n.length===UR(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function UR(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return n.push(r.trim()),n}function WR(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function GR(e,t){return{type:`tableCell`,children:uR(e,t)}}function KR(e){return[...e.value.panel.flatMap(e=>e.actions??[]),...e.value.timeline.cells.flatMap(e=>e.rows.flatMap(e=>e.actions??[])),...e.value.waiting===null?[]:[e.value.waiting.cancel]]}function qR(e){let t=new AbortController,n=()=>t.signal.aborted,r=new Set,i=new Map,a=new Map,o=(e,t)=>JSON.stringify([e,t.id,t.input??{}]),s=()=>{if(n())return;let t=new Map,s=new Set;for(let n of e.contributions())for(let e of KR(n)){let r=o(n.entryId,e);s.add(r);let i=a.get(r);i!==void 0&&t.set(e,i)}for(let[e,t]of a)!s.has(e)&&!t.pending&&a.delete(e);i=t;for(let e of r)e()},c=(e,t)=>{n()||(a.set(e,t),s())};return{snapshot:()=>i,refresh:s,subscribe:e=>(r.add(e),()=>{r.delete(e)}),execute:async(r,i,s=!1)=>{let l=e.contributions().find(e=>e.entryId===r);if(n()||!e.online()||l===void 0||!KR(l).includes(i)||s&&l.value.waiting?.cancel!==i)return;if(i.awaiting!==void 0){e.interactions.awaiting.focus();return}let u=o(r,i);if(a.get(u)?.pending)return;c(u,{pending:!0});let d;try{let n={origin:`menu`,signal:t.signal};i.input!==void 0&&(n={...n,arguments:i.input}),d=await e.commands.execute({namespace:r,id:i.id},n)}catch(t){if(SN(`client row command`,t),n())return;let r=t instanceof Error?t:Error(`Client row command failed`,{cause:t});c(u,{pending:!1,error:r.message}),e.interactions.report({tone:`error`,message:r.message});return}if(n())return;let f=d.status===`handled`?void 0:d.status===`failed`?d.error.message:d.status===`unavailable`?d.reason:`Client row command ${d.status}`;c(u,f===void 0?{pending:!1}:{pending:!1,error:f}),f!==void 0&&e.interactions.report({tone:`error`,message:f})},dispose:()=>{t.abort(),i=new Map,a.clear(),r.clear()}}}var JR=new Map,YR=()=>JR,XR=()=>()=>void 0;function ZR(e){let t=XF(),{observation:n}=YF(),r=ZF(),i=qF(),[a,o]=(0,J.useState)(),s=(0,J.useRef)({contributions:t,observation:n});return s.current={contributions:t,observation:n},(0,J.useEffect)(()=>{let t=qR({commands:e,contributions:()=>s.current.contributions,online:()=>s.current.observation.status===`live`,interactions:r});return o(t),()=>{t.dispose()}},[e,r,i]),(0,J.useEffect)(()=>{a?.refresh()},[a,t]),{state:(0,J.useSyncExternalStore)(a?.subscribe??XR,a?.snapshot??YR,a?.snapshot??YR),enabled:a!==void 0&&n.status===`live`,execute:(e,t,n=!1)=>a?.execute(e,t,n)??Promise.resolve()}}function QR(e,t){return t.prompt===void 0?t.status===`failed`?{...e,phase:`refused`,refusal:t.failure??`Something went wrong.`}:{...e,phase:`sending`}:e}function $R(e,t){let{host:n}=e,r=(0,J.useSyncExternalStore)(n.subscribe,n.snapshot),i=(0,J.useRef)(),a=r.prompt;a?.request.type===`decision`&&(i.current={sequence:a.sequence,prompt:a.request});let[,o]=(0,J.useState)(),s=(0,J.useRef)(),c=i.current,l=()=>c!==void 0&&s.current?.sequence===c.sequence?s.current.state:GL(),u=e=>{c!==void 0&&(s.current={sequence:c.sequence,state:e},o(s.current))};return{view:c===void 0?void 0:XL(QR(l(),r),c.prompt,{kind:e.kind,position:t.position,total:t.total}),later:t.later,dispatch:e=>{if(c===void 0)return;let r=n.snapshot();if(r.prompt===void 0&&r.status===`failed`){e.type===`enter`?n.retry():e.type===`escape`&&t.later();return}let i=JL(QR(l(),r),e,c.prompt);u(i.state);let a=i.effect;if(a?.type===`later`)t.later();else if(a?.type===`answer`){let e={selected:a.selected};a.text!==void 0&&(e.text=a.text),n.answer(c.sequence,e)||u(JL(i.state,{type:`refused`,message:`That answer was not accepted. Choose again.`},c.prompt).state)}}}}function ez(e){let t=new Map;for(let n of e){let e=t.get(n.entryId);e===void 0?t.set(n.entryId,[n]):e.push(n)}for(let e of t.values())e.sort((e,t)=>e.cell.sequence-t.cell.sequence);let n=[];for(;t.size>0;){let e=[...t.values()].flatMap(e=>e[0]===void 0?[]:[e[0]]);e.sort((e,t)=>e.cell.at-t.cell.at||(e.entryId<t.entryId?-1:+(e.entryId>t.entryId))||e.cell.sequence-t.cell.sequence);let r=e[0];if(r===void 0)break;n.push(r);let i=t.get(r.entryId);i?.shift(),i?.length===0&&t.delete(r.entryId)}return n}function tz(e,t,n=new Map){let r=new Map,i=[],a=[];for(let{entryId:o,value:s}of e)for(let e of s.timeline.cells){let s={entryId:o,cell:e};if(e.afterSequence===void 0&&e.commandId===null){a.push(s);continue}let c=e.afterSequence===void 0?e.commandId===null?void 0:t.get(e.commandId):n.get(e.afterSequence);if(c===void 0)continue;if(c===null){i.push(s);continue}let l=r.get(c);l===void 0?r.set(c,[s]):l.push(s)}return{before:ez(i),after:new Map([...r].map(([e,t])=>[e,ez(t)])),unanchored:ez(a),omitted:e.flatMap(({entryId:e,value:t})=>t.timeline.omitted===0?[]:[{entryId:e,count:t.timeline.omitted}])}}var nz=J.createContext(void 0);function rz(e){let t=J.useContext(nz);if(!e&&t===void 0)throw Error(nE(27));return t}var iz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=rz(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ME(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:dO,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),az=J.createContext(void 0);function oz(e=!1){let t=J.useContext(az);if(t===void 0&&!e)throw Error(nE(16));return t}function sz(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:J.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function cz(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(iD(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function lz(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=oz(!0),c=a??s!==void 0,{props:l}=sz({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;uz(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return zk(u,[u]),{getButtonProps:J.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return yE({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kE(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=uz(r),s=!i&&dz(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),cz(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),cz(r,e)))},onKeyUp(e){if(!t){if(kE(e),a?.(e),e.target===e.currentTarget&&i&&c&&uz(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),cz(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:GT(e=>{o.current=e,u()})}}function uz(e){return cD(e)&&e.tagName===`BUTTON`}function dz(e){return cD(e)&&e.tagName===`A`&&!!e.href}function fz(e,t,n,r){let i=!1,a=!1,o=r??XT;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var pz=`none`,mz=`trigger-press`,hz=`trigger-hover`,gz=`outside-press`,_z=`close-press`,vz=`focus-out`,yz=`escape-key`,bz=`imperative-action`,xz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=rz(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=lz({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,fz(_z,e.nativeEvent))}return ME(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Sz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=rz(),c=qE(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),ME(`p`,e,{ref:t,props:[{id:c},o]})});function Cz(e,t){return t!=null&&!EO(t)?0:typeof e==`function`?e():e}function wz(e,t,n){let r=Cz(e,n);return typeof r==`number`?r:r?.[t]}function Tz(e){return typeof e==`function`?e():e}function Ez(e,t){return t||e===`click`||e===`mousedown`}function Dz(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Oz(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function kz(e){let t=HT(Az,e).current;return t.next=e,zk(t.effect),t}function Az(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var jz=null;globalThis.requestAnimationFrame;var Mz=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Nz=class e{static create(){return new e}static request(e){return Mz.request(e)}static cancel(e){return Mz.cancel(e)}currentId=jz;request(e){this.cancel(),this.currentId=Mz.request(()=>{this.currentId=jz,e()})}cancel=()=>{this.currentId!==jz&&(Mz.cancel(this.currentId),this.currentId=jz)};disposeEffect=()=>this.cancel};function Pz(){let e=HT(Nz.create).current;return ZT(e.disposeEffect),e}var Fz={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Iz={...Fz,position:`fixed`,margin:0,top:0,left:0};({...Fz});var Lz=J.forwardRef(function(e,t){let[n,r]=J.useState();zk(()=>{zD&&RD&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:Iz,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function Rz(e){return`data-base-ui-${e}`}var zz=0;function Bz(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(zz);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),JT;let o=requestAnimationFrame(a);return zz=o,()=>{zz===o&&(cancelAnimationFrame(o),zz=0)}}var Vz=`data-base-ui-inert`,Hz=new WeakMap,Uz=new WeakSet,Wz=new WeakMap,Gz=0;function Kz(e){return e?lD(e)?e.host:Kz(e.parentNode):null}var qz=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Kz(t);return e.contains(n)?n:null}).filter(e=>e!=null),Jz=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Yz=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{rD(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Xz(e,t,n,{mark:r=!0}){let i=qz(t,e),a=r?Yz(t,Jz(i),new Set(i)):[],o=[],s=[];if(n){let e=qz(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);Yz(t,Jz(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(Hz.get(e)||0)+1;Hz.set(e,r),o.push(e),r===1&&n&&Uz.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(Wz.get(e)||0)+1;Wz.set(e,t),s.push(e),t===1&&e.setAttribute(Vz,``)}),Gz+=1,()=>{o.forEach(e=>{let t=(Hz.get(e)||0)-1;Hz.set(e,t),t||(Uz.has(e)||e.removeAttribute(`aria-hidden`),Uz.delete(e))}),r&&s.forEach(e=>{let t=(Wz.get(e)||0)-1;Wz.set(e,t),t||e.removeAttribute(Vz)}),--Gz,Gz||(Hz=new WeakMap,Uz=new WeakSet,Wz=new WeakMap)}}function Zz(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=rk(e[0]).body;return Xz(e,i,n,{mark:r})}var Qz={style:{transition:`none`}},$z=`data-base-ui-click-trigger`,eB={fallbackAxisSide:`end`},tB={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},nB=J.createContext(null),rB=()=>J.useContext(nB),iB=Rz(`portal`);function aB(e={}){let{ref:t,container:n,componentProps:r=XT,elementProps:i}=e,a=KE(),o=rB()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=GT(e=>{e!==null&&u(e)}),f=J.useRef(null);zk(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(oD(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=ME(`div`,r,{ref:[t,d],props:[{id:a,[iB]:``},i]}),m=s&&p?QF.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var oB=J.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=aB({container:o,ref:t,componentProps:e,elementProps:c}),f=J.useRef(null),p=J.useRef(null),m=J.useRef(null),h=J.useRef(null),[g,_]=J.useState(null),v=J.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;J.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&wk(e)&&(e.type===`focusin`?v.current&&=(Ek(l),!1):(Tk(l),v.current=!0))}return Oz(oA(l,`focusin`,e,!0),oA(l,`focusout`,e,!0))},[l,y]),zk(()=>{!l||b!==!0||!v.current||(Ek(l),v.current=!1)},[b,l]);let S=J.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,X.jsxs)(J.Fragment,{children:[d,(0,X.jsxs)(nB.Provider,{value:S,children:[x&&l&&(0,X.jsx)(Lz,{"data-type":`outside`,ref:f,onFocus:e=>{wk(e,l)?m.current?.focus():Sk(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:tB}),l&&QF.createPortal(a,l),x&&l&&(0,X.jsx)(Lz,{"data-type":`outside`,ref:p,onFocus:e=>{wk(e,l)?h.current?.focus():(xk(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,fz(`focus-out`,e.nativeEvent)))}})]})]})});function sB(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var cB=class{nodesRef={current:[]};events=sB();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},lB=J.createContext(null),uB=J.createContext(null),dB=()=>J.useContext(lB)?.id||null,fB=e=>{let t=J.useContext(uB);return e??t};function pB(e){let t=KE(),n=fB(e),r=dB();return zk(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function mB(e){let{children:t,id:n}=e,r=dB();return(0,X.jsx)(lB.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function hB(e){let{children:t,externalTree:n}=e,r=HT(()=>n??new cB).current;return(0,X.jsx)(uB.Provider,{value:r,children:t})}function gB(e){return e==null?e:`current`in e?e.current:e}function _B(e,t){let n=iD(WD(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(wO(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var vB=20,yB=[];function bB(){yB=yB.filter(e=>e.deref()?.isConnected)}function xB(e){bB(),e&&rD(e)!==`body`&&(yB.push(new WeakRef(e)),yB.length>vB&&(yB=yB.slice(-20)))}function SB(){return bB(),yB[yB.length-1]?.deref()}function CB(e){return e?_k(e)?e:yk(e)[0]||e:null}function wB(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=vk(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return _k(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function TB(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=GT(()=>b.current.floatingContext?.nodeId),S=i===!1,C=vO(_)&&S,w=kz(i),T=kz(a),E=kz(o),D=kz(u),O=kz(g),k=fB(m),A=rB(),j=J.useRef(!1),M=J.useRef(!1),N=J.useRef(!1),P=J.useRef(null),F=J.useRef(``),ee=J.useRef(``),I=J.useRef(null),te=J.useRef(null),ne=aE(I,p,A?.beforeInsideRef),re=aE(te,A?.afterInsideRef),ie=eE(),L=eE(),ae=Pz(),oe=A!=null,R=yO(v),se=GT((e=R)=>e?yk(e):[]),ce=GT(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&HD(R,VD(rk(R)))&&se().length===0&&!C&&SO(e)}return oA(rk(R),`keydown`,e)},[r,R,c,C,se]),J.useEffect(()=>{if(r||!g)return;let e=rk(R);function t(){N.current=!1}function n(e){let t=WD(e),n=ce(),r=HD(v,t)||HD(_,t)||HD(A?.portalNode,t)||n.some(e=>e===t||HD(e,t));N.current=!r,ee.current=e.pointerType||`keyboard`,UD(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,L.start(0,()=>{M.current=!1}))}function i(){ee.current=`keyboard`}return Oz(oA(e,`pointerdown`,n,!0),oA(e,`pointerup`,t,!0),oA(e,`pointercancel`,t,!0),oA(e,`keydown`,i,!0),t)},[r,v,_,R,g,A,L,ce]),J.useEffect(()=>{if(r||!l)return;let e=rk(R);function n(){M.current=!0,L.start(0,()=>{M.current=!1})}function i(e){let t=WD(e);_k(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=WD(n);c&&r==null&&a!=null&&HD(v,a)&&xB(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ce(),p=r?.hasAttribute(Rz(`focus-guard`))&&[I.current,te.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,gB(f),gB(d)].includes(r),m=!(HD(_,r)||HD(v,r)||HD(r,v)||HD(A?.portalNode,r)||u.some(e=>e===r||HD(e,r))||l.hasMatchingElement(e=>HD(e,r))||p||k&&(bO(k.nodesRef.current,o).find(e=>HD(e.context?.elements.floating,r)||HD(e.context?.elements.domReference,r))||xO(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,yO(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&R&&wB(R),s&&i!==_&&!nk(a)&&VD(e)===e.body){if(cD(R)&&(R.focus(),s===`popup`)){ae.request(()=>{R.focus()});return}let e=se(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||R;cD(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==SB())&&(j.current=!0,t.setOpen(!1,fz(vz,n)))})}function o(){N.current||(b.current.insideReactTree=!0,ie.start(0,()=>{b.current.insideReactTree=!1}))}let u=cD(_)?_:null;if(!(!v&&!u))return Oz(u&&oA(u,`focusout`,a),u&&oA(u,`pointerdown`,n),v&&oA(v,`focusin`,i),v&&oA(v,`focusout`,a),v&&A&&oA(v,`focusout`,o,!0))},[r,_,v,R,c,k,A,t,l,s,se,C,x,b,ie,L,ae,d,f,ce]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${Rz(`portal`)}]`)||[]),t=(k?xO(k.nodesRef.current,x()):[]).find(e=>vO(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Zz([v,...e,I.current,te.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ce(),t,gB(f),gB(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=Zz([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ce]),zk(()=>{if(!g||r||!cD(R))return;F.current=``,ee.current=``;let e=rk(R),t=VD(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||HD(R,t))return;let i=null,a=()=>(i??=se(R),i[0]||R),o;o=r===!0||r===null?a():gB(r),o||=a();let s=HD(R,VD(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&wO(c);Bz(o,{sync:l,preventScroll:o===R,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=VD(e);return!(t!==o&&HD(R,t))}})})},[r,g,R,se,w,D,O,b]);let le=J.useRef(null);zk(()=>{if(r||!R){le.current=null;return}le.current&&=(le.current.cancelled=!0,null);let e=rk(R),t=VD(e),n=D.current==null;xB(t);function i(e){if(e.open||(F.current=_B(e.nativeEvent,ee.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(Rz(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(wO(e.nativeEvent)||TO(e.nativeEvent))j.current=!1;else{let e=!1;rk(R).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&rD(t)!==`body`?t:null,s=n?o||a:a||o;return s||=SB()||null,typeof i==`boolean`?s:gB(i)||s||null}return()=>{y.off(`openchange`,i);let t=VD(e),n=ce(),r=HD(v,t)||n.some(e=>e===t||HD(e,t))||k&&bO(k.nodesRef.current,x(),!1).some(e=>HD(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};le.current=l,queueMicrotask(()=>{le.current===l&&(le.current=null);let n=CB(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&cD(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,R,T,E,D,y,k,_,x,ce]),zk(()=>{if(!RD||g||!v)return;let e=VD(rk(v));!cD(e)||!gO(e)||HD(v,e)&&e.blur()},[g,v]),zk(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),zk(()=>{if(!(r||!R))return wB(R),()=>{queueMicrotask(bB)}},[r,R]);let z=!r&&(!c||!C)&&(oe||c);return(0,X.jsxs)(J.Fragment,{children:[z&&(0,X.jsx)(Lz,{"data-type":`inside`,ref:ne,onFocus:e=>{if(c){let e=se();Bz(e[e.length-1])}else A?.portalNode&&(j.current=!1,wk(e,A.portalNode)?xk(_)?.focus():gB(f??A.beforeOutsideRef)?.focus())}}),n,z&&(0,X.jsx)(Lz,{"data-type":`inside`,ref:re,onFocus:e=>{c?Bz(se()[0]):A?.portalNode&&(l&&(j.current=!0),wk(e,A.portalNode)?Sk(_)?.focus():gB(d??A.afterOutsideRef)?.focus())}})]})}function EB(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=mz}=t,l=e.context.dataRef,u=J.useRef(void 0),d=Pz(),f=eE(),p=J.useMemo(()=>{function t(t,n,r,i){let a=fz(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=EO(e.pointerType,!0)&&TO(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||EO(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=WD(s),p=gO(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}EO(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return J.useMemo(()=>n?{reference:p}:XT,[n,p])}function DB(){return!1}function OB(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function kB(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=DB,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=fB(c),m=GT(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=GT(()=>a),{escapeKey:v,outsidePress:y}=OB(s),b=J.useRef(!1),x=J.useRef(!1),S=J.useRef(!1),C=J.useRef(!1),w=J.useRef(!1),T=J.useRef(``),E=J.useRef(null),D=eE(),O=eE(),k=eE(),A=GT(()=>{O.clear(),d.current.insideReactTree=!1}),j=GT(e=>{let t=d.current.floatingContext?.nodeId;return(p?bO(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=GT(t=>mO(t,e.select(`floatingElement`))||mO(t,e.select(`domReferenceElement`))),N=GT(t=>{o()&&e.setOpen(!1,fz(mz,t.nativeEvent))}),P=GT(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=CO(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=fz(yz,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=GT(()=>{d.current.insideReactTree=!0,O.start(0,A)}),ee=GT(t=>{if(!l||!n||t.button!==0)return;let r=WD(t.nativeEvent);HD(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),I=GT(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});J.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),J.useEffect(()=>A,[A]),J.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new $T,i=rk(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(RD?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&bO(p.nodesRef.current,t).some(t=>mO(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=WD(n),i=`[${Rz(`inert`)}]`,a=sD(r)?r.getRootNode():null,o=Array.from((lD(a)?a:rk(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>HD(e,r))))return;let c=sD(r)?r:null;for(;c&&!bD(c);){let e=CD(c);if(bD(e)||!sD(e))break;c=e}if(!(o.length&&sD(r)&&!hO(r)&&!HD(r,e.select(`floatingElement`))&&o.every(e=>!HD(c,e)))){if(cD(r)&&!(`touches`in n)){let e=bD(r),t=xD(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!wO(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,fz(gz,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function ee(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function I(e,t){let n=WD(e);if(!n)return;let r=oA(n,e.type,()=>{t(e),r()})}function te(e){T.current=`touch`,I(e,ee)}function ne(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&I(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function re(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function ie(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function L(e){I(e,ie)}function ae(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function oe(e){I(e,ae)}let R=Oz(r&&Oz(oA(i,`keydown`,P),oA(i,`compositionstart`,a),oA(i,`compositionend`,o)),g&&Oz(oA(i,`click`,ne,!0),oA(i,`pointerdown`,ne,!0),oA(i,`pointerup`,re,!0),oA(i,`pointercancel`,re,!0),oA(i,`mousedown`,ne,!0),oA(i,`mouseup`,re,!0),oA(i,`touchstart`,te,{capture:!0,passive:!0}),oA(i,`touchmove`,L,{capture:!0,passive:!0}),oA(i,`touchend`,oe,{capture:!0,passive:!0})));return()=>{R(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let te=J.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ne=J.useMemo(()=>({onKeyDown:P,onPointerDown:I,onMouseDown:I,onClickCapture:F,onMouseDownCapture(e){F(),ee(e)},onPointerDownCapture(e){F(),ee(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,ee,I]);return J.useMemo(()=>n?{reference:te,floating:ne,trigger:te}:{},[n,te,ne])}function AB(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),zk(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};sD(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function jB(e,t=!1,n=!1,r=!1){let[i,a]=J.useState(e&&t?`idle`:void 0),[o,s]=J.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),zk(()=>{if(!e&&o&&i!==`ending`&&n){let e=Nz.request(()=>{a(`ending`)});return()=>{Nz.cancel(e)}}},[e,o,i,n]),zk(()=>{if(!e||t||i===void 0)return;let n=Nz.request(()=>{a(void 0)});return()=>{Nz.cancel(n)}},[t,e,i]),zk(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Nz.request(()=>{a(`idle`)});return()=>{Nz.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var MB=null;function NB(e){if(!MB){let e=[];MB=e,queueMicrotask(()=>{MB=null,QF.flushSync(()=>{for(let t of e)t()})})}MB.push(e)}function PB(e,t=!1,n=!1){let r=Pz();return GT((i,a=null)=>{r.cancel();let o=gB(e);if(o==null)return;let s=o,c=()=>{if(!n){QF.flushSync(i);return}NB(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(Kk(s).map(e=>e.finished.then(JT))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(Kk(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=qD;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function FB(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=GT(a),s=PB(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function IB(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=GT(i),{mounted:c,setMounted:l,transitionStatus:u}=jB(t,!1,!1,o),d=!t&&r;zk(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=HE(),h=()=>{f.current=!1,l(!1),a()};zk(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=GT(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return FB({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var LB={tabIndex:-1,[GD]:``};function RB(e){return t=>t!==`touch`||e.current}function zB(e,t=!1){let n=KE(),r=dB()!=null,i=HT(()=>e(n,r)).current;return AB({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function BB({handle:e,store:t}){return zk(()=>e.attachStore(t),[e,t]),null}function VB(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function HB(e,t){let n=J.useRef(null);return GT(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),VB(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),VB(t))})}function UB(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function WB(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function GB(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=HB(e,n),o=GT(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=GT(e=>{a(e),e&&o(e)});return zk(()=>(s(t.current),()=>s(null)),[s,t,n,e]),zk(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function KB(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`);zk(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=fz(pz);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function qB(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=IB({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return HT(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function JB(e,t){e.useSyncedValues(t),zk(()=>()=>{e.update({activeTriggerProps:XT,inactiveTriggerProps:XT,popupProps:XT})},[e])}function YB(e,t){zk(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),zk(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var XB=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},ZB=t((e=>{var t=dr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),QB=t(((e,t)=>{t.exports=ZB()})),$B=t((e=>{var t=dr(),n=QB();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),eV=t(((e,t)=>{t.exports=$B()})),tV=[],nV=void 0;function rV(){return nV}function iV(e){tV.push(e)}function aV(e){let t=(t,n)=>{let r=HT(sV).current,i;try{nV=r;for(let e of tV)e.before(r);i=e(t,n);for(let e of tV)e.after(r);r.didInitialize=!0}finally{nV=void 0}return i};return t.displayName=e.displayName||e.name,t}function oV(e){return J.forwardRef(aV(e))}function sV(){return{didInitialize:!1}}var cV=QB(),lV=eV(),uV=fE(19)?pV:mV;function dV(e,t,n,r,i){return uV(e,t,n,r,i)}function fV(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,cV.useSyncExternalStore)(e.subscribe,a,a)}iV({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,cV.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pV(e,t,n,r,i){let a=rV();if(!a)return fV(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function mV(e,t,n,r,i){return(0,lV.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var hV=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return dV(this,e,t,n,r)}},gV=class extends hV{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;zk(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;zk(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;zk(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;zk(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return J.useDebugValue(e),dV(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=GT(t??JT);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},_V={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},vV=class extends gV{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:sB(),nested:n,triggerElements:i},_V),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&DO(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function yV(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new vV({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:XT,inactiveTriggerProps:XT,popupProps:XT}}var bV=e=>e.triggerIdProp??e.activeTriggerId,xV=e=>e.openProp??e.open,SV=e=>(e.popupElement?.id??e.floatingId)||void 0;function CV(e,t){return t!==void 0&&xV(e)&&bV(e)===t}function wV(e,t){return CV(e,t)?!0:t!==void 0&&xV(e)&&bV(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var TV={open:xV,mounted:e=>e.mounted,transitionStatus:e=>xV(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:bV,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:SV,isTriggerActive:(e,t)=>t!==void 0&&bV(e)===t,isOpenedByTrigger:(e,t)=>CV(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&bV(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>wV(e,t)?SV(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function EV(e){let t=J.useCallback(t=>e===void 0?JT:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,cV.useSyncExternalStore)(t,n,()=>e?.serverStore)}var DV=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new $T;restTimeout=new $T;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},OV=new WeakMap;function kV(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&OV.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),OV.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function AV(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=OV.get(n);a&&a!==e&&kV(a),kV(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,OV.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function jV(e){let t=e.context.dataRef.current,n=HT(()=>t.hoverInteractionState??DV.create()).current;return t.hoverInteractionState||=n,ZT(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function MV(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=fB(),u=dB(),d=jV(e),f=eE(),p=GT(()=>Ez(c.current.openEvent?.type,d.interactedInside)),m=GT(()=>Dz(c.current.openEvent?.type)),h=GT(()=>{kV(d)});zk(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),zk(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&sD(s)&&o){let e=s,t=o,n=rk(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??UD(e,`[data-rootownerid]`)??n.body;return AV(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),J.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&bO(l.nodesRef.current,u).length>0)}function a(t){let n=wz(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,fz(hz,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=WD(e);if(!_O(t)){d.interactedInside=!1;return}d.interactedInside=UD(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(pO(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&sD(o)&&bO(l.nodesRef.current,r,!1).some(e=>HD(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,fz(hz,n)),l.events.emit(`floating.closed`,n)})}let y=o;return Oz(y&&oA(y,`mouseenter`,g),y&&oA(y,`mouseleave`,_),y&&oA(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var NV={current:null};function PV(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=NV,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=fB(l),v=jV(e),y=J.useRef(!1),b=kz(i),x=kz(r),S=kz(o),C=kz(n),w=kz(p),T=kz(f),E=GT(()=>Ez(h.current.openEvent?.type,v.interactedInside)),D=GT(()=>w.current?.()!==!1),O=GT((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!HD(t,n);if(!sD(r))return!1;let a=r;return i.hasMatchingElement(e=>HD(e,a))&&(!t||!HD(t,a))}),k=GT(()=>{v.handler&&=(rk(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=GT(()=>{kV(v)});return u&&(v.handleCloseOptions=i?.__options),J.useEffect(()=>k,[k]),J.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===hz,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),J.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=wz(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,fz(hz,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,fz(hz,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!sD(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!EO(v.pointerType))return;let n=Tz(S.current),r=wz(x.current,`open`,v.pointerType),i=WD(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(sD(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(HD(t,i)){c=t;break}}sD(o)&&sD(s)&&!e.context.triggerElements.hasElement(o)&&HD(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&sD(c)&&sD(s)&&HD(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,fz(hz,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,fz(hz,t,c))}):g&&D()&&e.setOpen(!0,fz(hz,t,c)))}function o(n){if(E()){A();return}k();let r=rk(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!pO(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!HD(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){HD(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?oA(r,`mouseout`,l):void 0;return s?Oz(oA(r,`mousemove`,i,{once:!0}),oA(r,`mouseenter`,i),oA(r,`mouseleave`,o),f):Oz(oA(r,`mouseenter`,i),oA(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),J.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!EO(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;AV(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Tz(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,fz(hz,n,r))}v.pointerType===`touch`?QF.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var FV=.1,IV=FV*FV,LV=.5;function RV(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function zV(e,t,n,r,i,a,o,s,c,l){let u=!1;return RV(e,t,n,r,i,a)&&(u=!u),RV(e,t,i,a,o,s)&&(u=!u),RV(e,t,o,s,c,l)&&(u=!u),RV(e,t,c,l,n,r)&&(u=!u),u}function BV(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function VV(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function HV(e={}){let{blockPointerEvents:t=!1}=e,n=new $T,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*IV;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=WD(r),g=r.type===`mouseleave`,_=HD(u,h),v=HD(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&sD(r.relatedTarget)&&HD(u,r.relatedTarget))return;function y(){return!!(s&&bO(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=VV(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=VV(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=VV(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=VV(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!BV(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?LV/2:LV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+LV+1,o=C||T?S.bottom-LV:S.top,s=C?T?S.bottom-LV:S.top:S.bottom-LV;M=zV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?LV/2:LV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-LV,o=C||T?S.top+LV:S.bottom,s=C?T?S.top+LV:S.bottom:S.top+LV;M=zV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?LV/2:LV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+LV+1,o=w||E?S.right-LV:S.left,s=w?E?S.right-LV:S.left:S.right-LV;M=zV(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?LV/2:LV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-LV,o=w||E?S.left+LV:S.right,s=w?E?S.left+LV:S.right:S.left+LV;M=zV(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function UV(e,t,n){let{reference:r,floating:i}=e,a=BO(t),o=VO(t),s=zO(o),c=IO(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=LO(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function WV(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=FO(t,e),p=$O(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ek(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ek(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var GV=50,KV=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:WV},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=UV(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<GV&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=UV(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},qV=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=FO(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=IO(r),_=BO(o),v=IO(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ZO(o)]:UO(o)),x=p!==`none`;!d&&x&&b.push(...XO(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=HO(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===BO(t)||T.every(e=>BO(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=BO(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},JV=new Set([`left`,`top`]);async function YV(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=IO(n),s=LO(n),c=BO(n)===`y`,l=JV.has(o)?-1:1,u=a&&c?-1:1,d=FO(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var XV=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await YV(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ZV=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=FO(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=BO(i),p=RO(f),m=u[p],h=u[f],g=(e,t)=>PO(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},QV=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=FO(e,t),u={x:n,y:r},d=BO(i),f=RO(d),p=u[f],m=u[d],h=FO(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=JV.has(IO(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$V=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=FO(e,t),c=await i.detectOverflow(t,s),l=IO(n),u=LO(n),d=BO(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=OO(p-c[m],g),y=OO(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*kO(c.left,c.right):S=p-2*kO(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function eH(e){let t=xD(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cD(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=AO(n)!==a||AO(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tH(e){return sD(e)?e:e.contextElement}function nH(e){let t=tH(e);if(!cD(t))return MO(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=eH(t),o=(a?AO(n.width):n.width)/r,s=(a?AO(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rH=MO(0);function iH(e){let t=iD(e);return!yD()||!t.visualViewport?rH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aH(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===iD(e)}function oH(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tH(e),o=MO(1);t&&(r?sD(r)&&(o=nH(r)):o=nH(e));let s=aH(a,n,r)?iH(a):MO(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=iD(a),t=sD(r)?iD(r):r,n=e,i=ED(n);for(;i&&t!==n;){let e=nH(i),t=i.getBoundingClientRect(),r=xD(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=iD(i),i=ED(n)}}return ek({width:u,height:d,x:c,y:l})}function sH(e,t){let n=SD(e).scrollLeft;return t?t.left+n:oH(aD(e)).left+n}function cH(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sH(e,n),y:n.top+t.scrollTop}}function lH(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=aD(r),s=t?fD(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=MO(1),u=MO(0),d=cD(r);if((d||!a)&&((rD(r)!==`body`||uD(o))&&(c=SD(r)),d)){let e=oH(r);l=nH(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cH(o,c):MO(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function uH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dH(e){let t=SD(e),n=e.ownerDocument.body,r=kO(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=kO(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+sH(e),o=-t.scrollTop;return xD(n).direction===`rtl`&&(a+=kO(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var fH=25;function pH(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=iD(e),a=aD(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yD()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(sH(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=fH&&(s-=o)}return{width:s,height:c,x:l,y:u}}function mH(e,t){let n=oH(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=nH(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hH(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=pH(e,n,t);else if(t===`document`)r=dH(aD(e));else if(sD(t))r=mH(t,n);else{let n=iH(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ek(r)}function gH(e,t){let n=t.get(e);if(n)return n;let r=TD(e,[],!1).filter(e=>sD(e)&&rD(e)!==`body`),i=null,a=xD(e).position===`fixed`,o=a?CD(e):e;for(;sD(o)&&!bD(o);){let e=xD(o),t=_D(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=CD(o)}return t.set(e,r),r}function _H(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fD(t)?[]:gH(t,this._c):[].concat(n),r],o=hH(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=hH(t,a[e],i);s=kO(n.top,s),c=OO(n.right,c),l=OO(n.bottom,l),u=kO(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function vH(e){let{width:t,height:n}=eH(e);return{width:t,height:n}}function yH(e,t,n){let r=cD(t),i=aD(t),a=n===`fixed`,o=oH(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=MO(0);if((r||!a)&&((rD(t)!==`body`||uD(i))&&(s=SD(t)),r)){let e=oH(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=sH(i));let l=i&&!r&&!a?cH(i,s):MO(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function bH(e){return xD(e).position===`static`}function xH(e,t){if(!cD(e)||xD(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return aD(e)===n&&(n=n.ownerDocument.body),n}function SH(e,t){let n=iD(e);if(fD(e))return n;if(!cD(e)){let t=CD(e);for(;t&&!bD(t);){if(sD(t)&&!bH(t))return t;t=CD(t)}return n}let r=xH(e,t);for(;r&&dD(r)&&bH(r);)r=xH(r,t);return r&&bD(r)&&bH(r)&&!_D(r)?n:r||vD(e)||n}var CH=async function(e){let t=this.getOffsetParent||SH,n=this.getDimensions,r=await n(e.floating);return{reference:yH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wH(e){return xD(e).direction===`rtl`}var TH={convertOffsetParentRelativeRectToViewportRelativeRect:lH,getDocumentElement:aD,getClippingRect:_H,getOffsetParent:SH,getElementRects:CH,getClientRects:uH,getDimensions:vH,getScale:nH,isElement:sD,isRTL:wH};function EH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function DH(e,t,n){let r=null,i,a=aD(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=jO(d),h=jO(a.clientWidth-(u+f)),g=jO(a.clientHeight-(d+p)),_=jO(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:kO(0,OO(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!EH(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=iD(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function OH(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tH(e),u=i||a?[...l?TD(l):[],...t?TD(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?DH(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?oH(e):null;c&&g();function g(){let t=oH(e);h&&!EH(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kH=XV,AH=ZV,jH=qV,MH=$V,NH=QV,PH=(e,t,n)=>{let r=new Map,i=n??{},a={...TH,...i.platform,_c:r};return KV(e,t,{...i,platform:a})},FH=typeof document<`u`?J.useLayoutEffect:function(){};function IH(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!IH(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!IH(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function LH(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RH(e,t){let n=LH(e);return Math.round(t*n)/n}function zH(e){let t=J.useRef(e);return FH(()=>{t.current=e}),t}function BH(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);IH(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=zH(c),D=zH(i),O=zH(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),PH(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!IH(w.current,t)&&(w.current=t,QF.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);FH(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);FH(()=>(A.current=!0,()=>{A.current=!1}),[]),FH(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=RH(M.floating,u.x),r=RH(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...LH(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var VH=(e,t)=>{let n=kH(e);return{name:n.name,fn:n.fn,options:[e,t]}},HH=(e,t)=>{let n=AH(e);return{name:n.name,fn:n.fn,options:[e,t]}},UH=(e,t)=>({fn:NH(e).fn,options:[e,t]}),WH=(e,t)=>{let n=jH(e);return{name:n.name,fn:n.fn,options:[e,t]}},GH=(e,t)=>{let n=MH(e);return{name:n.name,fn:n.fn,options:[e,t]}},KH=J.createContext(void 0);function qH(){let e=J.useContext(KH);if(e===void 0)throw Error(nE(26));return e}var JH=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),YH=`--nested-dialogs`,XH=`data-nested-dialog-open`,ZH={...uO,...ZD,nestedDialogOpen(e){return e?{[XH]:``}:null}},QH=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=rz(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);qH(),FB({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?RB(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=ME(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...LB,hidden:!m,onKeyDown(e){JH.has(e.key)&&e.stopPropagation()},style:{[YH]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ZH});return(0,X.jsx)(TB,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function $H(e){return fE(19)?e:e?`true`:void 0}var eU=J.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(0,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),tU=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=rz(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(KH.Provider,{value:n,children:(0,X.jsxs)(oB,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(eU,{ref:i.context.internalBackdropRef,inert:$H(!s)}),e.children]})}):null}),nU={},rU={},iU=``;function aU(e,t){return uD(e)?e:t}function oU(e,t,n){return/hidden|clip/.test(e.getComputedStyle(aU(t,n)).overflowY)}function sU(e){if(typeof document>`u`)return!1;let t=rk(e);return iD(t).innerWidth-t.documentElement.clientWidth>0}function cU(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=rk(e),n=t.documentElement,r=t.body,i=aU(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 lU(e){let t=rk(e),n=t.documentElement,r=t.body,i=aU(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 uU(e){let t=rk(e),n=t.documentElement,r=t.body,i=iD(n),a=0,o=0,s=!1,c=Nz.create();if(RD&&(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,nU={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},iU=n.style.scrollBehavior,rU={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=aU(n,r);if(s=cU(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}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,nU),Object.assign(r.style,rU),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=iU)}function d(){u(),c.request(l)}l();let f=oA(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var dU=new class{lockCount=0;restore=null;timeoutLock=$T.create();timeoutUnlock=$T.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=rk(e),n=t.documentElement,r=t.body,i=iD(n);if(oU(i,n,r)){let t=new i.MutationObserver(()=>{oU(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=ND||!sU(e);this.restore=a?lU(e):uU(e)}};function fU(e=!0,t=null){zk(()=>{if(e)return dU.acquire(t)},[e,t])}function pU({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=J.useState(0),[d,f]=J.useState(0),p=l===0,m=kB(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=WD(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||HD(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return fU(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),zk(()=>{!r&&!i&&(u(0),f(0))},[r,i]),zk(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),JB(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var mU={...TV,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},hU=class extends gV{constructor(e,t,n){let r=new XB,i=gU(e,r,t,n);super(i,_U(r),mU)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(UB(this.state,e,t.trigger)))}};function gU(e,t,n,r=!1){return{...yV(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function _U(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function vU(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=rz(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=zB((e,t)=>new hU({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);YB(b,x),KB(b);let{forceUnmount:w}=qB(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,fz(bz))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(nz.Provider,{value:b,children:[u&&(0,X.jsx)(BB,{handle:u,store:b}),T&&(0,X.jsx)(pU,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var yU=aV(function(e){return vU(`dialog`,e)}),bU=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=rz(),c=qE(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ME(`h2`,e,{ref:t,props:[{id:c},o]})});function xU(e){let t=J.useRef(``),n=J.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:J.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function SU(e,t){let{onClick:n,onPointerDown:r}=xU(GT((n,r)=>{(typeof e==`function`?e():e)||t(r||(ND?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var CU=oV(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=rz(!0),f=EV(l)??d;if(!f)throw Error(nE(79));let p=qE(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=GB(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=lz({disabled:a,native:o}),S=EB(m),C=SU(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return ME(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[$z]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:cO})}),wU=(0,J.createContext)(void 0),TU=(0,J.createContext)(null);function EU(e){let t=(0,J.useContext)(TU);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function DU(e){let t=(0,J.useContext)(wU),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var OU=(0,J.createContext)(null);function kU({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(OU.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(yU,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function AU(){let e=(0,J.useContext)(OU);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(CU,{...n,className:t=>Q(`btn`,Ax(e,t)),ref:r,type:t})});var jU=(0,J.forwardRef)(function({container:e,...t},n){let r=EU(`dialog`);return e==null&&r===null?null:(0,X.jsx)(tU,{...t,container:e??r,ref:n})}),MU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(iz,{...t,ref:n,className:t=>Q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,Ax(e,t))})}),NU=(0,J.forwardRef)(function({className:e,finalFocus:t,size:n=`default`,...r},i){let a=AU();return(0,X.jsx)(QH,{...r,"data-size":n,className:t=>Q(`caps-dialog-popup overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,n===`fill`?`fixed inset-0 h-full w-full max-w-none`:`max-h-screen w-11/12 max-w-(--container-lg)`,Ax(e,t)),finalFocus:a.interactionOwner===`host`?!1:t??!0,ref:i})}),PU=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,size:r=`default`,...i},a){let{modal:o}=AU();return(0,X.jsxs)(jU,{container:e,keepMounted:t,children:[o===!0?(0,X.jsx)(MU,{}):null,(0,X.jsx)(NU,{...i,size:r,className:e=>Q(r==="default"&&`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,Ax(n,e)),ref:a})]})});function FU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex justify-end gap-sm`,e)})}function IU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex flex-col gap-sm`,e)})}var LU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(bU,{...t,className:t=>Q(`text-lg font-semibold`,Ax(e,t)),ref:n})}),RU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Sz,{...t,className:t=>Q(`text-sm text-base-content`,Ax(e,t)),ref:n})}),zU=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(xz,{...n,className:t=>Q(`btn btn-ghost`,Ax(e,t)),ref:r,type:t})}),BU=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),VU=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),HU={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},UU=(0,J.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,J.createElement)(`svg`,{ref:c,...HU,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:VU(`lucide`,i),...s},[...o.map(([e,t])=>(0,J.createElement)(e,t)),...Array.isArray(a)?a:[a]])),WU=(e,t)=>{let n=(0,J.forwardRef)(({className:n,...r},i)=>(0,J.createElement)(UU,{ref:i,iconNode:t,className:VU(`lucide-${BU(e)}`,n),...r}));return n.displayName=`${e}`,n},GU=WU(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),KU=WU(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),qU=WU(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),JU=WU(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),YU=WU(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),XU=WU(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ZU=WU(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),QU=WU(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),$U=WU(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),eW=WU(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),tW=WU(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),nW=WU(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),rW=WU(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),iW=WU(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),aW=WU(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),oW=WU(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),sW=WU(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),cW=WU(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function lW(e,t){return Math.max(0,t===`reverse`?-e.scrollTop:e.scrollHeight-e.clientHeight-e.scrollTop)}function uW(){return{phase:`hidden`,shown:!1,jumped:!1,velocity:0,y:0,vy:0,volume:0,vv:0,opacity:0,unread:0,bead:0}}function dW(e){return 1+Math.min(.15,.06*Math.log2(1+Math.max(0,e)))}function fW(e,t,n,r,i,a){let o=t+(-i*i*(e-n)-2*a*i*t)*r;return[e+o*r,o]}function pW(e,t,n,r){let i={...e},a=Math.max(1,Math.min(64,n)),o=t.jump===!0||e.jumped;i.jumped=o,o?(i.phase=`merging`,i.shown=!1,i.unread=0,i.velocity=0):(t.distance>48?i.shown=!0:t.distance<8&&(i.shown=!1),i.unread=i.shown?Math.max(0,t.unread):0,i.unread>e.unread&&i.shown&&!r.reduced&&(i.bead=1),i.velocity+=(t.delta/a-i.velocity)*(1-Math.exp(-a/50))),!i.shown&&e.phase!==`hidden`&&(i.phase=`merging`),i.shown&&!e.shown&&(i.phase=`welling`);let s=i.shown?dW(i.unread):0;if(e.phase===`hidden`&&i.shown&&(i.phase=`welling`,i.y=r.reduced?0:5),r.reduced){i.y=0,i.vy=0,i.velocity=0,i.vv=0,i.bead=0,i.volume=dW(i.unread);let e=a/Math.max(1,r.fast);i.opacity=i.shown?Math.min(1,i.opacity+e):Math.max(0,i.opacity-e)}else{let e=2*Math.PI/Math.max(.08,r.springDuration/1e3),t=Math.max(.08,1-r.bounce),n=Math.max(-9,Math.min(9,-i.velocity*7)),c=o?12:i.shown?n:4,l=Math.ceil(a/8);for(let n=0;n<l;n++)[i.y,i.vy]=fW(i.y,i.vy,c,a/l/1e3,e,t),[i.volume,i.vv]=fW(i.volume,i.vv,s,a/l/1e3,o?e/1.7:e,o?1:t);i.opacity=Math.min(1,Math.max(0,i.volume*1.4)),i.bead=Math.max(0,i.bead-a/580)}return!i.shown&&(r.reduced?i.opacity===0:i.volume<.002&&Math.abs(i.vv)<.02)?uW():(i.shown&&Math.abs(i.volume-s)<.001&&Math.abs(i.vv)<.01&&Math.abs(i.y)<.02&&Math.abs(i.vy)<.2&&i.bead===0?(i.phase=`resting`,i.volume=s,i.vv=0,i.y=0,i.vy=0,i.velocity=0):i.shown&&i.volume>.95&&(i.phase=`tugged`),i)}var mW=(0,J.memo)(function({direction:e=`forward`,scrollerRef:t,onJump:n,unread:r=0,focusAfterJump:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(uW()),p=(0,J.useRef)(()=>void 0),m=(0,J.useRef)(!1),h=(0,J.useRef)(r),g=sS(a),_=`caps-drop-${(0,J.useId)().replaceAll(`:`,``)}`;return(0,J.useEffect)(()=>{h.current=r,p.current()},[r]),(0,J.useEffect)(()=>{let n=t.current,r=o.current,i=s.current,_=c.current,v=l.current,y=u.current,b=d.current,x=a.current;if(!n||!r||!i||!_||!v||!y||!b||!x)return;let S=0,C=0,w=n.scrollTop,T=!0,E=()=>{let e=f.current;if(r.dataset.motionState=e.phase,r.style.display=e.phase===`hidden`?`none`:``,y.tabIndex=e.phase===`hidden`||e.phase===`merging`?-1:0,y.disabled=e.phase===`merging`,y.setAttribute(`aria-label`,`Jump to bottom${e.unread?`, ${String(e.unread)} new message${e.unread===1?``:`s`}`:``}`),r.style.opacity=g.reduced?String(e.opacity):``,_.style.display=g.reduced||e.phase===`resting`||e.phase===`hidden`?`none`:``,v.style.display=g.reduced||e.bead===0?`none`:``,g.reduced){i.style.transform=``,i.style.transformOrigin=``,i.style.width=e.unread?`${String(y.clientWidth*e.volume)}px`:``,i.style.height=e.unread?`${String(y.clientWidth*e.volume)}px`:``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}if(i.style.width=``,i.style.height=``,e.phase===`resting`&&e.unread===0){i.style.transform=``,i.style.transformOrigin=``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}let t=Math.min(1,Math.abs(e.y)/9*.7+Math.abs(e.vy)/120*.3),n=1+g.stretch*t,a=Math.max(.001,e.volume),o=Math.max(0,1-a);i.style.transformOrigin=e.y>=0?`50% 0%`:`50% 100%`,i.style.transform=`translateY(${String(e.y)}px) scale(${String(a/Math.sqrt(n)*(1-.12*o))}, ${String(a*n*(1+.1*o))})`,_.style.transform=`scale(${String(Math.min(1,Math.abs(e.y)/3)*a*.55)})`,v.style.transform=`translateY(${String(-34*e.bead*e.bead)}px) scale(${String(.62*Math.min(1,e.bead*3))})`,b.style.transform=`translateY(${String(e.y*.8)}px)`,b.style.opacity=String(e.opacity)},D=t=>{S=0;let r=C?t-C:16;C=t;let i=n.scrollTop;f.current=pW(f.current,{distance:lW(n,e),delta:i-w,unread:h.current,jump:m.current},r,g),w=i,m.current=!1,E();let a=f.current;a.phase!==`hidden`&&(!a.shown||a.phase!==`resting`||a.opacity<1)&&O()};function O(){!T||S||(S=requestAnimationFrame(D))}let k=()=>{S||(C=0),O()};p.current=k;let A=ST(x,e=>{T=e,e?(C=0,w=n.scrollTop,O()):(cancelAnimationFrame(S),S=0)}),j=globalThis,M=j.ResizeObserver?new j.ResizeObserver(k):void 0;return M?.observe(n),n.firstElementChild&&M?.observe(n.firstElementChild),n.addEventListener(`scroll`,k,{passive:!0}),O(),()=>{p.current=()=>void 0,cancelAnimationFrame(S),n.removeEventListener(`scroll`,k),M?.disconnect(),A()}},[e,t,g]),(0,X.jsx)(`div`,{ref:a,className:`absolute bottom-4 right-4 z-1 h-8 w-8 md:h-6 md:w-6`,children:(0,X.jsxs)(`div`,{ref:o,className:`relative h-full w-full`,"data-motion-state":`hidden`,style:{display:`none`},children:[(0,X.jsxs)(`div`,{className:`absolute -inset-1.5`,style:{filter:`url(#${_})`,willChange:`filter`},children:[(0,X.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,children:(0,X.jsx)(`defs`,{children:(0,X.jsxs)(`filter`,{id:_,x:`-60%`,y:`-60%`,width:`220%`,height:`220%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,result:`blur`,stdDeviation:`4`}),(0,X.jsx)(`feColorMatrix`,{in:`blur`,type:`matrix`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9`})]})})}),(0,X.jsx)(`div`,{className:`absolute inset-0 m-auto h-8 w-8 md:h-6 md:w-6`,ref:s,"data-drop-body":``,children:(0,X.jsx)(`div`,{className:`absolute inset-0 rounded-full border border-base-300 bg-base-200 shadow-sm`})}),(0,X.jsx)(`div`,{ref:c,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`}}),(0,X.jsx)(`div`,{ref:l,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`},"data-drop-incoming":``})]}),(0,X.jsx)(`button`,{ref:u,"aria-label":`Jump to bottom`,className:`absolute inset-0 z-1 grid place-items-center rounded-full caps-focus-color`,"data-testid":`jump-to-bottom`,onClick:()=>{if(f.current.phase!==`hidden`&&f.current.phase!==`merging`){if(m.current=!0,h.current=0,p.current(),document.activeElement===u.current){let e=i?.current??t.current;e&&(e===t.current&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=-1),e.focus({preventScroll:!0}))}n()}},title:`Jump to bottom`,type:`button`,tabIndex:-1,children:(0,X.jsx)(GU,{ref:d,className:`text-base-content`,size:13})})]})})});function hW(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function gW(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function _W(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var vW=(e,t)=>Math.abs(e-t)<1.01,yW=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},bW,xW=()=>{if(bW!==void 0)return bW;if(typeof navigator>`u`)return bW=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return bW=!0;let e=navigator.maxTouchPoints;return bW=navigator.platform===`MacIntel`&&e!==void 0&&e>0},SW=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},CW=e=>e,wW=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},TW=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(SW(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(SW(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},EW={passive:!0},DW=typeof window>`u`||`onscrollend`in window,OW=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&DW,o=0,s=a?null:yW(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,EW),a&&r.addEventListener(`scrollend`,u,EW),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},kW=(e,t)=>OW(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),AW=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},jW=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},MW=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:CW,rangeExtractor:wW,onChange:()=>{},measureElement:AW,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=gW(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!xW()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,EW),e.addEventListener(`touchend`,n,EW),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(xW()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=gW(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=gW(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=hW(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=gW(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=FW(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=gW(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=gW(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return _W(t[NW(0,t.length-1,r?e=>n[e*2]:e=>_W(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:xW()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&vW(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},NW=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function PW(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function FW(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=PW(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=NW(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var IW=typeof document<`u`?J.useLayoutEffect:J.useEffect;function LW({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=J.useReducer(e=>e+1,0)[1],a=J.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,QF.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=J.useState(()=>{let e=new MW(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),IW(()=>l._didMount(),[]),IW(()=>(o(l),l._willUpdate())),IW(()=>{s(l)}),l}function RW(e){return LW({observeElementRect:TW,observeElementOffset:kW,scrollToFn:jW,...e})}function zW(e){return e.kind===`user_message`&&e.requestId!==void 0?e.requestId:e.id}function BW(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function VW(e,t){let n=[...e,...t].map(zW),[r,i]=(0,J.useState)(n),a=BW(r,n)?r:n;return a!==r&&i(a),(0,J.useCallback)(e=>a[e]??e,[a])}function HW(e){return e<1e3?`${String(e)} tok`:`${(e/1e3).toFixed(1)}K`}var UW={"anthropic-messages":JSON.parse(`{"chat:claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsStrictTools":true,"allowedFallbackModels":[{"provider":"anthropic","model":"claude-opus-4-8","cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25}},{"provider":"anthropic","model":"claude-opus-5","cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25}}]},"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-fable-5-1":{"id":"claude-fable-5-1","name":"Claude Fable 5.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsStrictTools":true},"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-haiku-5-5":{"id":"claude-haiku-5-5","name":"Claude Haiku 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"tiers":[{"inputTokensAbove":100000,"input":0.5,"output":2.5,"cacheRead":0.05,"cacheWrite":0.625}]},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-opus-5-5":{"id":"claude-opus-5-5","name":"Claude Opus 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":100,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:claude-sonnet-5-5":{"id":"claude-sonnet-5-5","name":"Claude Sonnet 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsMidConvoEffort":true,"supportsMidConvoSystemMessages":true,"supportsMidConvoToolChanges":true,"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true},"promptCache":{"short":300,"long":3600},"inputLimits":{"maxRequestBytes":33554432,"images":{"maxPerRequest":600,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)};function WW(e,t){return Object.fromEntries(Object.values(e).flatMap(e=>Object.values(e)).filter(e=>e.type===t).map(e=>[e.id,e]))}function GW(e,t){return WW(t,`chat`)}function KW(e,t){return WW(t,`image`)}function qW(e,t){return WW(t,`classifier`)}var JW=GW(`anthropic`,UW);KW(`anthropic`,UW),qW(`anthropic`,UW);var YW={"cloudflare-workers-ai-system-one":{"classifier:@cf/cloudflare/clef":{type:`classifier`,id:`@cf/cloudflare/clef`,name:`Clef`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:.24,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536},"classifier:@cf/cloudflare/clef-flash":{type:`classifier`,id:`@cf/cloudflare/clef-flash`,name:`Clef Flash`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:.09,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536},"classifier:typesafe/jev":{type:`classifier`,id:`typesafe/jev`,name:`Jev`,api:`cloudflare-workers-ai-system-one`,provider:`cloudflare-workers-ai`,baseUrl:`https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai`,input:[`text`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:32e3}},"openai-completions":JSON.parse(`{"chat:@cf/deepseek-ai/deepseek-v4-flash-0731":{"id":"@cf/deepseek-ai/deepseek-v4-flash-0731","name":"DeepSeek V4 Flash 0731","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.44,"output":1.32,"cacheRead":0.014,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek"},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"},"chat:@cf/deepseek-ai/deepseek-v4-pro-0813":{"id":"@cf/deepseek-ai/deepseek-v4-pro-0813","name":"DeepSeek V4 Pro 0813","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.32,"output":3.96,"cacheRead":0.044,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek"},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"},"chat:@cf/google/gemma-4-26b-a4b-it":{"id":"@cf/google/gemma-4-26b-a4b-it","name":"Gemma 4 26B A4B IT","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.3,"cacheRead":0.05,"cacheWrite":0},"contextWindow":256000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/ibm-granite/granite-4.0-h-micro":{"id":"@cf/ibm-granite/granite-4.0-h-micro","name":"Granite 4.0 H Micro","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text"],"cost":{"input":0.017,"output":0.112,"cacheRead":0,"cacheWrite":0},"contextWindow":131000,"maxTokens":131000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/meta/llama-3.3-70b-instruct-fp8-fast":{"id":"@cf/meta/llama-3.3-70b-instruct-fp8-fast","name":"Llama 3.3 70B Instruct fp8 Fast","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text"],"cost":{"input":0.293,"output":2.253,"cacheRead":0,"cacheWrite":0},"contextWindow":24000,"maxTokens":24000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/meta/llama-4-scout-17b-16e-instruct":{"id":"@cf/meta/llama-4-scout-17b-16e-instruct","name":"Llama 4 Scout 17B 16E Instruct","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.27,"output":0.85,"cacheRead":0,"cacheWrite":0},"contextWindow":131000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/mistralai/mistral-small-3.1-24b-instruct":{"id":"@cf/mistralai/mistral-small-3.1-24b-instruct","name":"Mistral Small 3.1 24B Instruct","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.351,"output":0.555,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":128000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/moonshotai/kimi-k2.6":{"id":"@cf/moonshotai/kimi-k2.6","name":"Kimi K2.6","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.95,"output":4,"cacheRead":0.16,"cacheWrite":0},"contextWindow":262144,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/moonshotai/kimi-k2.7-code":{"id":"@cf/moonshotai/kimi-k2.7-code","name":"Kimi K2.7 Code","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.95,"output":4,"cacheRead":0.19,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/nvidia/nemotron-3-120b-a12b":{"id":"@cf/nvidia/nemotron-3-120b-a12b","name":"Nemotron 3 Super 120B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.5,"output":1.5,"cacheRead":0,"cacheWrite":0},"contextWindow":256000,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/openai/gpt-oss-120b":{"id":"@cf/openai/gpt-oss-120b","name":"GPT OSS 120B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.35,"output":0.75,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/openai/gpt-oss-20b":{"id":"@cf/openai/gpt-oss-20b","name":"GPT OSS 20B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.2,"output":0.3,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:@cf/qwen/qwen3-30b-a3b-fp8":{"id":"@cf/qwen/qwen3-30b-a3b-fp8","name":"Qwen3 30B A3b fp8","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.0509,"output":0.335,"cacheRead":0,"cacheWrite":0},"contextWindow":32768,"maxTokens":32768,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/qwen/qwen3.8-27b":{"id":"@cf/qwen/qwen3.8-27b","name":"Qwen3.8 27B","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.45,"output":3.2,"cacheRead":0.05,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:@cf/zai-org/glm-4.7-flash":{"id":"@cf/zai-org/glm-4.7-flash","name":"GLM-4.7-Flash","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":0.0605,"output":0.4,"cacheRead":0,"cacheWrite":0},"contextWindow":131072,"maxTokens":131072,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"type":"chat"},"chat:@cf/zai-org/glm-5.2":{"id":"@cf/zai-org/glm-5.2","name":"Glm 5.2","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":262144,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:@cf/zai-org/glm-5.3":{"id":"@cf/zai-org/glm-5.3","name":"Glm 5.3","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:@cf/zai-org/glm-5.3-flash":{"id":"@cf/zai-org/glm-5.3-flash","name":"Glm 5.3 Flash","api":"openai-completions","provider":"cloudflare-workers-ai","baseUrl":"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsStrictMode":true,"supportsLongCacheRetention":false,"sendSessionAffinityHeaders":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)},XW=GW(`cloudflare-workers-ai`,YW);KW(`cloudflare-workers-ai`,YW);var ZW=qW(`cloudflare-workers-ai`,YW),QW={"openai-decisions":{"classifier:gpt-6-luna":{type:`classifier`,id:`gpt-6-luna`,name:`GPT-6 Luna`,api:`openai-decisions`,provider:`openai`,baseUrl:`https://api.openai.com/v1`,input:[`text`,`image`],cost:{input:.1,output:0,cacheRead:0,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:.2,output:0,cacheRead:0,cacheWrite:0}]},contextWindow:922e3}},"openai-responses":JSON.parse(`{"chat:gpt-4":{"id":"gpt-4","name":"GPT-4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text"],"cost":{"input":30,"output":60,"cacheRead":0,"cacheWrite":0},"contextWindow":8192,"maxTokens":8192,"compat":{"supportsStrictMode":true},"type":"chat"},"chat:gpt-4-turbo":{"id":"gpt-4-turbo","name":"GPT-4 Turbo","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":10,"output":30,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1":{"id":"gpt-4.1","name":"GPT-4.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1-mini":{"id":"gpt-4.1-mini","name":"GPT-4.1 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.4,"output":1.6,"cacheRead":0.1,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4.1-nano":{"id":"gpt-4.1-nano","name":"GPT-4.1 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o":{"id":"gpt-4o","name":"GPT-4o","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-05-13":{"id":"gpt-4o-2024-05-13","name":"GPT-4o (2024-05-13)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":15,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-08-06":{"id":"gpt-4o-2024-08-06","name":"GPT-4o (2024-08-06)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-2024-11-20":{"id":"gpt-4o-2024-11-20","name":"GPT-4o (2024-11-20)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-4o-mini":{"id":"gpt-4o-mini","name":"GPT-4o mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.075,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5":{"id":"gpt-5","name":"GPT-5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-chat-latest":{"id":"gpt-5-chat-latest","name":"GPT-5 Chat Latest","api":"openai-responses","baseUrl":"https://api.openai.com/v1","provider":"openai","reasoning":false,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-mini":{"id":"gpt-5-mini","name":"GPT-5 Mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":2,"cacheRead":0.025,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-nano":{"id":"gpt-5-nano","name":"GPT-5 Nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.05,"output":0.4,"cacheRead":0.005,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5-pro":{"id":"gpt-5-pro","name":"GPT-5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":120,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.1":{"id":"gpt-5.1","name":"GPT-5.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2":{"id":"gpt-5.2","name":"GPT-5.2","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2-chat-latest":{"id":"gpt-5.2-chat-latest","name":"GPT-5.2 Chat","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":null,"xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.2-pro":{"id":"gpt-5.2-pro","name":"GPT-5.2 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":21,"output":168,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-chat-latest":{"id":"gpt-5.3-chat-latest","name":"GPT-5.3 Chat (latest)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"xhigh":"xhigh"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-codex":{"id":"gpt-5.3-codex","name":"GPT-5.3 Codex","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.3-codex-spark":{"id":"gpt-5.3-codex-spark","name":"GPT-5.3 Codex Spark","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4":{"id":"gpt-5.4","name":"GPT-5.4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2.5,"output":15,"cacheRead":0.25,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":5,"output":22.5,"cacheRead":0.5,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-mini":{"id":"gpt-5.4-mini","name":"GPT-5.4 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.75,"output":4.5,"cacheRead":0.075,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-nano":{"id":"gpt-5.4-nano","name":"GPT-5.4 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.25,"cacheRead":0.02,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.4-pro":{"id":"gpt-5.4-pro","name":"GPT-5.4 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.5-pro":{"id":"gpt-5.5-pro","name":"GPT-5.5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-luna":{"id":"gpt-5.6-luna","name":"GPT-5.6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.2,"cacheRead":0.02,"cacheWrite":0.25,"tiers":[{"inputTokensAbove":272000,"input":0.4,"output":1.8,"cacheRead":0.04,"cacheWrite":0.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.4,"cacheWrite":5,"tiers":[{"inputTokensAbove":272000,"input":8,"output":30,"cacheRead":0.8,"cacheWrite":10}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-5.6-terra":{"id":"gpt-5.6-terra","name":"GPT-5.6 Terra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":18,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-astra":{"id":"gpt-6-astra","name":"GPT-6 Astra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5,"tiers":[{"inputTokensAbove":272000,"input":20,"output":75,"cacheRead":2,"cacheWrite":25}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-luna":{"id":"gpt-6-luna","name":"GPT-6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"tiers":[{"inputTokensAbove":272000,"input":0.2,"output":0.75,"cacheRead":0.02,"cacheWrite":0.25}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6-sol":{"id":"gpt-6-sol","name":"GPT-6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":15,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-6.1-sol":{"id":"gpt-6.1-sol","name":"GPT-6.1 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":15,"cacheRead":0.2,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsAdditionalTools":true,"supportsToolSearch":true,"supportsMidConvoSystemMessages":true,"supportsExplicitPromptCacheMode":true,"supportsMidConvoEffort":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-daybreak-blue-latest":{"id":"gpt-daybreak-blue-latest","name":"Daybreak Blue","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.4,"cacheWrite":5,"tiers":[{"inputTokensAbove":272000,"input":8,"output":30,"cacheRead":0.8,"cacheWrite":10}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-daybreak-red-latest":{"id":"gpt-daybreak-red-latest","name":"Daybreak Red","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":12.5,"output":75,"cacheRead":1.25,"cacheWrite":15.625},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsExplicitPromptCacheMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:gpt-realtime-2.1":{"id":"gpt-realtime-2.1","name":"GPT-Realtime-2.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":24,"cacheRead":0.4,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o1":{"id":"o1","name":"o1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":60,"cacheRead":7.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o1-pro":{"id":"o1-pro","name":"o1-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":150,"output":600,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o3":{"id":"o3","name":"o3","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o3-mini":{"id":"o3-mini","name":"o3-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.55,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"type":"chat"},"chat:o3-pro":{"id":"o3-pro","name":"o3-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":20,"output":80,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:o4-mini":{"id":"o4-mini","name":"o4-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.275,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true},"inputLimits":{"maxRequestBytes":536870912,"images":{"maxPerRequest":1500,"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}`)},$W=GW(`openai`,QW);KW(`openai`,QW);var eG=qW(`openai`,QW),tG={"openai-codex-responses":{"chat:gpt-5.3-codex-spark":{id:`gpt-5.3-codex-spark`,name:`GPT-5.3 Codex Spark`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0},type:`chat`},"chat:gpt-5.5":{id:`gpt-5.5`,name:`GPT-5.5`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:272e3,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-luna":{id:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:272e3,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-sol":{id:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-5.6-terra":{id:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{xhigh:`xhigh`,max:`max`,minimal:`low`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-astra":{id:`gpt-6-astra`,name:`GPT-6 Astra`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:null,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-luna":{id:`gpt-6-luna`,name:`GPT-6 Luna`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:`none`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6-sol":{id:`gpt-6-sol`,name:`GPT-6 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:272e3,maxTokens:128e3,thinkingLevelMap:{off:`none`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`},"chat:gpt-6.1-sol":{id:`gpt-6.1-sol`,name:`GPT-6.1 Sol`,api:`openai-codex-responses`,provider:`openai-codex`,baseUrl:`https://chatgpt.com/backend-api`,reasoning:!0,input:[`text`,`image`],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:5e5,maxTokens:128e3,thinkingLevelMap:{off:null,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`max`},compat:{supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:`chat`}}},nG=GW(`openai-codex`,tG);KW(`openai-codex`,tG),qW(`openai-codex`,tG);var rG=new Map([...Object.values(JW),...Object.values(XW),...Object.values($W),...Object.values(nG)].map(e=>[xA({provider:e.provider,model:e.id}),e.name]));function iG(e){let t=xA(e);return rG.get(t)??t}var aG=b_({keyCode:D_(229)});function oG(e){return e.nativeEvent.isComposing||h(aG,e.nativeEvent).success}var sG={admission:`Your prompt didn’t make it through. Let’s give it another go.`,failed:`The run stopped. Check the message above before trying again.`,interrupted:`The worker stopped before this run finished. Your prompt is still here.`,cancelled:`The run was cancelled. Send a new prompt when you’re ready.`};function cG({failure:e,cause:t,onRetry:n}){let r=t===void 0?void 0:Kn(t),i=r!==void 0&&!r.startsWith(`reason_unavailable:`)&&!/\b(?:run|session)=/iu.test(r)?r:void 0;return(0,X.jsx)(Mx,{tone:`warning`,title:e===`cancelled`?`Taking a breather`:`A little tangle`,description:e===`interrupted`&&i!==void 0?(0,X.jsxs)(X.Fragment,{children:[`This turn stopped before it finished: `,i,`. Your prompt is still here.`]}):(0,X.jsxs)(X.Fragment,{children:[sG[e],` If the model didn’t start, there’s no charge. Model work already done can still use credits.`,i?(0,X.jsx)(`span`,{className:`block`,children:i}):null]}),action:e===`cancelled`?void 0:(0,X.jsx)(NT,{"aria-label":`Retry prompt`,variant:`outline`,onClick:n,children:`Retry`})})}var lG=(0,J.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,X.jsx)(`kbd`,{...i,ref:a,className:Q(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})}),uG=(0,J.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,X.jsxs)(`button`,{...l,ref:u,type:c,className:Q(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,X.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,X.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,X.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,X.jsx)(lG,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function dG(e,t){return e.animate(t.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(-120%)`}],{duration:t.reduced?t.fast:t.normal,easing:dS(t,t.easeExit),fill:`backwards`})}function fG(e,t){let n=-12*Math.min(1.5,t.bounce/.3);return e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(70%)`},{opacity:1,transform:`translateY(${String(n)}%)`,offset:.6},{opacity:1,transform:`none`}],{duration:t.reduced?t.fast:t.springDuration,easing:dS(t,t.ease),fill:`backwards`})}function pG(e,t,n){return e.animate([{opacity:1-n},{opacity:n}],{duration:t.reduced?t.fast:t.normal,delay:n===1&&!t.reduced?t.fast/2:0,easing:dS(t,t.ease),fill:`backwards`})}function mG(e,t){let n=1+.05*Math.min(1.5,.4+t.bounce/.3);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(n)})`,offset:.4},{transform:`scale(1)`}],{duration:t.springDuration,easing:dS(t,`ease-out`)})}var hG=(0,J.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...l},u){let d=(0,J.useRef)(null);(0,J.useImperativeHandle)(u,()=>d.current);let f=(0,J.useRef)(e);(0,J.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!fS(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=oS(t),o=[];return e===`busy`?o.push(dG(r,a),pG(i,a,1)):n===`busy`&&o.push(pG(i,a,0),fG(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(mG(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,X.jsx)(uG,{...l,ref:d,className:Q(`caps-send-action`,o),tone:s,"aria-busy":p?!0:void 0,"aria-label":m?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||p&&!m,onClick:m?t:i,label:null,icon:(0,X.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,X.jsx)(`span`,{"data-glyph":`arrow`,children:(0,X.jsx)(KU,{"aria-hidden":`true`,size:r})}),(0,X.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,X.jsx)(AT,{decorative:!0,size:`sm`}):(0,X.jsx)(oW,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),gG=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),_G=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function vG(e,t){if(!Number.isFinite(e))throw RangeError(`Money amount must be finite`);let n=e!==0&&Math.abs(e)<.01;return n&&(t?.precision!==`exact`||Math.abs(e)<1e-5)?e<0?`>-$0.01`:`<$0.01`:n?_G.format(e):gG.format(e)}var yG={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function bG({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(yG[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=sS(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=yG[t],n=h||p.current===t;p.current=t;let r=oS(i.current),o=n?{duration:0}:pA(r,{bounce:.3,duration:360}),s=fT(i.current,{y:e.y,height:e.height,...o}),u=fT(a.current,{cy:e.cy,...n?{duration:0}:{delay:cS(r,35),...pA(r,{bounce:.3,duration:420})}}),d=fT(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=fT(l.current,{opacity:+(t===`bang`),...n?fA:mA(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,J.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?fT(o.current,{opacity:[1,.45],...mA(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):fT(o.current,{keyframes:{"0%":{translateY:0,scaleX:1,scaleY:1},"18%":{translateY:.25,scaleX:1.1,scaleY:.91},"42%":{translateY:-1.3,scaleX:.94,scaleY:1.06},"62%":{translateY:-1.65,scaleX:1,scaleY:1},"82%":{translateY:.15,scaleX:1.06,scaleY:.95},"100%":{translateY:0,scaleX:1,scaleY:1}},...mA(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=ST(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,X.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(xT,{id:r,values:bT}),(0,X.jsx)(_T,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,X.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,X.jsx)(vT,{id:`${r}-shadow`}),(0,X.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,X.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,X.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,X.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,X.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,X.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,X.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,X.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var xG=.28;function SG(e,t){switch(e){case`ring`:return{dashes:1,track:0,arc:0,sweep:0,disc:0,tick:0,cross:0};case`arc`:return{dashes:0,track:1,arc:1,sweep:t===void 0?xG:Math.min(1,Math.max(0,t)),disc:0,tick:0,cross:0};case`check`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:1,cross:0};case`cross`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:0,cross:1}}}var CG=7.25;function wG({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(SG(t,n)).current,p=(0,J.useRef)(t),m=_S();(0,J.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=SG(t,n),y=p.current;p.current=t;let b=oS(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:fA:mA(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=mA(b,{ease:`inOutSine`,duration:220}),T=[fT(r,{opacity:v.dashes,...S}),fT(c,{opacity:v.track*.28,...S}),fT(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?fA:S:w}),fT(h,{r:v.disc*CG,...C?{delay:w.duration*.7,...pA(b,{bounce:.35,duration:360})}:m?fA:mA(b,{ease:`inCubic`,duration:140})}),fT(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...mA(b,{ease:`outCubic`,duration:240})}:fA}),fT(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...mA(b,{ease:`outCubic`,duration:240})}:fA})];return t===`cross`&&C&&b.shake>0&&T.push(fT(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...mA(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,J.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=oS(i.current),t=fT(c.current,{rotate:[0,360],...mA(e,{ease:`linear`,duration:900}),loop:!0}),n=ST(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,X.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,X.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,X.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,X.jsx)(`path`,{ref:u,d:`M4.9 8.3 7.1 10.5 11.2 5.9`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.tick}),(0,X.jsx)(`path`,{ref:d,d:`M5.4 5.4 10.6 10.6 M10.6 5.4 5.4 10.6`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.cross})]})]}),(0,X.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,X.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,X.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,X.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,X.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*CG,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var TG=new Set([`ring`,`arc`,`check`,`cross`]);function EG(e){return TG.has(e)}var DG={neutral:`text-base-content`,primary:`text-primary`,secondary:`text-secondary`,accent:`text-accent`,success:`text-success`,info:`text-info`,warning:`text-warning`,error:`text-error`},OG=(0,J.forwardRef)(function({className:e,label:t,glyph:n=`dot`,motion:r=`none`,tone:i=`neutral`,size:a=`default`,appearance:o=`plain`,progress:s,...c},l){return(0,X.jsxs)(`span`,{...c,className:Q(`caps-status`,a===`compact`&&`caps-status-compact`,o===`chip`&&`caps-status-chip`,e),"data-tone":o===`chip`?i:void 0,"data-glyph":n,"data-motion":r,ref:l,children:[EG(n)?(0,X.jsx)(wG,{className:DG[i],glyph:n,progress:s}):(0,X.jsx)(bG,{className:DG[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),kG={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},AG=(0,J.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,X.jsx)(NT,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Q(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Q(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,kG[n]),children:t})})}),jG=(0,J.forwardRef)(function({className:e,label:t,...n},r){return(0,X.jsx)(uG,{...n,ref:r,className:Q(`parakeet-composer-model-key`,e),label:t,readout:(0,X.jsx)(JU,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),MG=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),NG=(0,J.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,X.jsx)(`div`,{...r,ref:i,className:Q(`caps-popover`,e),"data-side":n}):null}),PG=(0,J.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function FG({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,J.useId)(),f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,J.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,J.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,J.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{e.target instanceof Node&&!f.current?.contains(e.target)&&n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[g,n]),(0,X.jsxs)(MG,{...u,ref:f,className:Q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,X.jsxs)(NG,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,X.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,X.jsx)(OG,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,X.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,X.jsx)(AG,{"aria-label":`Close tray`,icon:(0,X.jsx)(cW,{"aria-hidden":`true`}),onClick:_})]}),(0,X.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,X.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,X.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,X.jsxs)(X.Fragment,{children:[e.tone?(0,X.jsx)(OG,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,X.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,X.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,X.jsxs)(J.Fragment,{children:[a?a(r):(0,X.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function IG({children:e,className:t,...n}){return(0,X.jsx)(`div`,{...n,className:Q(`caps-status-tray-list`,t),children:e})}function LG({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,X.jsxs)(`div`,{...a,className:Q(`caps-status-tray-item`,i),children:[e?(0,X.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,X.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,X.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,X.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,X.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}var RG=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function zG(e,t){return`${e}-${String(t)}`}function BG(e){switch(e.key){case`ArrowDown`:return`next`;case`ArrowUp`:return`previous`;case`Enter`:return e.shiftKey?null:`accept`;case`Tab`:return`accept`;case`Escape`:return`dismiss`;default:return null}}function VG(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?zG(e.listId,e.selected):void 0}}function HG({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,X.jsx)(NG,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,X.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,X.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,X.jsxs)(PG,{id:zG(r,t),active:t===n,"aria-disabled":e.disabled===!0||void 0,"data-disabled":e.disabled===!0,onMouseEnter:()=>{c(t)},onClick:()=>{l(t)},children:[e.media===void 0?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,X.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,X.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,X.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var UG={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},WG={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function GG({state:e}){let t=`caps-checkbox-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=_S();return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=oS(n.current),c=mA(s,{ease:`inCubic`,duration:160}),l=fT(n.current,{d:{to:UG[e],...o?fA:mA(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?fA:t?mA(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...mA(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:cS(s,120),...pA(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,X.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(xT,{id:`${t}-goo`,values:WG}),(0,X.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,X.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,X.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,X.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,X.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,X.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,X.jsx)(`path`,{ref:n,d:UG[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,X.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,X.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,X.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var KG=(0,J.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,J.useRef)(null),[d,f]=(0,J.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,J.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,J.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,J.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,X.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,X.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Q(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,X.jsx)(GG,{state:m}):n]})}),qG=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`input caps-input w-full`,e),ref:r})});(0,J.forwardRef)(function({leading:e,className:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,X.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,X.jsx)(qG,{...n,type:`search`,className:t,ref:r})]})});var JG=`data-glide-stand-in`;function YG(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function XG(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function ZG(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?QG(n,e):null},[e])}function QG(e,t){if(!fS(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?YG(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(JG);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=oS(e),u=YG(e,t),d=o&&a?YG(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(JG,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(JG,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([XG(d),XG(u)],{duration:r.normal,easing:dS(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function $G({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,J.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}function eK(e){let{className:t,defaultValue:n,emptyMessage:r=`No options`,getKey:i,getLabel:a,id:o,isDisabled:s=()=>!1,items:c,multiple:l,onClick:u,onKeyDown:d,renderItem:f,rootRef:p,value:m,...h}=e,g=(0,J.useId)(),_=o??g,v=(0,J.useRef)(null);(0,J.useImperativeHandle)(p,()=>v.current);let y=ZG(`[role="option"][data-active]`),b=(0,J.useCallback)(e=>{v.current=e,y(e)},[y]),x=l===!0,S=x?[]:null,[C,w]=(0,J.useState)(()=>n??S),T=tK(nK(m,C),x),E=$G({getKey:i,isDisabled:s,items:c}),{enabledItems:D}=E,O=c.find(e=>T.includes(i(e))),{activeKey:k,activeItem:A,setActiveKey:j}=E,M=A,N=m===void 0?void 0:JSON.stringify(x?[...new Set(T)].sort():T),P=(0,J.useRef)(N),F=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(F.current||k!==null)return;let e=O??D[0];e&&(F.current=!0,j(i(e)))},[k,D,O,i,j]),(0,J.useEffect)(()=>{if(N!==void 0&&N!==P.current){let e=c.find(e=>T.includes(i(e))&&!s(e));j(e?i(e):null)}P.current=N},[N,i,s,c,T]);let ee=t=>{if(!t||s(t))return;let n=i(t),r;if(r=x?T.includes(n)?T.filter(e=>e!==n):[...T,n]:[n],e.multiple)m===void 0&&w(r),e.onValueChange?.(r,c.filter(e=>r.includes(i(e))));else{let n=r[0]??null;m===void 0&&w(n),e.onValueChange?.(n,t)}},I=e=>{if(d?.(e),!e.defaultPrevented&&e.key!==`Escape`){if(e.key===`Enter`||e.key===` `){e.preventDefault(),ee(M);return}if(D.length!==0){if(e.key===`ArrowDown`)E.move(1);else if(e.key===`ArrowUp`)E.move(-1);else if(e.key===`Home`)E.move(-1,`start`);else if(e.key===`End`)E.move(1,`end`);else return;e.preventDefault()}}};return(0,X.jsx)(`div`,{...h,"aria-activedescendant":M?`${_}-option-${encodeURIComponent(i(M))}`:void 0,"aria-multiselectable":x?!0:void 0,className:Q(`max-h-72 w-full overflow-auto rounded-box border border-base-300 bg-base-100 p-xs shadow-lg focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,t),id:_,onClick:u,onKeyDown:I,ref:b,role:`listbox`,tabIndex:h.tabIndex??0,children:c.length===0?(0,X.jsx)(`div`,{className:`px-md py-sm text-sm text-base-content`,children:r}):c.map(e=>{let t=i(e),n=s(e),r=T.includes(t),o=M?i(M)===t:!1,c={active:o,disabled:n,selected:r};return(0,X.jsx)(`div`,{"aria-disabled":n||void 0,"aria-selected":r,"data-active":o&&!n||void 0,className:Q(`cursor-pointer rounded-field px-md py-sm text-sm outline-none`,o&&`bg-base-200`,r&&`font-medium`,n&&`cursor-not-allowed bg-base-200 text-base-content outline outline-1 outline-dashed outline-base-300`),id:`${_}-option-${encodeURIComponent(t)}`,onClick:r=>{if(n){r.preventDefault();return}j(t),ee(e)},role:`option`,children:f?.(e,o,c)??a(e)},t)})})}function tK(e,t){return t?Array.isArray(e)?e.slice():[]:e==null||Array.isArray(e)?[]:[e]}function nK(e,t){switch(e){case void 0:return t;default:return e}}function rK({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(()=>t);return[i&&e!==void 0?e:a,J.useCallback(e=>{i||o(e)},[])]}function iK(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=rK({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=jB(a,!0,!0),u=qE(),[d,f]=J.useState(),p=d===null?void 0:d??u,m=GT(e=>{let t=!a,n=fz(mz,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return J.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var aK=J.createContext(void 0);function oK(){let e=J.useContext(aK);if(e===void 0)throw Error(nE(15));return e}var sK=`data-open`,cK=`data-closed`,lK=qD,uK=`data-panel-open`,dK={[sK]:``},fK={[cK]:``},pK={open(e){return e?{[uK]:``}:null}},mK={open(e){return e?dK:fK},...ZD},hK=J.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=GT(o),d=iK({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=J.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=J.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=ME(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:mK});return(0,X.jsx)(aK.Provider,{value:p,children:m})}),gK={...pK,...ZD},_K=J.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=oK(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=lz({disabled:c,native:u});return ME(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:gK})}),vK={height:void 0,width:void 0};function yK(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=J.useRef(null),f=J.useRef(null),[p,m]=J.useState(vK),h=J.useRef(vK),g=J.useRef(!1),_=J.useRef(s),v=J.useRef(!1),[y,b]=J.useState(!1),x=J.useRef(null),S=aE(t,d),C=kz(s),w=PB(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=GT((e,t=!0)=>{t&&(h.current=e),m(e)}),j=GT(()=>{x.current?.(),x.current=null}),M=GT(e=>{j(),x.current=()=>{x.current=null,e()}}),N=GT(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});zk(()=>{!y||u===`starting`||b(!1)},[y,u]),J.useEffect(()=>()=>{N(),j()},[N,j]),zk(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&j();let t=xK(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=bK(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(bK(e)),b(!0);return}if(t===`css-transition`){let t=wK(e);if(A(bK(e)),!n)return t;let r=CK(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(bK(e));let r=CK(e,`animation-name`,`none`);if(!n){r();return}let i=CK(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){A(vK,!1),c(!1);return}A(bK(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=bK(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&CK(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),FB({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(vK,!1)}}),J.useEffect(()=>{if(s||!a||E!==`ending`)return;if(!d.current){c(!1),A(vK,!1);return}let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(vK,!1))}return t=Nz.request(()=>{w(n,e.signal)}),()=>{Nz.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),zk(()=>{let e=d.current;!e||!n||!T||e.setAttribute(`hidden`,`until-found`)},[T,n]),J.useEffect(function(){let e=d.current;if(!e)return;let t=$T.create(),n=-1,r=(r,i)=>{t.start(0,()=>{C.current||(n=Nz.request(()=>{C.current||(r&&(g.current=!1),i&&e.setAttribute(lK,``),e.setAttribute(`hidden`,`until-found`))}))})},i=oA(e,`beforematch`,t=>{let n=fz(pz,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(lK);e.removeAttribute(lK),l(!0),r(!0,i)});return()=>{t.clear(),Nz.cancel(n),i()}},[C,o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[lK]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function bK(e){return{height:e.scrollHeight,width:e.scrollWidth}}function xK(e,t){let n=iD(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&SK(n.animationDuration),i=SK(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function SK(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function CK(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function wK(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=Nz.request(n);return()=>{Nz.cancel(r),n()}}var TK=`--collapsible-panel-height`,EK=`--collapsible-panel-width`,DK=J.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=oK(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;zk(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=yK({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=_E(s,k),j=ME(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[TK]:S===void 0?`auto`:`${S}px`,[EK]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:mK});return E?j:null}),OK=ib(`caps-disclosure`,{variants:{tone:{neutral:``,error:`caps-disclosure-error`},size:{group:`caps-disclosure-group`,row:`caps-disclosure-row`}},defaultVariants:{tone:`neutral`,size:`group`}});function kK({open:e,onOpenChange:t,summary:n,leading:r,trailing:i,children:a,tone:o,size:s,className:c}){return(0,X.jsxs)(hK,{className:Q(OK({tone:o,size:s}),c),onOpenChange:t,open:e,children:[(0,X.jsxs)(_K,{className:`caps-disclosure-trigger`,children:[r===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-leading`,children:r}),(0,X.jsx)(`span`,{className:`caps-disclosure-summary`,children:n}),i===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-trailing`,children:i}),(0,X.jsx)(YU,{"aria-hidden":`true`,className:`caps-disclosure-chevron`,size:12})]}),(0,X.jsx)(DK,{className:`caps-disclosure-panel`,children:a})]})}var AK=(0,J.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,X.jsxs)(`label`,{...i,className:Q(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,X.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),jK=(0,J.forwardRef)(function({children:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:J.Children.map(e,e=>(0,J.isValidElement)(e)?(0,J.cloneElement)(e,{className:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),MK=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function NK(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,J.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=_S(),[c,l]=(0,J.useState)(e),u=(0,J.useRef)(!0);return e&&!c&&l(!0),(0,J.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!fS(n)){e||l(!1);return}let i=oS(n),a=`translateY(${String(i.distance)}px)`,c=dS(i,i.ease),d=n.getBoundingClientRect().height,f=NK(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:dS(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,X.jsx)(`div`,{...i,ref:o,className:Q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var PK=(0,J.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,X.jsx)(`div`,{...r,ref:i,className:Q(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,X.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,J.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=_S(),[c,l]=(0,J.useState)({key:e,content:n}),[u,d]=(0,J.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,J.useRef)(null);return(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!fS(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=oS(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:dS(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:dS(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:dS(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,X.jsx)(`div`,{...i,ref:o,className:Q(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function FK({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(PK,{...t,className:Q(`caps-field-error-reveal`,t.className),open:!!e,children:(0,X.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function IK({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,X.jsxs)(`footer`,{...a,className:Q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,X.jsx)(FK,{children:n}),(0,X.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,X.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,X.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var LK=(0,J.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,X.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Q(`caps-form`,n),"data-layout":r,ref:a,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),RK={2:`h2`,3:`h3`,4:`h4`},zK=(0,J.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,J.useId)(),l=RK[i];return(0,X.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Q(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,X.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,X.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,X.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,X.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),BK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,layout:i,legend:a,legendTitle:o,...s},c){let l=(0,J.useId)(),u=[n?`${l}-description`:s[`aria-describedby`],r?`${l}-error`:null].filter(Boolean).join(` `)||void 0;return(0,X.jsxs)(`fieldset`,{...s,"aria-describedby":u,"aria-invalid":r?!0:s[`aria-invalid`],className:Q(`caps-fieldset`,t),"data-layout":i,ref:c,children:[(0,X.jsx)(`legend`,{className:`caps-fieldset-legend`,title:o,children:a}),n?(0,X.jsx)(`p`,{className:`caps-fieldset-description`,id:`${l}-description`,children:n}):null,(0,X.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,X.jsx)(FK,{id:`${l}-error`,children:r})]})});function VK(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==MK&&t.push(e)}),t[0]??null}var HK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,J.useId)(),m=(0,J.isValidElement)(e)?e:null,h=m?.type===jK,g=h?VK(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,J.cloneElement)(m,void 0,J.Children.map(m.props.children,e=>e===g?(0,J.cloneElement)(g,w):e)):(0,J.cloneElement)(m,w):e,E=a?(0,X.jsx)(AK,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,X.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,X.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,X.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,X.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,X.jsxs)(`div`,{...d,className:Q(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,X.jsxs)(X.Fragment,{children:[O,T]}),(0,X.jsx)(FK,{id:y,children:r})]})});function UK(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var WK=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,GK=6,KK=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),qK=(0,J.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,J.useState)(n),[y,b]=(0,J.useState)(null),x=p===void 0?_:p,S=UK(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,J.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/GK),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,X.jsxs)(`span`,{className:Q(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,X.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,X.jsx)(`path`,{className:`caps-number-field-dial-track`,d:WK,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:WK,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,X.jsx)(eW,{"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,X.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=KK.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,X.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,X.jsx)(nW,{"aria-hidden":`true`})})]})});function JK({request:e,trailing:t}){let[n,r]=(0,J.useState)(!1),i=e=>e===void 0?null:(0,X.jsx)(Nx,{density:`compact`,children:e.map(e=>(0,X.jsxs)(Px,{className:`after:hidden`,children:[(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:e.label}),` `,(0,X.jsx)(`span`,{className:`break-words`,children:e.value})]},e.label))});return(0,X.jsxs)(X.Fragment,{children:[t===void 0?(0,X.jsx)(`p`,{className:`font-medium`,children:e.message}):(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:e.message}),t]}),e.summary===void 0?null:(0,X.jsx)(`p`,{className:`text-sm opacity-70`,children:e.summary}),i(e.facts),e.body===void 0?null:(0,X.jsxs)(`p`,{className:`line-clamp-3 whitespace-pre-line break-words`,children:[e.bodyLabel===void 0?null:(0,X.jsxs)(`span`,{className:`text-sm opacity-70`,children:[e.bodyLabel,` `]}),e.body]}),e.details===void 0&&e.body===void 0?null:(0,X.jsxs)(kK,{open:n,onOpenChange:r,summary:`Details`,children:[e.body===void 0?null:(0,X.jsx)(`p`,{className:`whitespace-pre-line break-words`,children:e.body}),i(e.details)]})]})}function YK({host:e,pending:t}){let[n,r]=(0,J.useState)(``),i=t.request;return i.type===`choice`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(JK,{request:i}),(0,X.jsx)(eK,{"aria-label":i.message,items:i.options,getKey:e=>e.value,getLabel:e=>e.label,onValueChange:n=>{n!==null&&e.answer(t.sequence,n)},renderItem:e=>(0,X.jsxs)(`span`,{className:`flex flex-col${e.destructive===!0?` text-error`:``}`,children:[(0,X.jsxs)(`span`,{children:[e.value===i.current?`● `:``,e.label]}),e.description===void 0?null:(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:e.description})]})})]}):i.type===`confirmation`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(JK,{request:i}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[(0,X.jsx)(NT,{autoFocus:i.destructive===!0,variant:`ghost`,onClick:()=>e.answer(t.sequence,!1),children:i.cancelLabel??`Cancel`}),(0,X.jsx)(NT,{variant:i.destructive===!0?`destructive`:`primary`,onClick:()=>e.answer(t.sequence,!0),children:i.confirmLabel??`Confirm`})]})]}):i.type===`decision`?null:(0,X.jsxs)(`form`,{className:`flex flex-col gap-sm`,onSubmit:r=>{r.preventDefault(),e.answer(t.sequence,n)},children:[i.summary===void 0&&i.facts===void 0&&i.body===void 0?null:(0,X.jsx)(JK,{request:i}),(0,X.jsx)(HK,{label:i.message,children:(0,X.jsx)(qG,{autoComplete:`off`,autoFocus:!0,placeholder:i.placeholder,type:i.secret===!0?`password`:`text`,value:n,onChange:e=>{r(e.target.value)}})}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(NT,{type:`submit`,children:`Continue`})})]})}function XK({host:e,onClose:t}){let n=(0,J.useSyncExternalStore)(e.subscribe,e.snapshot),r=n.status===`working`||n.status===`prompting`;return(0,X.jsxs)(`section`,{"aria-label":n.title,className:`flex flex-col gap-sm`,"data-status":n.status,children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:n.title}),n.handoff===void 0?null:(0,X.jsx)(yA,{density:`compact`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs p-sm`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:n.handoff.message??(n.handoff.code===void 0?`Continue in your browser`:`Open this page and enter the code`)}),(0,X.jsx)(`a`,{className:`link break-all font-mono`,href:n.handoff.url,rel:`noreferrer`,target:`_blank`,children:n.handoff.url}),n.handoff.code===void 0?null:(0,X.jsx)(`span`,{className:`font-mono text-2xl tracking-widest`,children:n.handoff.code})]})}),n.message===void 0||n.status===`failed`?null:(0,X.jsxs)(`p`,{className:`flex items-center gap-xs`,children:[(0,X.jsx)(OG,{tone:n.message.type===`success`?`success`:`info`,motion:n.message.type===`progress`&&r?`pulse`:`none`}),n.message.message]}),n.links.map(e=>(0,X.jsx)(`a`,{className:`link break-all`,href:e.url,rel:`noreferrer`,target:`_blank`,children:e.label??e.url},e.url)),n.prompt===void 0?null:(0,X.jsx)(YK,{host:e,pending:n.prompt},n.prompt.sequence),n.status===`failed`?(0,X.jsx)(Mx,{tone:`error`,title:`That did not work`,description:n.failure}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[r?(0,X.jsx)(NT,{variant:`ghost`,onClick:e.cancel,children:`Cancel`}):null,n.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(NT,{variant:`ghost`,onClick:()=>{e.cancel(),t?.()},children:`Close`}),n.retryable?(0,X.jsx)(NT,{onClick:e.retry,children:`Try again`}):null]}):null,n.status===`done`||n.status===`cancelled`?(0,X.jsx)(NT,{onClick:t,children:`Done`}):null]})]})}var ZK={question:`Question`,approval:`Approval`};function QK({item:e,position:t,total:n,onLater:r,takeFocus:i}){let a=$R(e,{position:t,total:n,later:r});return a.view===void 0?null:(0,X.jsx)($K,{view:a.view,dispatch:a.dispatch,onLater:a.later,takeFocus:i})}function $K({view:e,dispatch:t,onLater:n,takeFocus:r}){let i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=e.phase===`other`,s=(0,J.useRef)(!1);(0,J.useEffect)(()=>{r&&i.current?.focus()},[r]),(0,J.useEffect)(()=>{o?a.current?.focus():s.current&&document.activeElement===a.current&&i.current?.focus(),s.current=o},[o]);let c=e.rows,l=e.other,u=e.phase===`sending`,d=(e,t,n)=>t?(e.preventDefault(),n(),!0):!1,f=e=>{if(e.target instanceof HTMLInputElement||oG(e)||e.ctrlKey||e.metaKey||e.altKey)return;let{key:n}=e;d(e,n===`ArrowDown`,()=>{t({type:`move`,delta:1})})||d(e,n===`ArrowUp`,()=>{t({type:`move`,delta:-1})})||d(e,n===`Enter`,()=>{t({type:`enter`})})||d(e,n===` `,()=>{t({type:`toggle`})})||d(e,n===`Escape`,()=>{t({type:`escape`})})||d(e,/^[1-9]$/u.test(n),()=>{t({type:`pick`,number:Number(n)})})||d(e,n.length===1,()=>{t({type:`append`,text:n})})},p=e=>{if(oG(e))return;let{key:n}=e;d(e,n===`ArrowDown`,()=>{t({type:`move`,delta:1})})||d(e,n===`ArrowUp`,()=>{t({type:`move`,delta:-1})})||d(e,n===`Enter`,()=>{t({type:`enter`})})||d(e,n===`Escape`,()=>{t({type:`escape`})})},m=e=>(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none flex shrink-0`,children:(0,X.jsx)(KG,{checked:e.toggled,readOnly:!0,tabIndex:-1})}),h=t=>(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:t.destructive?`text-error`:void 0,children:e.multiple?t.caption:t.text}),t.description===void 0?null:(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:t.description})]}),g=t=>e.multiple?(0,X.jsxs)(`span`,{className:`flex items-start gap-xs`,children:[m(t),h(t)]}):h(t),_=c.find(e=>e.highlighted);return(0,X.jsxs)(`div`,{"aria-label":e.label,className:`parakeet-decision flex flex-col gap-xs p-sm`,"data-kind":e.kind,"data-phase":e.phase,role:`group`,children:[(0,X.jsx)(JK,{request:{message:e.title,summary:e.summary,facts:e.facts,body:e.body,bodyLabel:e.bodyLabel,details:e.details.length===0?void 0:e.details},trailing:(0,X.jsx)(`span`,{className:`shrink-0 text-sm opacity-70`,children:e.counter??ZK[e.kind]})}),(0,X.jsx)(eK,{"aria-label":e.title,className:`parakeet-decision-list`,getKey:e=>String(e.index),getLabel:e=>e.label,isDisabled:()=>u,items:c,rootRef:i,renderItem:n=>n.kind===`other`&&l!==void 0?(0,X.jsxs)(`span`,{className:`flex items-center gap-xs`,"data-highlight":n.highlighted||void 0,"data-row":`other`,children:[e.multiple?m(n):null,(0,X.jsx)(`span`,{className:`shrink-0`,children:e.multiple?n.caption:n.text}),n.highlighted||l.text!==``?(0,X.jsx)(qG,{"aria-label":l.label,autoComplete:`off`,disabled:u,maxLength:l.maxLength,onChange:e=>{t({type:`type`,text:e.target.value})},onKeyDown:p,placeholder:l.placeholder,ref:a,value:l.text}):null]}):(0,X.jsx)(`span`,{"data-highlight":n.highlighted||void 0,children:g(n)}),onKeyDown:f,...e.multiple?{multiple:!0,value:c.filter(e=>e.toggled).map(e=>String(e.index)),onValueChange:(e,n)=>{let r=c.find(e=>n.some(t=>t.index===e.index)!==e.toggled);r!==void 0&&(t({type:`pick`,number:r.index+1}),r.kind===`option`&&t({type:`toggle`}))}}:{value:_===void 0?null:String(_.index),onValueChange:(e,n)=>{n!==null&&t({type:`pick`,number:n.index+1})}}}),e.status===void 0?null:(0,X.jsx)(`p`,{className:e.status.tone===`error`?`text-sm text-error`:`text-sm opacity-70`,role:e.status.tone===`error`?`alert`:`status`,children:e.status.text}),(0,X.jsxs)(`div`,{className:`parakeet-decision-actions`,children:[(0,X.jsx)(uG,{label:`Later`,tone:`neutral`,onClick:n}),(0,X.jsx)(uG,{disabled:!e.canSend,label:`Send`,onClick:()=>{t({type:`enter`})},tone:`primary`})]})]})}function eq(e,t){if(t.length===0)return e;let n=new Set(t),r=[];for(let t=0;t<e.length;t+=1){let i=n.has(t),a=r.at(-1);a?.marked===i?a.text+=e.charAt(t):r.push({text:e.charAt(t),marked:i,start:t})}return r.map(e=>e.marked?(0,X.jsx)(`mark`,{className:`parakeet-slash-match`,children:e.text},e.start):(0,X.jsx)(`span`,{children:e.text},e.start))}function tq({slash:e,listId:t}){let{completion:n}=e;if(n.kind===`none`)return null;let r=n.kind===`commands`?n.items.map(e=>({key:e.command.commandId+e.label,label:eq(e.label,e.matches),detail:e.command.grammar===void 0?e.command.title:`${e.command.title} · ${e.command.grammar.hint}`,keys:e.command.keys.join(`, `),disabled:e.command.availability.status===`unavailable`})):n.items.map(e=>({key:e.label,label:eq(e.label,e.matches),detail:e.word.description??``,keys:``,disabled:!1}));return(0,X.jsx)(HG,{open:e.open,rows:r,selected:e.selected,listId:t,label:`Commands`,kind:n.kind,hint:n.kind===`arguments`?n.hint:void 0,onHighlight:e.highlight,onChoose:e.choose})}var nq=(0,J.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Q(`caps-composer`,n),children:[t===void 0?null:(0,X.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,X.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,X.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,X.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function rq({draft:e,hasAttachments:t=!1,busy:n,queueWhileBusy:r=!1,blocked:i=!1}){let a=!i&&(e.trim().length>0||t);return n&&(!r||!a)?`busy`:a?`ready`:`empty`}function iq({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,X.jsxs)(MG,{className:`parakeet-composer-anchor`,children:[a,(0,X.jsxs)(Lx,{...s,className:Q(`parakeet-composer-shell`,r),children:[(0,X.jsx)(nq,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,X.jsx)(FG,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,X.jsx)(uG,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,X.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,X.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,X.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}function aq(e,t){(0,J.useLayoutEffect)(()=>{let t=e.current;t&&(t.style.height=`auto`,t.style.height=`${String(t.scrollHeight)}px`)},[e,t])}var oq={connecting:{busy:!1,tone:`neutral`},cancelling:{busy:!0,tone:`warning`},error:{busy:!1,tone:`error`},idle:{busy:!1,tone:`neutral`},queued:{busy:!0,tone:`warning`},retrying:{busy:!0,tone:`warning`},sending:{busy:!0,tone:`success`},streaming:{busy:!0,tone:`success`},thinking:{busy:!0,tone:`warning`},disconnected:{busy:!1,tone:`neutral`}};function sq({placeholder:e,onChange:t,onSend:n,onAbort:r,slash:i,slashListId:a,textareaId:o,textareaRef:s,value:c,queuedRecall:l}){let u=(0,J.useRef)(c),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(-1);u.current=c;let h=l?.recallState,g=h?.kind===`recalling`;(0,J.useLayoutEffect)(()=>{if(h?.kind!==`restored`)return;m(-1);let e=s.current;e!==null&&e.setSelectionRange(e.value.length,e.value.length)},[h,s]),aq(s,c);let _=(0,J.useCallback)(()=>{let e=u.current.trim();!e&&(l?.images?.length??0)===0||(n(),e&&f(t=>t.at(-1)===e?t:[...t,e]),m(-1))},[n,l?.images?.length]),v=(0,J.useCallback)(e=>{if(!oG(e)&&!g){if(i?.open===!0){let t=BG(e);if(t===`next`?i.move(1):t===`previous`?i.move(-1):e.key===`Tab`?i.complete():t===`dismiss`&&i.dismiss()){e.preventDefault();return}}if(e.key===`Escape`){e.preventDefault(),r();return}if(l!==void 0&&e.key===`ArrowUp`&&!e.repeat&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&i?.open!==!0&&u.current===``&&(l.images?.length??0)===0&&document.activeElement===e.currentTarget){e.preventDefault();let n=e.currentTarget;l.recall().then(e=>{if(e!==`empty`||!n.isConnected||n.value!==``||s.current!==n||d.length===0)return;let r=p===-1?d.length-1:p-1,i=d[r];i!==void 0&&(m(r),t(i))});return}if(e.key===`Enter`&&!e.shiftKey&&!window.matchMedia(`(pointer: coarse)`).matches){e.preventDefault(),_();return}if(e.key===`ArrowUp`&&s.current?.selectionStart===0&&d.length>0&&(p===-1||p>0)){e.preventDefault();let n=p===-1?d.length-1:p-1;m(n);let r=d[n];r!==void 0&&t(r);return}if(e.key===`ArrowDown`&&p!==-1){e.preventDefault();let n=p+1;if(n>=d.length)m(-1),t(``);else{m(n);let e=d[n];e!==void 0&&t(e)}}}},[d,p,r,t,_,i,s,l,g]),y=i?.open===!0&&i.completion.kind!==`none`&&i.completion.items.length>0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:o,children:`Message`}),(0,X.jsx)(RG,{"aria-describedby":[i===void 0?void 0:`${o}-guidance`,l===void 0?void 0:`${o}-recall-guidance`].filter(e=>e!==void 0).join(` `)||void 0,"aria-busy":g,readOnly:g,...i===void 0?{}:VG({open:y,listId:a,selected:i.selected}),className:`font-sans text-base-content`,id:o,onChange:e=>{t(e.target.value),m(-1)},onKeyDown:v,placeholder:e??(i===void 0?`Ask agent...`:`Ask agent… (/ for commands)`),ref:s,rows:1,value:c}),l===void 0?null:(0,X.jsx)(`span`,{id:`${o}-recall-guidance`,className:`sr-only`,children:`Press Up on an empty composer to recall your newest queued message.`})]})}function cq(e,t){if(t.kind===`connecting`)return`connecting`;if(t.kind===`disconnected`)return`unavailable`;if(e===`sending`)return`sending prompt`;if(e===`queued`&&(t.kind===`idle`||t.kind===`waiting_for_you`||t.kind===`error`))return`prompt accepted`;switch(t.kind){case`waiting_for_you`:return`waiting for you`;case`responding`:return`writing`;case`running_tool`:return`running ${t.tool}`;case`retrying`:return`retrying ${String(t.attempt)}/${String(t.maxAttempts)}`;case`error`:return`failed`;case`queued`:return`queued`;case`cancelling`:return`cancelling`;case`compacting`:return`compacting`;case`thinking`:return`thinking`;case`idle`:return`idle`}}async function lq(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e of t)n+=String.fromCharCode(e);return{type:`image`,mimeType:e.type,data:btoa(n)}}var uq=[{alias:`thinking`,label:`Thinking level…`},{alias:`compact`,label:`Compact context`}];function dq({showFooter:e,statusChips:t,model:n,status:r,viewState:i,usage:a,context:o,slash:s,attach:c,send:l}){let[u,d]=(0,J.useState)(null);if(!e)return;let f=i.kind===`error`?`error`:oq[r].tone,p=cq(`idle`,i),m=i.kind===`waiting_for_you`||i.kind===`error`,h=n===void 0?void 0:iG(n),g=o===void 0?void 0:DA(o),_=a===void 0?void 0:`${HW(a.tokens)} · ${vG(a.cost)}`,v=uq.filter(({alias:e})=>s?.available(e)===!0);return{items:_===void 0&&g===void 0&&v.length===0&&h===void 0?[]:[{id:`settings`,label:(0,X.jsxs)(`span`,{className:`composer-settings-chip`,children:[(0,X.jsx)(iW,{"aria-hidden":`true`}),`Settings`]}),accessibleLabel:`Session settings`,title:`Settings`,content:(0,X.jsxs)(IG,{className:`composer-settings`,children:[h===void 0?null:(0,X.jsx)(LG,{primary:`Model`,secondary:h}),g===void 0?null:(0,X.jsx)(LG,{primary:`Context`,secondary:g,title:`Context used / model context`}),_===void 0?null:(0,X.jsx)(LG,{primary:`Usage`,secondary:_}),v.map(({alias:e,label:t})=>(0,X.jsx)(LG,{primary:t,actions:(0,X.jsx)(NT,{size:`xs`,variant:`ghost`,onClick:()=>{d(null),s?.runCommand(e)},children:`Open`})},e))]})}],openId:u,onOpenChange:d,action:l,controls:(0,X.jsxs)(X.Fragment,{children:[c,h===void 0?null:(0,X.jsx)(jG,{"aria-label":`Model: ${h}. Open settings`,"aria-haspopup":`dialog`,expanded:u===`settings`,label:h,onClick:()=>{d(e=>e===`settings`?null:`settings`)},title:`${h} · Settings`}),t?.map((e,t)=>(0,X.jsx)(`span`,{className:`composer-status-chip min-w-0 truncate`,title:e,children:e},t))]}),status:m?(0,X.jsx)(OG,{className:`parakeet-composer-status`,label:(0,X.jsx)(`span`,{className:`composer-attention-label`,children:p}),title:p,tone:f}):null,readout:_===void 0?void 0:(0,X.jsx)(`span`,{title:`Tokens · cost`,children:_})}}function fq({images:e,onRemove:t}){return(0,X.jsx)(`ul`,{"aria-label":`Attached images`,className:`composer-attachments`,children:e.map((e,n)=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`img`,{alt:`Attached image ${String(n+1)}`,className:`mask mask-squircle`,src:`data:${e.mimeType};base64,${e.data}`}),t===void 0?null:(0,X.jsx)(AG,{"aria-label":`Remove attached image ${String(n+1)}`,className:`composer-attachment-remove`,icon:(0,X.jsx)(cW,{}),onClick:()=>{t(n)},size:`xs`,variant:`outline`})]},n))})}var pq=(0,J.memo)(function({queuedRecall:e,onImagesChange:t,placeholder:n,showFooter:r=!0,statusChips:i,actionVariant:a=`primary`,draft:o,failure:s,failureCause:c,admissionError:l,model:u,onAbort:d,onChange:f,onRetry:p,onSend:m,status:h,viewState:g,textareaRef:_,usage:v,context:y,slash:b}){let x=(0,J.useId)(),S=`${x}-commands`,C=(0,J.useRef)(null),{busy:w}=oq[h],T=b===void 0?void 0:WL(b.awaiting,o),E=T?.key,D=(0,J.useRef)(void 0),O=(0,J.useRef)(!1);D.current!==E&&(D.current=E,O.current=E!==void 0&&document.activeElement===_.current);let k=O.current;(0,J.useEffect)(()=>{E===void 0&&k&&_.current?.focus()},[E,k,_]);let A=e?.images??[],j=e?.recallState.kind===`recalling`,M=rq({draft:o,hasAttachments:A.length>0,busy:w,queueWhileBusy:!0,blocked:j}),N=w?`Queue follow-up`:`Send message`,P=(0,X.jsx)(hG,{"aria-label":N,className:`composer-send-key`,disabled:M===`busy`&&(j||h===`queued`||h===`cancelling`),onClick:()=>{m(w?`followUp`:`steer`)},onStop:d,state:M,stopLabel:`Stop current turn`,title:M===`busy`?`Stop the current turn. Queued messages keep running in order.`:N,tone:a===`primary`?`primary`:`neutral`}),F=t===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{accept:`image/png,image/jpeg,image/gif,image/webp`,"aria-label":`Choose images to attach`,hidden:!0,multiple:!0,onChange:e=>{let n=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,Promise.all(n.map(lq)).then(e=>{t([...A,...e])})},ref:C,type:`file`}),(0,X.jsx)(uG,{"aria-label":`Attach images`,className:`composer-attach-key`,icon:(0,X.jsx)(nW,{}),label:null,onClick:()=>C.current?.click(),title:`Attach images`})]}),ee={status:h,viewState:g};ee.statusChips=i,u&&(ee.model=u),v&&(ee.usage=v),y&&(ee.context=y);let I=dq({...ee,showFooter:r,slash:b,attach:F,send:P});return(0,X.jsxs)(`div`,{className:`chat-composer not-prose flex-shrink-0`,children:[l===void 0?null:(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-error`,role:`alert`,children:l===`offline_queue_full`?`One prompt is already queued; it sends when the service is back.`:`Too many prompts are still awaiting admission. Try again shortly.`}),s===void 0?null:(0,X.jsx)(cG,{failure:s,cause:c,onRetry:p}),b?.interactions.notice===void 0?null:(0,X.jsx)(`div`,{className:`parakeet-command-notice px-3 py-1.5 text-xs`,"data-tone":b.interactions.notice.tone,role:b.interactions.notice.tone===`error`?`alert`:`status`,children:b.interactions.notice.message}),(0,X.jsx)(`div`,{"aria-live":`polite`,className:`sr-only`,children:T===void 0||b===void 0?``:`Agent ${T.kind} ${String(b.awaiting.position)} of ${String(b.awaiting.total)} needs your answer`}),(0,X.jsx)(iq,{"aria-label":`Message composer`,action:T===void 0&&I===void 0?P:void 0,menu:b===void 0?void 0:(0,X.jsx)(tq,{slash:b,listId:S}),attachments:T===void 0&&A.length>0?(0,X.jsx)(fq,{images:A,onRemove:t===void 0?void 0:e=>{t(A.filter((t,n)=>n!==e))}}):void 0,input:(0,X.jsxs)(X.Fragment,{children:[T===void 0||b===void 0?null:(0,X.jsx)(QK,{item:T,position:b.awaiting.position,total:b.awaiting.total,onLater:()=>{b.store.awaiting.later(T.key)},takeFocus:O.current},T.key),(0,X.jsx)(`div`,{hidden:T!==void 0,children:(0,X.jsx)(sq,{queuedRecall:e,placeholder:n,onChange:f,onAbort:d,onSend:()=>{m(w?`followUp`:`steer`)},slash:b,slashListId:S,textareaId:x,textareaRef:_,value:o})})]}),row:T===void 0?I:void 0}),b===void 0?null:(0,X.jsx)(`p`,{className:`sr-only`,id:`${x}-guidance`,children:LL(b.hints)})]})}),mq={attention:`text-warning`,running:`text-info`,error:`text-error`,settled:`text-success`,muted:`text-dim`};function hq({entryId:e,rows:t,actions:n,onOpen:r}){let i=ZF(),{inspection:a}=(0,J.useSyncExternalStore)(i.subscribe,i.snapshot,i.snapshot);return t.length===0?null:(0,X.jsx)(`div`,{className:`px-3 text-xs text-base-content`,"data-client-entry":e,children:t.map(t=>{let o=t.open===void 0&&t.inspection===void 0&&t.actions?.length===1&&t.actions[0]?.awaiting!==void 0?t.actions[0]:void 0;if(o!==void 0){let r=n.state.get(o);return(0,X.jsxs)(`div`,{"data-client-row":t.id,children:[(0,X.jsxs)(NT,{size:`xs`,variant:`ghost`,className:`-mx-xs flex w-[calc(100%+2*var(--spacing-xs))] justify-start gap-2 px-xs font-normal`,disabled:!n.enabled||r?.pending===!0,loading:r?.pending===!0,onClick:()=>{n.execute(e,o)},children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-client-row-dot":``,className:`w-3 shrink-0 text-center ${t.tone===void 0?``:mq[t.tone]}`,children:t.tone===void 0?``:`●`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-start ${t.tone===void 0?``:mq[t.tone]}`,children:[t.title,t.detail===void 0?null:(0,X.jsxs)(`span`,{className:`text-dim`,children:[` · `,t.detail]})]}),(0,X.jsx)(`span`,{className:`shrink-0 text-dim`,"data-client-row-action":``,children:o.label})]}),r?.error===void 0?null:(0,X.jsx)(`p`,{className:`text-error`,role:`alert`,children:r.error})]},t.id)}return(0,X.jsxs)(`div`,{"data-client-row":t.id,className:`py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-client-row-dot":``,className:`w-3 shrink-0 text-center leading-4 ${t.tone===void 0?``:mq[t.tone]}`,children:t.tone===void 0?``:`●`}),(0,X.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`summary`,{className:`cursor-pointer break-words leading-4 ${t.tone===void 0?``:mq[t.tone]}`,children:[t.title,t.inspection===void 0||t.detail===void 0?null:` · ${t.detail}`]}),t.detail===void 0?null:(0,X.jsx)(`p`,{className:`max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words pb-2`,children:t.detail})]}),t.open===void 0?null:(0,X.jsx)(NT,{size:`xs`,variant:`outline`,disabled:r===void 0,onClick:()=>{t.open!==void 0&&r?.(t.open)},children:`Open`}),t.actions?.map(t=>{let r=n.state.get(t);return(0,X.jsx)(NT,{size:`xs`,variant:`outline`,className:`shrink-0`,disabled:!n.enabled||r?.pending===!0,loading:r?.pending===!0,onClick:()=>{n.execute(e,t)},children:t.label},t.id)})]}),t.inspection!==void 0&&a?.entryId===e&&a.rowId===t.id?(0,X.jsxs)(`section`,{"aria-label":t.title,"data-client-inspection":t.id,children:[(0,X.jsx)(Fx,{aside:(0,X.jsx)(NT,{size:`xs`,variant:`ghost`,onClick:()=>{i.inspect(void 0)},children:`Close`}),children:t.title}),(0,X.jsx)(Nx,{density:`compact`,tabIndex:0,className:`max-h-64 overflow-y-auto overscroll-contain`,children:t.inspection.rows.map(e=>(0,X.jsxs)(Px,{children:[(0,X.jsx)(OG,{glyph:`dot`,size:`compact`,tone:e.tone===`settled`?`success`:e.tone===`running`?`info`:e.tone===`error`?`error`:e.tone===`attention`?`warning`:`neutral`,label:e.title}),e.detail===void 0?null:(0,X.jsx)(`span`,{children:e.detail})]},e.id))})]}):null,t.actions?.map(e=>{let t=n.state.get(e)?.error;return t===void 0?null:(0,X.jsx)(`p`,{className:`text-error`,role:`alert`,children:t},e.id)})]},t.id)})})}var gq={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},_q=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,vq=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function yq({transform:e,fill:t=_q}){return(0,X.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function bq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(yq,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(yq,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(yq,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function xq(){return(0,X.jsxs)(`g`,{style:{fill:gq.blue},children:[(0,X.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,X.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,X.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,X.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function Sq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,X.jsx)(`path`,{style:{fill:gq.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function Cq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function wq({fill:e}){return(0,X.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function Tq({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?vq:gq.ink},children:[(0,X.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,X.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function Eq(){return(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function Dq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,X.jsx)(`path`,{style:{fill:gq.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function Oq(){return(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function kq({transform:e}){return(0,X.jsx)(`path`,{style:{fill:gq.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function Aq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:_q},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,X.jsx)(`path`,{style:{fill:gq.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function jq(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:_q},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,X.jsx)(`path`,{style:{fill:gq.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,X.jsx)(`path`,{style:{fill:gq.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,X.jsx)(`path`,{style:{fill:gq.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function Mq(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,X.jsx)(`path`,{style:{fill:gq.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,X.jsxs)(`g`,{style:{fill:gq.cream},children:[(0,X.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,X.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,X.jsxs)(`g`,{style:{fill:gq.ink},transform:`rotate(-11 470 411)`,children:[(0,X.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function Nq(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:gq.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,X.jsxs)(`g`,{style:{fill:gq.coral},children:[(0,X.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,X.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,X.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,X.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,X.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,X.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,X.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,X.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function Pq(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,X.jsx)(`path`,{style:{fill:gq.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:gq.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:Fq,blue:Iq,mint:Lq,grape:Rq,yellow:zq,cream:Bq,ink:Vq}=gq,Hq={bonsai:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,X.jsx)(`path`,{fill:Lq,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:zq,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:zq,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,X.jsx)(`path`,{fill:Fq,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,X.jsx)(`rect`,{fill:Fq,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,X.jsx)(Mq,{}),prints:(0,X.jsx)(Nq,{}),inkcap:(0,X.jsx)(Pq,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Fq},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:Iq},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:zq},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(Aq,{}),generateMedia:(0,X.jsx)(jq,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:zq,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:Bq,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:Iq,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:Fq,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,X.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,X.jsx)(`rect`,{fill:Iq,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:Iq,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:Bq,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:Fq,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:Fq,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,X.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,X.jsx)(Sq,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:Iq,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(Tq,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:Iq},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:Bq},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,X.jsx)(`path`,{style:{fill:Fq},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:Fq},children:[(0,X.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,X.jsx)(`path`,{style:{stroke:Iq},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,X.jsx)(Cq,{})}),(0,X.jsx)(yq,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(yq,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,X.jsx)(xq,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(Sq,{})}),(0,X.jsx)(bq,{})]}),readConversations:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,X.jsx)(wq,{fill:Iq})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(Sq,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:_q},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,X.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,X.jsx)(Tq,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:Fq},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,X.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,X.jsx)(Tq,{})}),(0,X.jsx)(`path`,{style:{fill:Iq},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(Tq,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:_q},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,X.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,X.jsx)(Tq,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:Lq},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,X.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,X.jsx)(Tq,{})}),(0,X.jsx)(yq,{fill:zq,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,X.jsx)(wq,{fill:Fq})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(Eq,{})}),(0,X.jsx)(yq,{fill:Lq,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(yq,{fill:Lq,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Dq,{}),(0,X.jsx)(Oq,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:Iq},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:Bq},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),connected:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Iq},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Fq},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:zq},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{style:{fill:Lq},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:zq},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:Rq},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:_q},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Lq},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Vq},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:_q},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`rect`,{style:{fill:Iq},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:Bq},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:Lq},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:Rq},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:Fq},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Fq},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:Fq},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:Bq},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:Fq},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:Bq},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:Bq},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`g`,{fill:zq,children:[(0,X.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Lq,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,X.jsx)(kq,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,X.jsx)(kq,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,X.jsx)(kq,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,X.jsx)(kq,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,X.jsx)(kq,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`31.9`,cy:`18.8`,r:`4`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`32`,cy:`32.3`,r:`4`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:Iq,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,X.jsx)(`ellipse`,{fill:Vq,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,X.jsx)(`path`,{fill:Vq,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,X.jsx)(`ellipse`,{fill:zq,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:Rq,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,X.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,X.jsx)(`path`,{fill:Rq,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Bq,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,X.jsx)(`path`,{fill:zq,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,X.jsx)(`path`,{fill:Fq,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,X.jsx)(`path`,{fill:Iq,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,X.jsx)(`path`,{fill:Bq,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,X.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,X.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,X.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,X.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,X.jsx)(`circle`,{fill:Fq,cx:`21.7`,cy:`26.6`,r:`1`}),(0,X.jsx)(`circle`,{fill:zq,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,X.jsxs)(`g`,{fill:Lq,children:[(0,X.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,X.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5L12 41Z`}),(0,X.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,X.jsx)(`ellipse`,{fill:Lq,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,X.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,X.jsx)(`path`,{fill:Fq,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Fq,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,X.jsx)(`rect`,{fill:Iq,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,X.jsx)(`rect`,{fill:Lq,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,X.jsx)(`rect`,{fill:zq,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:Iq,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Fq,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,X.jsx)(`ellipse`,{fill:Iq,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Fq,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,X.jsx)(`path`,{fill:Bq,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,X.jsx)(`circle`,{fill:zq,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Rq,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:Lq,cx:`32`,cy:`34.9`,r:`14.5`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:Bq,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,X.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:`none`,stroke:zq,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,X.jsx)(`circle`,{fill:Iq,cx:`32`,cy:`32`,r:`21.1`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:Bq,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,X.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:zq,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`circle`,{fill:Iq,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,X.jsx)(`path`,{fill:Iq,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,X.jsx)(`circle`,{fill:Fq,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,X.jsx)(`path`,{fill:Fq,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,X.jsxs)(`g`,{fill:Vq,children:[(0,X.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,X.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:zq,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,X.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,X.jsx)(`path`,{fill:zq,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,X.jsx)(`ellipse`,{fill:Bq,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,X.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,X.jsx)(`path`,{fill:Fq,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,X.jsx)(`circle`,{fill:Bq,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,X.jsx)(yq,{fill:zq,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,X.jsx)(yq,{fill:zq,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:Bq,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,X.jsx)(`path`,{fill:Fq,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,X.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,X.jsxs)(`g`,{fill:Iq,children:[(0,X.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,X.jsxs)(`g`,{fill:Lq,children:[(0,X.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsxs)(`g`,{fill:Rq,children:[(0,X.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsx)(`circle`,{fill:zq,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,X.jsx)(`path`,{fill:`none`,stroke:Vq,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,X.jsx)(`circle`,{fill:Vq,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),loop:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{stroke:Fq},strokeWidth:`6`,strokeLinecap:`round`,d:`M47.5 14.5C43 11 37.5 9 32 9 19.5 9 9 19.5 9 32S19.5 55 32 55 55 44.5 55 32`}),(0,X.jsx)(`path`,{style:{fill:Fq},d:`M53.5 21.5Q54.5 20 55 22L58 33Q58.5 35 56.5 34.5L48.5 32.5Q47 32 48 30.5Z`}),(0,X.jsx)(`g`,{transform:`translate(18 21) scale(.28)`,children:(0,X.jsx)(wq,{fill:Iq})}),(0,X.jsxs)(`g`,{style:{fill:Bq},children:[(0,X.jsx)(`rect`,{x:`25`,y:`27.5`,width:`14`,height:`3`,rx:`1.5`}),(0,X.jsx)(`rect`,{x:`25`,y:`33.5`,width:`9`,height:`3`,rx:`1.5`})]})]}),fungi:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:Bq,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,X.jsx)(`path`,{fill:Fq,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,X.jsxs)(`g`,{fill:Bq,children:[(0,X.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,X.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,X.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,X.jsxs)(`g`,{fill:Vq,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,X.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,X.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,X.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function Uq({name:e,size:t}){return(0,X.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:Hq[e]})}function Wq({children:e,...t}){return(0,J.createElement)(J.Fragment,null,Gq(e,t))}function Gq(e,t={}){return(typeof e==`string`?MR(e,t):e).children.map((e,n)=>Kq(e,t,`b:${n}`))}function Kq(e,t={},n){switch(e.type){case`heading`:return rJ(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Jq(e.children,t),aJ(e.id,t));case`paragraph`:return rJ(t,`p`,{key:n},Jq(e.children,t));case`code`:return Yq(e,t,n);case`list`:return rJ(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>rJ(t,`li`,{key:r},Xq(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return rJ(t,`blockquote`,{key:n},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`)));case`table`:return rJ(t,`table`,{key:n},rJ(t,`thead`,null,rJ(t,`tr`,null,e.header.map((n,r)=>Qq(`th`,n,e.align[r],t,r)))),e.rows.length?rJ(t,`tbody`,null,e.rows.map((n,r)=>rJ(t,`tr`,{key:r},n.map((n,r)=>Qq(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return $q(e.items,t,n);case`thematicBreak`:return rJ(t,`hr`,{key:n});case`html`:return t.allowHtml?rJ(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):rJ(t,`p`,{key:n},e.value);case`callout`:return rJ(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},rJ(t,`p`,{className:`markdown-alert-title`},e.title),rJ(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`))));case`component`:return iJ(e,t,n)}}function qq(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return rJ(t,`code`,{key:n},e.value);case`strong`:return rJ(t,`strong`,{key:n},Jq(e.children,t));case`emphasis`:return rJ(t,`em`,{key:n},Jq(e.children,t));case`strike`:return rJ(t,`del`,{key:n},Jq(e.children,t));case`footnoteReference`:return rJ(t,`sup`,{key:n},rJ(t,`a`,{id:`user-content-fnref-${nJ(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return rJ(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Jq(e.children,t));case`image`:return rJ(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return rJ(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?rJ(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Jq(e,t){return e.map((e,n)=>qq(e,t,`i:${n}`))}function Yq(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=rJ(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},rJ(t,`code`,{...a,...s},o));return e.title?rJ(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},rJ(t,`figcaption`,null,e.title),c):rJ(t,J.Fragment,{key:n},c)}function Xq(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[rJ(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...Jq(a.children,r)];return[...n?[rJ(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>Zq(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>Zq(e,n,r,`${i}:${t}`))]}function Zq(e,t,n,r){return!t&&e.type===`paragraph`?Jq(e.children,n):[Kq(e,n,r)]}function Qq(e,t,n,r,i){return rJ(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Jq(t.children,r))}function $q(e,t,n){return rJ(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},rJ(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,aJ(`footnote-label`,t)),rJ(t,`ol`,null,e.map(e=>rJ(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},eJ(e,t)))))}function eJ(e,t){let n=e.children.length-1,r=tJ(e,t);return n<0?[rJ(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?rJ(t,`p`,{key:i},Jq(e.children,t),r):Kq(e,t,`${i}`))}function tJ(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=r===1?e.id:`${e.id}-${r}`,a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,rJ(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function nJ(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function rJ(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,J.createElement)(i,n,...r)}function iJ(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),rJ(t,r,{key:n,...i},e.children.map((e,r)=>Kq(e,t,`${n}:${r}`)))}function aJ(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return rJ(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function oJ(e){return e}function sJ({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=dJ(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(dJ(n),t)}let i=dJ(e);function a(e){return r.get(dJ(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:fJ(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(dJ(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?pJ(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=lJ(cJ(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${wJ(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${wJ(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function cJ(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(hJ),a=r.filter(gJ);if(!(t.lineNumbers||a.length))return mJ(e,0,n.length,i);let o=[],s=_J(n);for(let t=0;t<s.length;t++){let r=t+1,c=s[t],l=s[t+1]??n.length,u=l>c&&n[l-1]===`
153
153
  `,d=u?l-1:l,f=a.filter(e=>vJ(e.lines,r));o.push({type:`element`,classNames:[`th-line`,...f.flatMap(e=>SJ(e.className))],data:{...yJ(f),line:String(r)},children:mJ(e,c,d,i)}),u&&o.push({type:`text`,value:`
154
154
  `})}return o}function lJ(e){let t=``;for(let n of e){if(n.type===`text`){t+=uJ(n.value);continue}let e=n.classNames.map(wJ).join(` `),r=Object.entries(n.data||{}).map(([e,t])=>` data-${wJ(CJ(e))}="${wJ(t)}"`).join(``);t+=`<span${e?` class="${e}"`:``}${r}>${lJ(n.children)}</span>`}return t}function uJ(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function dJ(e){return e.trim().toLowerCase()}function fJ(e,t){let n=[],r=t.map(t=>({...t,start:Math.max(0,Math.min(e,t.start)),end:Math.max(0,Math.min(e,t.end))})).sort((e,t)=>e.start-t.start),i=0;for(let e of r)e.start>=e.end||e.start<i||(n.push(e),i=e.end);return n}function pJ(e,t){let n=[],r=0;for(let i of t)i.start>r&&n.push({value:e.slice(r,i.start)}),n.push({className:i.className,value:e.slice(i.start,i.end)}),r=i.end;return r<e.length&&n.push({value:e.slice(r)}),n}function mJ(e,t,n,r){let i=[],a=0;for(let o of e){let e=a+o.value.length,s=Math.max(t,a),c=Math.min(n,e);if(s<c){let e=new Set([s,c]);for(let t of r){let[n,r]=t.range;r<=s||n>=c||(e.add(Math.max(s,n)),e.add(Math.min(c,r)))}let t=[...e].sort((e,t)=>e-t);for(let e=0;e<t.length-1;e++){let n=t[e],s=t[e+1],c={type:`text`,value:o.value.slice(n-a,s-a)};o.className&&(c={type:`element`,classNames:[`th-token`,`th-${o.className}`],children:[c]});let l=r.filter(e=>e.range[0]<=n&&e.range[1]>=s);for(let e of l)c={type:`element`,classNames:[`th-decoration`,...SJ(e.className)],data:bJ(e.data),children:[c]};i.push(c)}}if(a=e,a>=n)break}return i}function hJ(e){return`range`in e}function gJ(e){return`lines`in e}function _J(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
155
155
  `&&n+1<e.length&&t.push(n+1);return t}function vJ(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function yJ(e){let t={};for(let n of e)Object.assign(t,bJ(n.data));return t}function bJ(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[xJ(e),String(t)]))}function xJ(e){return CJ(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function SJ(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function CJ(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function wJ(e){return uJ(e)}function TJ(e){return t=>EJ(t,e)}function EJ(e,t,n=[]){let r=[...n],i=new Uint8Array(e.length);for(let e of n)i.fill(1,e.start,e.end);for(let n of t){if(`collect`in n){for(let t of n.collect(e))OJ(r,i,t);continue}let t=kJ(n.regex),a;for(;a=t.exec(e);){let e=n.group?a[n.group]:a[0];if(!e){a[0].length||t.lastIndex++;continue}let o=n.group?a[0].indexOf(e):0,s=a.index+o;OJ(r,i,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return r}function DJ(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function OJ(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||AJ(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function kJ(e){return new RegExp(e.source,e.flags.includes(`g`)?e.flags:`${e.flags}g`)}function AJ(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var jJ=oJ({name:`css`,tokenize:TJ([{className:e=>e[0].startsWith(`/*`)?`comment`:`string`,regex:/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g},{className:`variable`,regex:/--[A-Za-z0-9_-]+/g},{className:`selector`,regex:/(^|[}\n])\s*([^@{}\n][^{}\n]*)(?=\s*\{)/g,group:2},{className:`property`,regex:/(?:^|[;{]\s*)([A-Za-z-]+)(?=\s*:)/gm,group:1},{className:`function`,regex:/\b[A-Za-z-]+(?=\()/g},{className:`number`,regex:/\b\d+(?:\.\d+)?(?:px|rem|em|%|s|ms|vh|vw|deg)?\b/g}])}),MJ=oJ({name:`dockerfile`,aliases:[`docker`],tokenize:TJ([{className:`comment`,regex:/^\s*#.*$/gm},{className:`keyword`,regex:/^\s*(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\b/gim},{className:`string`,regex:/\b[A-Za-z0-9._/-]+:[A-Za-z0-9._-]+\b/g},{className:`variable`,regex:/\$\{?[A-Za-z_][A-Za-z0-9_]*\}?/g},{className:`command`,regex:/\b(?:bun|npm|npx|pnpm|yarn|node|apt|apt-get|apk)\b/g}])});function NJ(e,t,n=`html`){let r=[],i=[],a=0;for(;a<e.length;){if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4),n=t<0?e.length:t+3;r.push({start:a,end:n,className:`comment`}),a=n;continue}if(n===`ejs`&&e.startsWith(`<%`,a)){let t=e.indexOf(`%>`,a+2),n=t<0?e.length:t;i.push({start:a+2,end:n,lang:`js`}),a=t<0?e.length:t+2;continue}if(e[a]!==`<`){a++;continue}let t=e[a+1]===`/`,o=a+(t?2:1),s=/^[A-Za-z][\w:.-]*/.exec(e.slice(o));if(!s){a++;continue}let c=RJ(e,o+s[0].length);if(c<0){a++;continue}let l=s[0].toLowerCase();if(r.push({start:o,end:o+s[0].length,className:`tag`}),t||PJ(e,o+s[0].length,c,r),!t&&(l===`script`||l===`style`)){let t=`</${l}`,n=e.toLowerCase().indexOf(t,c+1);if(n>=0){let t=FJ(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:t})}}a=c+1}n===`vue`&&IJ(e,`{{`,`}}`,`js`,i),n===`svelte`&&LJ(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...DJ(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function PJ(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_][\w:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}let s=t;for(;s<n;){let t=e[s];if(t!==`"`&&t!==`'`){s++;continue}let i=zJ(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function FJ(e,t){if(e===`style`)return`css`;let n=/\blang\s*=\s*["']?([\w-]+)/i.exec(t)?.[1];return n===`ts`||n===`typescript`?`ts`:`js`}function IJ(e,t,n,r,i){let a=0;for(;(a=e.indexOf(t,a))>=0;){let o=e.indexOf(n,a+t.length);if(o<0)return;i.push({start:a+t.length,end:o,lang:r}),a=o+n.length}}function LJ(e,t){let n=0;for(;n<e.length;){if(e[n]!==`{`||e[n+1]===`#`){n++;continue}let r=e.indexOf(`}`,n+1);if(r<0)return;t.push({start:n+1,end:r,lang:`js`}),n=r+1}}function RJ(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=zJ(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function zJ(e,t,n,r){let i=t+1;for(;i<r;)if(e[i]===`\\`)i+=2;else if(e[i]===n)return i+1;else i++;return r}var BJ=oJ({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>NJ(e,t)}),VJ=[{className:`function`,regex:/@[A-Za-z_$][\w$]*/g},{className:`keyword`,regex:RegExp(`\\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|infer|instanceof|interface|is|keyof|let|module|namespace|new|of|override|package|private|protected|public|readonly|return|satisfies|set|static|super|switch|this|throw|try|type|typeof|using|var|while|with|yield)\\b`,`g`)},{className:`literal`,regex:/\b(?:false|null|true|undefined|NaN|Infinity)\b/g},{className:`number`,regex:/\b(?:0x[\da-f](?:_?[\da-f])*n?|0b[01](?:_?[01])*n?|0o[0-7](?:_?[0-7])*n?|\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:e[+-]?\d(?:_?\d)*)?n?)\b/gi},{className:`function`,regex:/\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)/g,group:1},{className:`function`,regex:/(^|[^.A-Za-z0-9_$])([A-Za-z_$][\w$]*)\s*(?=\()/g,group:2},{className:`type`,regex:/\b(?:Array|Record|Promise|Readonly|Set|Map|WeakMap|WeakSet|string|number|boolean|bigint|symbol|object|unknown|never|void|any|[A-Z][A-Za-z0-9_$]*)\b/g},{className:`property`,regex:/(?:\.|\?\.)([A-Za-z_$][\w$]*)/g,group:1}];function HJ(e,t=!1,n=!1){let r=UJ(e,t,n),i=t?qJ(e,n):[];return EJ(e,VJ,[...r,...i])}function UJ(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`/`&&o===`/`){let t=tY(e,i+2);r.push({start:i,end:t,className:`comment`}),i=t;continue}if(a===`/`&&o===`*`){let t=e.indexOf(`*/`,i+2),n=t<0?e.length:t+2;r.push({start:i,end:n,className:`comment`}),i=n;continue}if(a===`'`||a===`"`){let t=eY(e,i,a);r.push({start:i,end:t,className:`string`}),i=t;continue}if(a==="`"){i=WJ(e,i,r,t,n);continue}if(a===`/`&&!(t&&e[i-1]===`<`)&&ZJ(e,i)){let t=QJ(e,i);if(t>i+1){r.push({start:i,end:t,className:`literal`}),i=t;continue}}i++}return r}function WJ(e,t,n,r,i){let a=t,o=t+1;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]==="`")return n.push({start:a,end:o+1,className:`string`}),o+1;if(e[o]===`$`&&e[o+1]===`{`){a<o&&n.push({start:a,end:o,className:`string`}),n.push({start:o,end:o+2,className:`operator`});let t=GJ(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...DJ(HJ(c,r,i),o+2)),t<0)return e.length;n.push({start:t,end:t+1,className:`operator`}),o=t+1,a=o;continue}o++}return a<e.length&&n.push({start:a,end:e.length,className:`string`}),e.length}function GJ(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=eY(e,r,t);continue}if(t==="`"){r=KJ(e,r);continue}if(t===`/`&&i===`/`){r=tY(e,r+2);continue}if(t===`/`&&i===`*`){let t=e.indexOf(`*/`,r+2);r=t<0?e.length:t+2;continue}if(t===`{`&&n++,t===`}`&&--n===0)return r;r++}return-1}function KJ(e,t){let n=t+1;for(;n<e.length;)if(e[n]===`\\`)n+=2;else if(e[n]==="`")return n+1;else if(e[n]===`$`&&e[n+1]===`{`){let t=GJ(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function qJ(e,t){let n=[],r=0,i=0,a=0;for(;r<e.length;){if(i&&(e[r]===`"`||e[r]===`'`||e[r]==="`")){r=e[r]==="`"?KJ(e,r):eY(e,r,e[r]);continue}if(i&&e[r]===`{`){a++,r++;continue}if(i&&e[r]===`}`){a=Math.max(0,a-1),r++;continue}if(e[r]!==`<`){r++;continue}if(e.startsWith(`</>`,r)){i=Math.max(0,i-1),r+=3;continue}if(e.startsWith(`<>`,r)&&(i>0||YJ(e,r,t))){i++,r+=2;continue}let o=e[r+1]===`/`,s=r+(o?2:1),c=/^[A-Za-z][\w:.-]*/.exec(e.slice(s));if(!c||!o&&!(i>0&&a===0)&&!YJ(e,r,t)){r++;continue}let l=$J(e,s+c[0].length);if(l<0||XJ(e,r,l,o)){r++;continue}n.push({start:s,end:s+c[0].length,className:`tag`}),o||JJ(e,s+c[0].length,l,n);let u=/\/\s*$/.test(e.slice(s,l));o?i=Math.max(0,i-1):u||i++,r=l+1}return n}function JJ(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_$][\w$:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}}function YJ(e,t,n){if(n&&/^\s*$/.test(e.slice(e.lastIndexOf(`
@@ -171,4 +171,4 @@ Error generating stack: `+e.message+`
171
171
  `).map((e,n)=>{let r=CY.exec(e);if(!r)return e;let i=r[1]||r[2]||r[3];return t.push({className:i===`++`?`th-line--inserted`:`th-line--deleted`,lines:n+1}),e.slice(0,r.index)}).join(`
172
172
  `),decorations:t}}function TY(e){return(t,n=`plaintext`,r={})=>{let i=wY(t);return lJ(cJ(e.tokenize(i.code,{lang:n}).tokens,{...r.lineNumbers===void 0?{}:{lineNumbers:r.lineNumbers},...i.decorations.length||r.highlightLines?.length?{decorations:[...i.decorations,...(r.highlightLines||[]).map(e=>({className:`th-line--highlighted`,lines:e}))]}:{}}))}}var EY=sJ({fallbackLanguage:`plaintext`,languages:[jJ,MJ,BJ,nY,rY,iY,aY,cY,lY,uY,gY,_Y,vY,yY]}),DY=TY(EY);function OY(e,t){return EY.highlightToHtml(e,t?{lang:t}:{})}var kY=(0,J.forwardRef)(function({className:e,variant:t=`default`,...n},r){return(0,X.jsx)(`article`,{...n,className:Q(`prose prose-caps`,t===`dropcap`&&`caps-prose-dropcap`,e),ref:r})});function AY(e){return URL.parse(e)?.protocol??null}function jY(e){if(e===``||e.startsWith(`//`))return!1;let t=AY(e);return t===null||t===`http:`||t===`https:`||t===`mailto:`}function MY(e){let t=AY(e);return t===`http:`||t===`https:`}function NY(e){if(e===``||e.startsWith(`//`))return!1;let t=AY(e);return t===null||t===`http:`||t===`https:`}function PY({children:e,className:t,components:n,frontmatter:r=!0,policy:i=`default`,typography:a=`prose`}){let o=(0,J.useMemo)(()=>MR(e,{allowHtml:!1,frontmatter:r}),[e,r]),s=(0,J.useMemo)(()=>({...n,a(e){let t=e.href??``;if(i===`visitor`){let n=URL.parse(t);return n===null||!MY(n.href)?(0,X.jsx)(`span`,{children:e.children}):(0,X.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:e.children})}if(!jY(t))return(0,X.jsx)(X.Fragment,{children:e.children});let n=MY(t);return(0,X.jsx)(`a`,{...e,href:t,rel:n?`noopener noreferrer`:e.rel,target:n?`_blank`:e.target})},img(e){if(i===`visitor`)return(0,X.jsx)(`span`,{className:`text-dim`,children:`Image removed`});let t=e.src??``;return NY(t)?n?.img?(0,J.createElement)(n.img,e):(0,X.jsx)(`img`,{alt:e.alt??``,className:`max-w-full`,src:t}):(0,X.jsx)(X.Fragment,{children:e.alt??``})}}),[n,i]),c=(0,X.jsx)(Wq,{allowHtml:!1,components:s,highlighter:DY,children:o}),l=Q(`min-w-0 break-words`,t);return a===`prose`?(0,X.jsx)(kY,{className:l,children:c}):(0,X.jsx)(`div`,{className:l,children:c})}var FY=(0,J.createContext)(`session`),IY={blockquote({children:e}){return(0,X.jsx)(`blockquote`,{className:`text-dim my-2 border-l-2 border-primary pl-3 italic`,children:e})},pre({children:e,className:t,...n}){return(0,X.jsx)(`pre`,{...n,className:Q(`whitespace-pre-wrap break-words`,t),children:e})},img({alt:e,src:t}){let n=t??``;return n.startsWith(`/`)?(0,X.jsxs)(`div`,{className:`my-2 px-3 py-2 font-mono text-[10px]`,style:{background:`var(--stipe-surface-selected)`,border:`1px solid var(--color-base-300)`},children:[(0,X.jsx)(`span`,{className:`text-dim`,children:e??`Generated image`}),(0,X.jsx)(`span`,{className:`text-dim mx-2`,children:`·`}),(0,X.jsx)(`span`,{style:{color:`var(--color-base-content)`},children:n})]}):(0,X.jsx)(`img`,{alt:e??`Image`,className:`my-2 max-w-full`,src:n,style:{maxHeight:400}})},strong({children:e}){return(0,X.jsx)(`strong`,{className:`font-semibold text-primary`,children:e})},table({children:e}){return(0,X.jsx)(`table`,{className:`my-2 w-full border-collapse text-xs`,children:e})},thead({children:e}){return(0,X.jsx)(`thead`,{style:{background:`var(--stipe-surface-selected)`},children:e})},th({children:e}){return(0,X.jsx)(`th`,{className:`border px-3 py-2 text-left font-semibold`,style:{borderColor:`var(--color-base-300)`},children:e})},td({children:e}){return(0,X.jsx)(`td`,{className:`border px-3 py-2`,style:{borderColor:`var(--color-base-300)`},children:e})},tr({children:e}){return(0,X.jsx)(`tr`,{children:e})},tbody({children:e}){return(0,X.jsx)(`tbody`,{children:e})}};function LY({children:e,policy:t}){let n=(0,J.useContext)(FY);return(0,X.jsx)(PY,{className:`markdown-renderer`,components:IY,frontmatter:!1,policy:(t??n)===`visitor`?`visitor`:`default`,typography:`inherit`,children:e})}var RY=(0,J.memo)(function({thinking:e}){let[t,n]=(0,J.useState)(!1);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{"aria-expanded":t,className:`flex h-8 w-full items-center gap-2 px-3 text-left text-[10px] uppercase tracking-wider transition-colors`,onClick:()=>{n(e=>!e)},style:{color:`var(--stipe-fg-muted)`,fontFamily:`var(--font-sans)`,fontStyle:`italic`},type:`button`,children:[`Thoughts`,(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`btn btn-circle btn-ghost btn-xs ml-auto text-dim`,style:{transform:t?`rotate(90deg)`:`rotate(0deg)`},children:(0,X.jsx)(YU,{size:12})})]}),t?(0,X.jsx)(`div`,{className:`max-w-[80ch] break-words px-3 pb-2 text-[11px]`,style:{color:`var(--stipe-fg-muted)`,fontFamily:`var(--font-sans)`,fontStyle:`italic`},children:(0,X.jsx)(LY,{children:e})}):null]})});function zY({pending:e}){return e?(0,X.jsx)(`span`,{className:`sr-only`,role:`status`,children:`Sending`}):null}function BY({children:e,isError:t,pending:n,speaker:r,thinking:i,markdownPolicy:a}){let o=(0,X.jsx)(LY,{policy:a,children:e});if(r===`user`)return(0,X.jsxs)(`div`,{className:`px-3 py-2 transition-opacity motion-reduce:transition-none ${n?`opacity-50`:``}`,"data-pending":n?`true`:void 0,"data-speaker":`user`,style:{background:`var(--stipe-surface)`,borderLeft:`3px solid var(--color-primary)`},children:[(0,X.jsx)(zY,{pending:n}),(0,X.jsx)(`div`,{className:`message-body text-base-content`,children:o})]});let s=e.trim().length>0;return!s&&!i?null:(0,X.jsxs)(`div`,{"data-speaker":`agent`,"data-pending":n?`true`:void 0,children:[i?(0,X.jsx)(RY,{thinking:i}):null,s?(0,X.jsx)(`div`,{className:`px-3 py-2 ${t?`text-error`:`text-base-content`}`,children:o}):null]})}var VY=ib(`badge caps-badge`,{variants:{tone:{neutral:`badge-neutral`,primary:`badge-primary`,secondary:`badge-secondary`,accent:`badge-accent`,success:`badge-success`,info:`badge-info`,warning:`badge-warning`,error:`badge-error`},size:{sm:`badge-sm`,default:`badge-md`,lg:`badge-lg`},variant:{solid:``,quiet:`caps-badge-quiet`}},defaultVariants:{tone:`neutral`,size:`default`}}),HY=(0,J.forwardRef)(function({className:e,size:t,tone:n,variant:r,...i},a){return(0,X.jsx)(`span`,{...i,className:Q(VY({size:t,tone:n,variant:r}),e),ref:a})}),UY={add:`+`,context:` `,file:``,hunk:`@@`,remove:`-`};function WY({lines:e,hiddenLines:t=0,className:n,...r}){return(0,X.jsxs)(`pre`,{...r,className:Q(`caps-diff`,n),children:[e.map((e,t)=>(0,X.jsxs)(`span`,{className:`caps-diff-line`,"data-kind":e.kind,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-diff-marker`,children:UY[e.kind]}),e.text,`
173
173
  `]},`${String(t)}:${e.kind}`)),t>0?(0,X.jsxs)(`span`,{className:`caps-diff-line`,"data-kind":`more`,children:[`… `,String(t),` more lines`]}):null]})}var GY=1e4;function KY({className:e,content:t,header:n,hideCopy:r,language:i,maxHeight:a=`320px`,style:o}){let[s,c]=(0,J.useState)(`idle`),l=async()=>{try{await navigator.clipboard.writeText(t),c(`copied`),setTimeout(()=>{c(`idle`)},1500)}catch(e){SN(`copy code to clipboard`,e),c(`failed`)}},u=i&&t.length<=GY?OY(t,i):null,d={background:`var(--stipe-surface)`,border:`1px solid var(--color-base-300)`,color:`var(--color-base-content)`,...o};return(0,X.jsxs)(`div`,{className:`relative not-prose ${e??``}`,style:d,children:[n?(0,X.jsx)(`div`,{className:`text-dim px-2 pt-1.5 pb-1 text-[9px] uppercase tracking-wider`,children:n}):null,r?null:(0,X.jsx)(AG,{"aria-label":`Copy to clipboard`,className:`absolute top-1 right-1 z-10`,icon:s===`copied`?(0,X.jsx)(qU,{}):(0,X.jsx)(XU,{}),onClick:()=>{l()},type:`button`}),r?null:(0,X.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:s===`failed`?`Copy to clipboard failed.`:null}),(0,X.jsx)(`div`,{className:`overflow-y-auto text-[10px]`,"data-scrollable":!0,style:{maxHeight:a===`0`?void 0:a,padding:`6px 4px`},children:u===null?(0,X.jsxs)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-base-content`,style:{margin:0},children:[t,t.length>GY?(0,X.jsx)(`span`,{className:`text-dim ml-2 italic`,children:`(syntax highlighting skipped for very long content)`}):null]}):(0,X.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u}})})]})}function qY(e,t,n){return n||e.length<=t?{shown:e,hidden:0}:{shown:e.slice(0,t),hidden:e.length-t}}function JY({hidden:e,onShowAll:t}){return e===0?null:(0,X.jsxs)(`button`,{className:`btn btn-ghost btn-xs text-dim`,onClick:t,type:`button`,children:[`Show `,String(e),` more lines`]})}var YY=`not-prose m-0 overflow-x-auto rounded-lg border border-base-300 bg-base-200 px-sm py-xs font-mono text-[10px] leading-relaxed`;function XY({section:e,full:t,onShowAll:n}){switch(e.kind){case`diff`:{let{shown:r,hidden:i}=qY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{className:`not-prose`,children:[(0,X.jsx)(WY,{hiddenLines:0,lines:r}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}case`excerpt`:{let{shown:r,hidden:i}=qY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:YY,"data-parakeet-section":`excerpt`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.number===void 0?null:(0,X.jsx)(`span`,{className:`text-dim mr-sm inline-block w-8 select-none text-right`,children:String(e.number)}),e.text]},String(t)))}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}case`matches`:{let{shown:r,hidden:i}=qY(e.matches,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:YY,"data-parakeet-section":`matches`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.location===``?null:(0,X.jsx)(`span`,{className:`text-info mr-sm`,children:e.location}),e.text]},String(t)))}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}case`command`:case`script`:{let{shown:r,hidden:i}=qY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:YY,"data-parakeet-section":e.kind,children:r.map((t,n)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.kind===`command`&&n===0?(0,X.jsx)(`span`,{className:`text-dim select-none`,children:`$ `}):null,t]},String(n)))}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}case`output`:{let{shown:r,hidden:i}=qY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:YY,"data-parakeet-section":`output`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:e.stream===`stderr`?`block whitespace-pre text-error`:`block whitespace-pre`,"data-stream":e.stream,children:[e.stream===`stderr`?(0,X.jsx)(`span`,{className:`select-none`,children:`▍`}):null,e.text]},String(t)))}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}case`text`:{let{shown:r,hidden:i}=qY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(KY,{className:`overflow-hidden rounded-lg`,content:r.join(`
174
- `),header:e.label,...e.language===void 0?{}:{language:e.language}}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}}}function ZY({call:e,tool:t,disclosure:n,onToggle:r,mediaClaimed:i}){let a=`${e.id}:full`,o=OP(n,a,!1),s=()=>{r(a,!1)};return(0,X.jsxs)(`div`,{className:`space-y-1.5 py-1.5 pr-2`,"data-parakeet-call-body":!0,children:[e.error===void 0?null:(0,X.jsx)(`p`,{className:`not-prose m-0 font-mono text-[11px] text-error`,role:`alert`,children:e.error}),e.sections.map((e,t)=>(0,X.jsx)(XY,{full:o,onShowAll:s,section:e},`${e.kind}:${String(t)}`)),(i?[]:t?.result?.content??[]).filter(e=>e.type===`image`).map((t,n)=>(0,X.jsx)(`img`,{alt:`Tool result`,className:`max-w-full`,src:`data:${t.mimeType};base64,${t.data}`,style:{maxHeight:400}},`${e.id}-image-${String(n)}`))]})}function QY({call:e,tool:t,disclosureId:n,size:r,disclosure:i,onToggle:a,renderToolActions:o,claimsToolMedia:s}){let c=DP(e),l=OP(i,n,c),u=e.status===`running`;return(0,X.jsxs)(`div`,{"data-parakeet-call":e.kind,"data-status":e.status,children:[(0,X.jsx)(kK,{leading:(0,X.jsx)(Uq,{name:wN[e.kind],size:16}),onOpenChange:()=>{a(n,c)},open:l,size:r,summary:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:u?e.activeVerb:e.verb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:e.label})]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.exitCode===void 0?null:(0,X.jsxs)(HY,{size:`sm`,tone:`error`,children:[`exit `,String(e.exitCode)]}),e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:gP(e.durationMs)}),(0,X.jsx)(OG,{motion:u?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:CN(e.status)})]}),children:(0,X.jsx)(ZY,{call:e,disclosure:i,onToggle:a,mediaClaimed:t!==void 0&&s?.(t)===!0,tool:t})}),e.live===void 0?null:(0,X.jsx)(`pre`,{className:YY,"aria-label":`Live tool output`,children:EN(e,l).map((e,t)=>(0,X.jsx)(`span`,{className:`block whitespace-pre`,children:e||`\xA0`},String(t)))}),e.status===`completed`&&t?.result!==void 0?o?.(t):null]})}var $Y=(0,J.memo)(function({group:e,disclosure:t,onToggle:n,renderToolActions:r,claimsToolMedia:i}){let a=TP(e),o=OP(t,e.id,a),s=e.status===`running`,c=e.active,l=e.calls.length===1?e.calls[0]:void 0;return l===void 0?(0,X.jsxs)(`div`,{className:`px-1`,children:[(0,X.jsx)(kK,{className:`[&>.caps-disclosure-panel]:hidden`,leading:(0,X.jsx)(Uq,{name:`list`,size:16}),onOpenChange:()=>{n(e.id,a)},open:o,summary:s&&c!==void 0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:c.activeVerb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:c.label}),` ·`,` `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}):(0,X.jsxs)(`span`,{className:`text-base-content`,children:[e.summary,` · `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.failedCount>0?(0,X.jsxs)(`span`,{className:`text-error`,children:[String(e.failedCount),` failed`]}):null,e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:gP(e.durationMs)}),(0,X.jsx)(OG,{motion:s?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:CN(e.status)})]})}),EP(e,o).map(a=>(0,X.jsx)(QY,{call:a,disclosure:t,disclosureId:a.id,onToggle:n,renderToolActions:r,claimsToolMedia:i,size:`row`,tool:e.tools.find(e=>e.id===a.id)},a.id)),e.status===`completed`&&e.calls.length>3?(0,X.jsx)(`button`,{"aria-expanded":o,className:`btn btn-ghost btn-xs text-dim`,onClick:()=>{n(e.id,a)},type:`button`,children:o?`Show less`:`Show all ${String(e.calls.length)} calls`}):null]}):(0,X.jsx)(`div`,{className:`px-1`,children:(0,X.jsx)(QY,{call:l,disclosure:t,disclosureId:l.id,onToggle:n,renderToolActions:r,claimsToolMedia:i,size:`row`,tool:e.tools[0]})})}),eX=()=>void 0,tX={nothing_to_compact:`nothing to compact`,failed:`compaction failed`,stale:`compaction skipped: the context moved on`,insufficient:`compaction skipped: the summary would not fit`},nX=(0,J.memo)(function({item:e,onDismissFailed:t,onCancelQueued:n,cancellingQueued:r=!1,renderToolActions:i,claimsToolMedia:a,renderAssistantAttachment:o,formatAssistantText:s,toolDisclosure:c=wP,onToggleTool:l=eX}){switch(e.kind){case`user_message`:{let i=e.status===`pending`||e.status===`queued`,a=e.requestId,o=e.commandId,s=e.status===`queued`&&o!==void 0&&n!==void 0?(0,X.jsx)(`div`,{className:`flex justify-end px-3`,children:(0,X.jsx)(NT,{"aria-label":`Cancel queued message`,disabled:r,size:`sm`,variant:`ghost`,onClick:()=>{n(o)},children:`Cancel`})}):null,u=a===void 0||t===void 0?null:(0,X.jsx)(NT,{"aria-label":`Dismiss failed prompt`,variant:`outline`,size:`xs`,onClick:()=>{t(a)},type:`button`,children:`Dismiss`}),d=e.status===`failed`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs text-error`,role:`alert`,children:[(0,X.jsx)(`span`,{children:e.author?.kind===`agent`?`That Agent message didn’t make it through.`:`Your prompt didn’t make it through.`}),u]}):null;if(e.author?.kind===`agent`){let t=OP(c,e.id,!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:e.status===`confirmed`?`px-3 text-xs`:`px-3 text-xs opacity-60`,"data-agent-message":e.author.id,"data-author":e.author.id,children:[(0,X.jsx)(zY,{pending:i}),(0,X.jsxs)(`button`,{"aria-expanded":t,className:`text-dim flex w-full min-w-0 items-center gap-sm text-left`,onClick:()=>{l(e.id,!1)},type:`button`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0`,children:(0,X.jsx)(Uq,{name:`agent`,size:16})}),(0,X.jsx)(`span`,{className:`shrink-0`,children:e.author.name}),t?null:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.text]})]}),t?(0,X.jsx)(`div`,{className:`whitespace-pre-wrap break-words pl-3`,children:e.text}):null]}),d,s]})}return(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BY,{pending:i,speaker:`user`,children:e.text}),d,s]})}case`assistant_message`:return TM(e)?(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BY,{isError:e.isError===!0,pending:e.pending,speaker:`agent`,...e.thinking?{thinking:e.thinking}:{},children:s?.(e.text)??e.text}),e.isError&&e.repeatCount!==void 0?(0,X.jsxs)(`span`,{className:`px-3 text-error`,children:[`x`,e.repeatCount]}):null,e.isError&&e.errorDetail?(0,X.jsx)(`p`,{className:`px-3 text-dim`,children:e.errorDetail}):null,e.isError&&e.providerError!==void 0?(0,X.jsx)(`div`,{className:`px-3 text-error`,"data-provider-error":e.id,children:(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{children:`Provider details (latest response)`}),(0,X.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:e.providerError})]})}):null,!e.pending&&!e.isError?o?.(e.text):null]}):null;case`tool_group`:return(0,X.jsx)($Y,{disclosure:c,group:e,onToggle:l,renderToolActions:i,claimsToolMedia:a});case`compaction_divider`:return(0,X.jsx)(`div`,{className:`divider text-dim my-2 text-xs`,role:`separator`,children:e.tokensAfter===null?`compacted · the agent’s memory starts below`:`compacted ${EA(e.tokensBefore)} → ${EA(e.tokensAfter)}`});case`compaction_notice`:return(0,X.jsxs)(`div`,{className:`px-3 text-xs ${e.result===`failed`?`text-error`:`text-dim`}`,role:`status`,children:[`· `,tX[e.result],e.diagnostic===null?``:`: ${e.diagnostic}`]})}});function rX({disambiguateAuthors:e,visitor:t,composerActionVariant:n,empty:r,commands:i,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c,onLink:l,onOpen:u}){let d=(0,J.useRef)(null),[f]=(0,J.useState)(()=>Jr()),p=tR({enabled:t===void 0,commands:i??f,origin:`browser`,keys:{newline:`Shift+Enter`},busy:aX()}),m=ZR(i??f),h=XF(),{draft:g}=GF(),_=WL(p.awaiting,g)?.key,v=WF(),y=(0,J.useMemo)(()=>tz(h,v.commandAnchors,v.positionAnchors),[h,v.commandAnchors,v.positionAnchors]);return(0,X.jsxs)(`div`,{className:`parakeet flex h-full flex-col items-stretch`,"data-parakeet":`standalone`,"data-testid":`parakeet-view`,onClickCapture:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null;t instanceof HTMLAnchorElement&&l?.(t.href)&&e.preventDefault()},children:[(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col border-r border-base-300`,children:[(0,X.jsx)(sX,{disambiguateAuthors:t===void 0&&e===!0,clientActions:m,onOpen:u,focusAfterJump:d,empty:r,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c}),h.some(({entryId:e,value:t})=>t.panel.some(t=>JSON.stringify([e,t.id])!==_))?(0,X.jsx)(`section`,{"aria-label":`Session extension controls`,className:`w-full shrink-0 border-t border-base-300 bg-base-100`,children:h.map(({entryId:e,value:t})=>{let n={...t,panel:t.panel.filter(t=>JSON.stringify([e,t.id])!==_)},r=n.panel.length===0?void 0:y.omitted.find(t=>t.entryId===e),i=n.panel.length===0?[]:y.unanchored.filter(t=>t.entryId===e).flatMap(({cell:e})=>e.rows.map(t=>({...t,id:`unanchored:${e.id}:${t.id}`})));return(0,X.jsx)(hq,{entryId:e,rows:[...n.panel,...r===void 0?[]:[{id:`omitted:${e}`,title:`${String(r.count)} earlier change${r.count===1?``:`s`} omitted`,tone:`muted`}],...i],actions:m,onOpen:u},e)})}):null,(0,X.jsx)(cX,{clientActions:m}),(0,X.jsx)(lX,{visitor:t,textareaRef:d,composerActionVariant:n,slash:p})]}),t===void 0?(0,X.jsx)(oX,{slash:p}):null]})}var iX=new Set([`cancelling`,`queued`,`retrying`,`sending`,`streaming`,`thinking`]);function aX(){return iX.has(YF().status)}function oX({slash:e}){let t=e.interactions.open;return(0,X.jsx)(kU,{open:t!==void 0,onOpenChange:t=>{t||e.store.close()},children:(0,X.jsx)(PU,{className:`w-[min(32rem,calc(100vw-2rem))] rounded-box bg-base-100 p-md shadow-lg`,keepMounted:!1,children:t===void 0?null:(0,X.jsx)(XK,{host:t.host,onClose:e.store.close},t.key)})})}function sX({disambiguateAuthors:e,clientActions:t,onOpen:n,focusAfterJump:r,empty:i,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c}){let l=KF(),u=WF(),d=(0,J.useCallback)(e=>{u.cancelQueued(e)},[u.cancelQueued]),f=(0,J.useMemo)(()=>NA(e?[...u.settled,...u.tail].flatMap(e=>`author`in e&&e.author?[e.author]:[]):[]),[e,u.settled,u.tail]),p=tz(XF(),u.commandAnchors,u.positionAnchors),m=p.before.map(({entryId:e,cell:r})=>(0,X.jsx)(hq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`)),[h,g]=(0,J.useState)(wP),_=(0,J.useCallback)((e,t)=>{g(n=>kP(n,e,t))},[]),v=YF(),y=(0,J.useRef)(null),b=(0,J.useRef)(void 0),x=u.settled.length+u.tail.length,S=(0,J.useCallback)(e=>e<u.settled.length?u.settled[e]:u.tail[e-u.settled.length],[u.settled,u.tail]),C=RW({anchorTo:`end`,count:x,estimateSize:()=>72,followOnAppend:`auto`,getItemKey:VW(u.settled,u.tail),getScrollElement:()=>y.current,initialRect:{height:800,width:800},overscan:6,useFlushSync:!1}),w=C.getVirtualItems(),T=C.isAtEnd(),[E,D]=(0,J.useState)(0),O=x>0?S(x-1)?.id:void 0,k=(0,J.useRef)({count:x,lastItem:O});(0,J.useEffect)(()=>{let e=k.current;k.current={count:x,lastItem:O},T?D(0):e.lastItem!==void 0&&O!==e.lastItem&&D(t=>t+Math.max(1,x-e.count))},[T,x,O]);let A=(w[0]?.index??1/0)<3,{hasMoreHistory:j,hasNewerHistory:M,loadingOlderHistory:N,loadOlderHistory:P,loadNewerHistory:F}=u,ee=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(!A){ee.current=!1;return}j&&!N&&!ee.current&&(ee.current=!0,P())},[j,P,N,A]);let I=(0,J.useCallback)(()=>{D(0),b.current=void 0,u.jumpToLatest(),C.scrollToEnd({behavior:`smooth`})},[C,u]);return(0,X.jsxs)(`div`,{className:`prose relative min-h-0 flex-1`,children:[(0,X.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:cq(v.status,v.viewState)}),v.observation.status===`unavailable`?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-1 text-xs text-dim`,role:`status`,children:[(0,X.jsx)(`span`,{children:v.observation.reason}),(0,X.jsx)(NT,{variant:`outline`,size:`xs`,onClick:()=>void v.reconnect(),type:`button`,children:`Reconnect`})]}):null,(0,X.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,"data-chat-scroller":!0,ref:y,onScroll:e=>{let t=e.currentTarget.scrollTop;b.current!==void 0&&t<b.current&&u.pinVisibleHistory(),b.current=t},onWheel:e=>{let t=y.current;t===null||N||(e.deltaY<0&&u.pinVisibleHistory(),e.deltaY<0&&t.scrollTop<=1&&j&&P(),e.deltaY>0&&t.scrollTop+t.clientHeight>=t.scrollHeight-1&&M&&F())},style:{overscrollBehavior:`contain`},children:x>0?(0,X.jsx)(`div`,{className:`relative w-full`,style:{height:`${String(C.getTotalSize())}px`},children:w.map(e=>{let r=S(e.index);return r===void 0?null:(0,X.jsxs)(`div`,{"data-index":e.index,"data-parakeet-entry":r.kind===`user_message`?`user`:r.kind,"data-parakeet-id":r.id,"data-status":r.kind===`assistant_message`?r.isError?`error`:void 0:r.kind===`compaction_divider`||r.kind===`compaction_notice`?void 0:r.status,"data-tone":r.kind===`assistant_message`&&r.isError?`error`:void 0,ref:C.measureElement,style:{left:0,position:`absolute`,top:0,transform:`translateY(${String(e.start)}px)`,width:`100%`},children:[e.index===0?m:null,(0,X.jsx)(nX,{item:`author`in r&&r.author&&f.has(r.author.id)?{...r,author:{...r.author,name:f.get(r.author.id)??r.author.name}}:r,onDismissFailed:l,onCancelQueued:d,cancellingQueued:u.cancellingQueued,onToggleTool:_,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c,toolDisclosure:h}),p.after.get(r.id)?.map(({entryId:e,cell:r})=>(0,X.jsx)(hq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`))]},e.key)})}):m.length>0?m:j?null:i??(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center text-center`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1 text-xs text-base-content`,children:`Ready`}),(0,X.jsx)(`p`,{className:`text-[10px] text-dim`,children:`What would you like to build?`})]})})}),x>0?(0,X.jsx)(mW,{direction:`forward`,unread:E,focusAfterJump:r,onJump:I,scrollerRef:y}):null]})}function cX({clientActions:e}){let{viewState:t}=YF(),n=XF(),r=t.kind===`idle`?n.find(({value:e})=>e.waiting!==null):void 0;return(0,X.jsx)(X.Fragment,{children:r?.value.waiting===void 0||r.value.waiting===null?null:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs`,children:[(0,X.jsx)(`span`,{children:r.value.waiting.summary}),(0,X.jsx)(NT,{size:`xs`,variant:`outline`,disabled:!e.enabled||e.state.get(r.value.waiting.cancel)?.pending===!0,onClick:()=>{r.value.waiting!==null&&e.execute(r.entryId,r.value.waiting.cancel,!0)},children:r.value.waiting.cancel.label})]})})}function lX({visitor:e,textareaRef:t,composerActionVariant:n,slash:r}){let i=GF(),a=YF(),o=XF(),s=WF();(0,J.useEffect)(()=>{i.failure!==void 0&&t.current?.focus()},[i.failure,t]);let c=(0,J.useCallback)(()=>{i.cancel()},[i.cancel]),l={queuedRecall:e===void 0?i:void 0,onImagesChange:e===void 0?i.setImages:void 0,statusChips:o.flatMap(({value:e})=>e.chips).sort((e,t)=>e.order-t.order).map(({row:e})=>e.title),actionVariant:n,draft:i.draft,failure:i.failure,failureCause:a.viewState.kind===`error`?a.viewState.cause:void 0,admissionError:i.admissionError,onAbort:c,onChange:i.setDraft,onRetry:i.retry,onSend:r.submit,slash:e===void 0?r:void 0,placeholder:e===void 0?void 0:`Ask ${e.agentName}…`,showFooter:e===void 0,status:a.status,viewState:a.viewState,textareaRef:t,model:s.model,usage:s.usage,context:a.context};return(0,X.jsx)(pq,{...l})}function uX({authorOf:e,disambiguateAuthors:t,visitor:n,markdownPolicy:r=`session`,composerActionVariant:i,empty:a,session:o,clients:s,renderToolActions:c,claimsToolMedia:l,renderAssistantAttachment:u,formatAssistantText:d,commands:f,onLink:p,onOpen:m}){return(0,X.jsx)(FY.Provider,{value:r,children:(0,X.jsx)(UF,{session:o,clients:s,authorOf:e,children:(0,X.jsx)(rX,{disambiguateAuthors:t,visitor:n,composerActionVariant:i,empty:a,renderToolActions:c,claimsToolMedia:l,renderAssistantAttachment:u,formatAssistantText:d,commands:f,onLink:p,onOpen:m})})})}function dX(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}var fX=[`primary`,`secondary`,`accent`,`info`,`success`,`warning`];function pX(e){return fX[dX(e)%fX.length]??`primary`}var mX=(0,J.forwardRef)(function({className:e,name:t,seed:n,size:r=`default`,subject:i=`actor`,variant:a=`initial`,...o},s){let c=Array.from(t.trim())[0]?.toLocaleUpperCase()??`?`;return(0,X.jsx)(`span`,{"aria-hidden":`true`,...o,className:Q(`caps-monogram`,e),"data-subject":i===`actor`?void 0:i,"data-size":r==="default"?void 0:r,"data-tone":pX(n??t),ref:s,children:a===`specimen`?(0,X.jsx)(`svg`,{viewBox:`0 0 48 48`,width:`80%`,height:`80%`,fill:`none`,"aria-hidden":`true`,children:(0,X.jsxs)(`g`,{transform:`rotate(${String((n??t).split(``).reduce((e,t)=>e+(t.codePointAt(0)??0),0)%360)} 24 24)`,stroke:`currentColor`,strokeWidth:`1.5`,children:[Array.from({length:20},(e,t)=>(0,X.jsx)(`path`,{d:`M24 19 Q19 12 24 5`,transform:`rotate(${String(t*18)} 24 24)`},t)),(0,X.jsx)(`circle`,{cx:`24`,cy:`24`,r:`5`})]})}):c})}),hX=(0,J.createContext)(null),gX=(0,J.createContext)(void 0);function _X(e){let t=(0,J.useContext)(gX);return e??t}var vX=(0,J.forwardRef)(function({service:e,src:t,activity:n,expression:r,appearance:i,renderStyle:a,performance:o,timeMs:s,paused:c=!1,onState:l,...u},d){let f=_X(s),p=f!==void 0,m=(0,J.useContext)(hX),h=e??m;if(!h)throw Error(`Sprite needs a configured SpriteProvider or service`);let g=(0,J.useRef)(null),_=(0,J.useRef)(null),v=(0,J.useRef)(l);return v.current=l,(0,J.useImperativeHandle)(d,()=>{if(!g.current)throw Error(`Sprite host is not mounted`);return g.current}),(0,J.useEffect)(()=>{if(!g.current)return;let e=h.mount(g.current),t=e.subscribe(e=>{g.current&&(g.current.dataset.spriteStatus=e.status),v.current?.(e)});return _.current=e,()=>{t(),e.dispose().catch(e=>{console.error(`Sprite cleanup failed`,e)}),_.current=null}},[h]),(0,J.useEffect)(()=>{let e=_.current;if(!e)return;let s={src:t};n!==void 0&&(s={...s,activity:n}),r!==void 0&&(s={...s,expression:r}),i!==void 0&&(s={...s,appearance:i}),a!==void 0&&(s={...s,renderStyle:a}),o!==void 0&&(s={...s,performance:o}),f!==void 0&&(s={...s,timeMs:f}),e.set(s)},[h,t,n,r,i,a,o,f]),(0,J.useEffect)(()=>{_.current?.pause(c||p)},[h,c,p]),(0,X.jsx)(`div`,{...u,ref:g})});function yX(e){return{src:{local:e.character},appearance:e.appearance,expression:e.expression,renderStyle:e.renderStyle}}function bX(e){for(let[t,n]of Object.entries({maxBytes:e.maxBytes,maxTotalBytes:e.maxTotalBytes,maxRequests:e.maxRequests}))if(!Number.isSafeInteger(n)||n<=0)throw Error(`Avatar ${t} must be a positive safe integer`);let t=new Set(e.allowedOrigins.map(e=>new URL(e).origin)),n=e.fetch??globalThis.fetch;return()=>{let r=0,i=0;return async(a,o,s=e.baseURL)=>{let c=new URL(a,s);if(![`http:`,`https:`].includes(c.protocol)||!t.has(c.origin)||c.username||c.password)throw Error(`Avatar asset is not admitted: ${c.origin}`);if(i+=1,i>e.maxRequests)throw Error(`Avatar asset request limit reached`);let l=await n(c.href,{signal:o,redirect:`error`});if(!l.ok)throw Error(`Avatar asset request failed: ${String(l.status)}`);let u=Number(l.headers.get(`content-length`));if(u>e.maxBytes||u>e.maxTotalBytes-r)throw await l.body?.cancel(),Error(`Avatar asset exceeds the byte limit`);let d=l.body?.getReader();if(!d)throw Error(`Avatar asset has no response body`);let f=[],p=0;try{for(;;){o.throwIfAborted();let t=await d.read();if(t.done)break;if(p+=t.value.byteLength,p>e.maxBytes)throw Error(`Avatar asset exceeds the byte limit`);if(t.value.byteLength>e.maxTotalBytes-r)throw Error(`Avatar selection exceeds the total byte limit`);r+=t.value.byteLength,f.push(t.value)}}catch(e){let t=await d.cancel().then(()=>({kind:`cancelled`}),e=>({kind:`failed`,error:e instanceof Error?e:Error(String(e))}));throw t.kind===`failed`?AggregateError([e,t.error],`Avatar asset read and cancellation failed`,{cause:e}):e}finally{d.releaseLock()}let m=new Uint8Array(p),h=0;for(let e of f)m.set(e,h),h+=e.byteLength;return{url:c.href,bytes:m,contentType:l.headers.get(`content-type`)??`application/octet-stream`}}}}var xX=(e,t)=>{let n=tr.safeParse(e);return n.success?{kind:`local`,key:n.data.local}:{kind:`remote`,url:new URL(V().parse(e),t).href}},SX=e=>e instanceof Error?e:Error(String(e),{cause:e}),CX=e=>qt(e)?SX(Fn(e.cause)):Error(`Unexpected Sprite success`);function wX(e){let t=e.maxPixels??4194304;if(!Number.isSafeInteger(t)||t<=0)throw Error(`Sprite pixel limit must be a positive safe integer`);let n=e.assets??{baseURL:`https://sprite.invalid/`,allowedOrigins:[],maxBytes:1,maxTotalBytes:1,maxRequests:1},r=bX(n),i=new WeakSet,a=new WeakMap,o=e=>{let t=xX(e,n.baseURL);return t.kind===`remote`?t.url:`local:${t.key}`};return{mount(s){if(i.has(s))throw Error(`A Sprite already owns this target`);i.add(s);let c=ge(Kt()),l=new Set,u={status:`empty`},d,f,p=0,m=!1,h,g,_,v=!1,y=!1,b=s.ownerDocument.defaultView?.matchMedia(`(prefers-reduced-motion: reduce)`),x=e=>{if(!(v&&e.status!==`destroyed`)){u=e;for(let t of l)try{t(e)}catch(e){console.error(`Sprite state observer failed`,e)}}},S=e=>{f?.controller.abort(),f?.holder.remove(),x({status:`error`,error:e}),T().catch(t=>{x({status:`error`,error:AggregateError([e,t],`Avatar failed and cleanup also failed`)})})},C=Mh(s),w=()=>{let e=y||s.ownerDocument.hidden||b?.matches===!0;C.still(e);try{f?.native?.pause(e)}catch(e){S(SX(e))}};ge(Ut(c,Ue(()=>{s.ownerDocument.removeEventListener(`visibilitychange`,w),b?.removeEventListener(`change`,w),C.dispose()}))),s.ownerDocument.addEventListener(`visibilitychange`,w),b?.addEventListener(`change`,w);let T=async()=>{if(g)return g;let e=f;if(!e)return;f=void 0,e.controller.abort(),e.holder.remove();let t=Ke(St(e.scope,un)).then(e=>{if(qt(e))throw CX(e)});g=t;try{await t}finally{g===t&&(g=void 0)}},E=e=>{let t=e.native,n=e.document,r=d;if(!t||!n||!r||f!==e)return;let i=r.activity??`idle`,a=r.expression??t.expressions[0]??null,o,s;try{o=nr(n.controls,r.appearance),s=ah.parse(r.renderStyle??`plain`)}catch(e){let t=SX(e);u.status===`ready`?u.updateError?.message!==t.message&&x({...u,updateError:t}):S(t);return}let c={requestedActivity:i,requestedExpression:a,activity:t.activities.includes(i)?i:`idle`,expression:a!==null&&t.expressions.includes(a)?a:t.expressions[0]??null,appearance:o,renderStyle:s,fallback:!t.activities.includes(i)||a!==null&&!t.expressions.includes(a)},l=r.performance===void 0?c:{...c,performance:r.performance};r.timeMs!==void 0&&(l={...l,timeMs:r.timeMs});let p=JSON.stringify([l.activity,l.expression,l.appearance,l.timeMs]);if(C.set(s,e.holder),p!==e.appliedKey||r.performance!==e.appliedPerformance||u.status!==`ready`||u.presentation.renderStyle!==s||u.updateError!==void 0||u.presentation.requestedActivity!==i||u.presentation.requestedExpression!==a)try{if((p!==e.appliedKey||r.performance!==e.appliedPerformance)&&t.set(l),e.appliedKey=p,e.appliedPerformance=r.performance,w(),f===e){let t={status:`ready`,document:n,presentation:l};x(e.progress===void 0?t:{...t,progress:e.progress})}}catch(e){S(SX(e))}},D=async(i,a,o)=>{let c=r(),l=ge(Kt()),d=new AbortController,m=s.ownerDocument.createElement(`div`);m.style.cssText=`width:100%;height:100%;position:relative`;let h={key:a,scope:l,controller:d,holder:m};f=h,ge(Ut(l,Ue(()=>{m.remove()}))),s.append(m);let g=ke(function*(){let r,a,o=n.baseURL,s=xX(i.src,n.baseURL);if(s.kind===`remote`){let t=yield*$e({try:()=>c(s.url,d.signal),catch:SX});o=t.url,r=er.parse(JSON.parse(new TextDecoder().decode(t.bytes)));let n=e.renderers&&Object.hasOwn(e.renderers,r.renderer)?e.renderers[r.renderer]:void 0;if(!n)throw Error(`Renderer is not installed: ${r.renderer}`);a=(yield*$e({try:n,catch:SX})).default}else{let t=s.key,n=e.characters&&Object.hasOwn(e.characters,t)?e.characters[t]:void 0;if(!n)throw Error(`Character is not installed: ${t}`);let i=yield*$e({try:n,catch:SX});r=er.parse(i.document),a=i.render}d.signal.throwIfAborted();let l=yield*a({target:m,document:r,signal:d.signal,maxPixels:t,reportError:e=>{f===h&&!d.signal.aborted&&S(e)},reportProgress:e=>{f!==h||d.signal.aborted||(h.progress=e,u.status===`ready`&&x({...u,progress:e}))},assetURL:e=>ke(function*(){let t=yield*$e({try:()=>c(e,d.signal,o),catch:SX});return yield*Ye(Ue(()=>URL.createObjectURL(new Blob([t.bytes],{type:t.contentType}))),e=>Ue(()=>{URL.revokeObjectURL(e)}))})});if(!l.activities.includes(`idle`))throw Error(`Character has no idle fallback`);return l.pause(!0),{native:l,document:r}}).pipe(bt(l)),_=await Ke(g,{signal:d.signal});if(!(v||o!==p||f!==h)){if(qt(_)){let e=CX(_);try{await T(),x({status:`error`,error:e})}catch(t){x({status:`error`,error:AggregateError([e,t],`Avatar load and cleanup failed`)})}return}h.native=_.value.native,h.document=_.value.document,E(h)}},O=async()=>{let e=e=>v||e!==p;for(;m&&!v;){m=!1;let t=p;if(await T(),e(t)||!d)continue;let n=await a.get(s);if(n?.kind===`failed`)throw n.error;e(t)||(x({status:`loading`}),await D(d,o(d.src),t))}},k=()=>{m=!0,f?.controller.abort(),f?.holder.remove(),!h&&(h=O().catch(e=>{x({status:`error`,error:SX(e)})}).finally(()=>{h=void 0,m&&!v&&k()}))};return{get state(){return u},subscribe(e){return l.add(e),()=>l.delete(e)},set(e){if(v)throw Error(`Sprite is destroyed`);d=e;let t=o(e.src);f?.key===t&&u.status===`ready`?E(f):(f?.key!==t||u.status===`error`)&&(p+=1,k())},pause(e){if(v)throw Error(`Sprite is destroyed`);y=e,w()},dispose(){return _||(v=!0,p+=1,i.delete(s),f?.controller.abort(),f?.holder.remove(),x({status:`destroyed`}),_=(async()=>{await h,await T();let e=await Ke(St(c,un));if(qt(e))throw CX(e)})(),a.set(s,_.then(()=>({kind:`closed`}),e=>({kind:`failed`,error:SX(e)}))),_)}}}}}var TX=wX({characters:{mushroom:async()=>(await ir(async()=>{let{default:e}=await import(`./mushroom-BTxbn3Sf.js`);return{default:e}},__vite__mapDeps([6,7,2,8,1]))).default,cat:async()=>(await ir(async()=>{let{default:e}=await import(`./cat-Ce0yvAsw.js`);return{default:e}},__vite__mapDeps([9,7,2,8,1,10]))).default,burger:async()=>(await ir(async()=>{let{default:e}=await import(`./burger-BrMTWnA6.js`);return{default:e}},__vite__mapDeps([11,7,2,8,1,10]))).default}}),EX=(0,J.memo)(function({activity:e=`idle`,avatar:t,className:n,name:r,size:i=24,timeMs:a}){let o=_X(a),[s,c]=(0,J.useState)(!1),l=(0,J.useMemo)(()=>yX(t),[t]);return(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0 ${n??``}`,"data-agent-head":s?`ready`:`loading`,style:{height:i,width:i},children:[s?null:(0,X.jsx)(mX,{className:`absolute inset-0`,name:r,seed:r}),(0,X.jsx)(vX,{activity:e,...o===void 0?{}:{timeMs:o},appearance:l.appearance,className:`absolute inset-0`,expression:l.expression,onState:e=>{c(e.status===`ready`)},paused:o!==void 0||e===`idle`,renderStyle:l.renderStyle,service:TX,src:l.src})]})}),DX=(0,J.memo)(function({avatar:e,className:t=`h-12 w-12 shrink-0`,service:n=TX,state:r}){let i=(0,J.useMemo)(()=>e?yX(e):void 0,[e]);return(0,X.jsx)(vX,{"aria-hidden":`true`,className:t,service:n,src:i?.src??{local:`mushroom`},...i?{appearance:i.appearance,renderStyle:i.renderStyle}:{},...r})}),OX={needs_you:`Waiting for you`,running:`Working`,errored:`Failed`,done:`Done`},kX={needs_you:0,errored_unseen:1,running:2,recent:3};function AX(e){return e===`running`||e===`needs_you`}function jX(e,t){return e!==void 0&&(t===void 0||e>t)}function MX(e,t){switch(e){case`needs_you`:return`needs_you`;case`running`:return`running`;case`errored`:return t?`errored_unseen`:`recent`;case`done`:return`recent`}}function NX(e,t){return kX[e.tier]-kX[t.tier]||(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)}var PX=[`Needs you`,`Working`,`Ready`,`Finished`];function FX(e){return e.tier===`running`?`Working`:e.shelf===`active`?`Needs you`:e.ready?`Ready`:`Finished`}function IX(e){return{key:VX(e.agentId,e.sessionId),shelf:FX(e),attention:e.tier===`needs_you`||e.tier===`errored_unseen`?`${e.tier}:${String(e.settledAt??e.createdAt)}`:null}}function LX(e,t,n){let r=new Map(t.map(e=>[VX(e.agentId,e.sessionId),e]));if(e!==null&&n.held)return e;let i=[...t].sort((e,t)=>(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)),a=new Map(e?.map(e=>[e.key,e])),o=i.map(IX).filter(e=>{let t=a.get(e.key);return t===void 0||e.key!==n.openKey&&e.attention!==null&&e.attention!==t.attention}),s=new Set(o.map(e=>e.key)),c=a.get(n.openKey??``),l=c===void 0?-1:(e??[]).filter(e=>e.shelf===c.shelf).findIndex(e=>e.key===c.key),u=PX.flatMap(t=>{let a;a=e===null||n.reorder?i.map(IX).filter(e=>e.shelf===t):[...o.filter(e=>e.shelf===t),...e.filter(e=>e.shelf===t&&!s.has(e.key)).flatMap(e=>{let t=r.get(e.key);return t===void 0?[]:[{...e,attention:IX(t).attention}]})];let u=c===void 0?void 0:r.get(c.key);return c!==void 0&&u!==void 0&&(a=a.filter(e=>e.key!==c.key),c.shelf===t&&a.splice(Math.min(l,a.length),0,{...c,attention:IX(u).attention})),a});return e!==null&&u.length===e.length&&u.every((t,n)=>t.key===e[n]?.key&&t.shelf===e[n]?.shelf&&t.attention===e[n]?.attention)?e:u}function RX(e){switch(e.kind){case`idle`:return`done`;case`waiting_for_you`:return`needs_you`;case`error`:return`errored`;default:return`running`}}function zX(e,t,n=null,r){let i=new Set(e.map(e=>e.agentId));return BX(t.filter(e=>!(`kind`in e)&&i.has(e.agentId)&&(n===null||e.agentId===n)),r)}function BX(e,t){let n=[],r=[];for(let i of e){if(`kind`in i)continue;if(i.state===`unavailable`){r.push({agentId:i.agentId,sessionId:i.sessionId});continue}let e=jX(i.settledAt,i.visitedAt),a=t?.agentId===i.agentId&&t.sessionId===i.sessionId?t.state:void 0,o=a?RX(a):i.state,s=a?a.kind===`idle`:o===`done`&&i.settledAt===void 0,c=MX(o,e);n.push({...i,state:o,ready:s,unseen:e,tier:c,shelf:c===`recent`?`settled`:`active`})}return n.sort(NX),{active:n.filter(e=>e.shelf===`active`),settled:n.filter(e=>e.shelf===`settled`),unavailable:r.sort((e,t)=>e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId))}}function VX(e,t){return`${e}\u0000${t}`}function HX(e){return e.name}function UX({children:e}){return(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:e})}function WX({open:e,agents:t,agentActivity:n,agentFilterId:r,websitesSelected:i,websitesVisible:a,canCreate:o,createOpen:s,onAll:c,onWebsites:l,onAgent:u,onCreate:d}){let[f,p]=(0,J.useState)(null),m=`grove-rail-cell relative size-12 rounded-field p-0`,h=r===null&&!(i&&a);return(0,X.jsxs)(`nav`,{id:`grove-agent-rail`,"aria-label":`Agents`,className:`grove-rail min-h-0 w-16 flex-none flex-col items-center gap-1 border-r border-base-300 py-2 ${e?`flex`:`flex min-[900px]:hidden`}`,children:[(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`All Agents`,"aria-pressed":h,className:`${m} text-xs ${h?`bg-base-300`:``}`,onClick:c,children:(0,X.jsx)(UX,{children:`All`})}),a?(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`Websites`,"aria-pressed":i,className:`${m} ${i?`bg-base-300`:``}`,onClick:l,children:(0,X.jsx)(UX,{children:(0,X.jsx)(Uq,{name:`internet`,size:28})})}):null,(0,X.jsx)(bA,{className:`w-full flex-1`,style:{width:`100%`},children:(0,X.jsx)(`div`,{className:`flex flex-col items-center gap-1 py-1`,children:t.map(e=>(0,X.jsx)(NT,{variant:`ghost`,"aria-label":HX(e),title:HX(e),"aria-pressed":r===e.agentId&&!i,"data-agent-id":e.agentId,className:`${m} ${r===e.agentId&&!i?`bg-base-300`:``}`,onPointerEnter:()=>{p(e.agentId)},onPointerLeave:()=>{p(null)},onFocus:()=>{p(e.agentId)},onBlur:()=>{p(null)},onClick:()=>{u(e.agentId)},children:(0,X.jsx)(UX,{children:(0,X.jsx)(EX,{activity:n.get(e.agentId)??(f===e.agentId?`thinking`:`idle`),avatar:e.avatar,name:HX(e),size:32})})},e.agentId))})}),o?(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`New Agent`,"aria-expanded":s,"aria-haspopup":`dialog`,className:`${m} mt-auto`,onClick:d,children:(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:(0,X.jsx)(nW,{size:20})})}):null]})}function GX({app:e}){let[t,n]=(0,J.useState)(null),r=Oo({queryKey:qy.of(e,`team-inbox-notices`,t),enabled:e!==null&&(e.capabilities.has(cg)||e.capabilities.has(lg)),queryFn:async()=>{if(!e)throw Error(`No App connection`);let n=await hg(e.capabilities);try{return await Vy(n,t)}finally{await n.close()}}});return!r.isError&&!r.data?.items.length?null:(0,X.jsx)(`section`,{"aria-label":`Team notices`,className:`min-h-0 shrink-0`,children:(0,X.jsxs)(bA,{className:`max-h-52 border-b border-base-300`,children:[r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Team notices unavailable.`}):(0,X.jsx)(Nx,{density:`compact`,className:`px-3 py-2`,children:r.data.items.map(e=>(0,X.jsx)(Px,{children:(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-[var(--spacing-xs)]`,children:[(0,X.jsx)(OG,{className:`col-span-2 grid grid-cols-subgrid`,size:`compact`,tone:`warning`,label:`kind`in e?`Seller closed`:`Installed App safety notice`}),(0,X.jsx)(`p`,{className:`m-0 col-start-2 text-sm [overflow-wrap:anywhere]`,children:`kind`in e?`${e.sellerName} closed. Your installation of ${e.displayName} continues; no new purchases are available.`:`${e.displayName} was removed. Fungi will disable it on your Team.`})]})},e.dispositionId))}),r.data?.next?(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{n(r.data.next)},children:`Older notices`}):null,t===null?null:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{n(null)},children:`Newest notices`})]})})}var KX=`(min-width: 900px)`;function qX(e){let t=globalThis.matchMedia(KX);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}}function JX(){return globalThis.matchMedia(KX).matches}function YX(){return(0,J.useSyncExternalStore)(qX,JX,()=>!0)}function XX({open:e,onOpenChange:t,returnFocus:n,children:r}){let i=YX(),[a,o]=(0,J.useState)(null);return(0,X.jsxs)(kU,{open:i||e,modal:!i,disablePointerDismissal:i,onOpenChange:e=>{i||t(e)},children:[(0,X.jsx)(`div`,{ref:o,className:`contents`}),(0,X.jsxs)(jU,{container:a,keepMounted:!0,className:`contents`,children:[i?null:(0,X.jsx)(MU,{className:`grove-nav-scrim z-30 bg-base-200`}),(0,X.jsx)(NU,{id:`grove-nav`,role:i?`presentation`:`dialog`,"aria-label":i?void 0:`Agents and conversations`,initialFocus:!i&&void 0,finalFocus:!i&&n,className:`grove-nav min-h-0 flex-none rounded-none p-0 overflow-visible max-w-none max-h-none ${i?`static flex w-auto shadow-none`:`fixed inset-y-0 left-0 z-40 w-[min(22rem,88vw)] data-[open]:flex`}`,children:r})]})]})}var ZX=H({path:W,entries:Pt(H({name:W,type:Ht([`file`,`directory`,`symlink`]),size:Jt,modifiedAt:Jt})),nextOffset:Yt(Jt)}),QX=Vm(`computer.list`,1,B(()=>Hm({list:Wm(Um(Qe().transform(e=>Hn(ZX)(e))))}))),$X=Dn([H({state:Ht([`running`,`sleeping`,`starting`])}),H({state:U(`queued`),position:Jt.pipe(q(Vt()),q(Ct(0)))})]),eZ=H({enabled:wt,effective:wt,blockedBy:Yt(Ht([`team`,`global`]))}),tZ=H({computerId:Mn,name:Mn,runtime:$X,backends:Pt(H({id:Mn,kind:Ht([`platform-container`,`on-box-vm`,`local`]),status:Ht([`ready`,`queued`,`online`,`offline`]),queuePosition:Yt(Jt.pipe(q(Vt()),q(Ct(0)))),hostId:Yt(W),hostLabel:Yt(W),folderLabel:Yt(W),detachable:wt})),internet:eZ});Vm(`computer.instrument.read`,1,B(()=>Hm({read:Wm(Um(Qe().transform(e=>Hn(tZ)(e))))}))),Vm(`computer.instrument.control`,1,B(()=>Hm({start:Wm(Um(Qe().transform(e=>Hn($X)(e)))),setInternetAccess:Wm(Um(Qe().transform(e=>Hn(eZ)(e)))),detachLocal:Wm(Um(Qe().transform(e=>Hn(H({detached:wt}))(e))))})));var nZ=H({ports:Pt(H({port:Jt.pipe(q(Vt()),q(mt({minimum:1,maximum:65535}))),previewUrl:Mn,openMode:Ht([`inline`,`external-only`]),expiresAt:Jt.pipe(q(Vt()),q(Ct(0)))})).pipe(q(G(64)))}),rZ=Dn([nZ,H({error:U(`port_previews_not_configured`)})]),iZ=H({port:Jt.annotate({message:`Use a port from 1 to 65535.`}).check(Vt({message:`Use a port from 1 to 65535.`}),mt({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:wt}),aZ=H({port:Jt.pipe(q(Vt()),q(mt({minimum:1,maximum:65535}))),removed:wt});Vm(`computer.ports`,2,B(()=>Hm({list:Wm(Um(Qe().transform(e=>Hn(rZ)(e)))),expose:Wm(Um(Qe().transform(e=>Hn(iZ)(e)))),unexpose:Wm(Um(Qe().transform(e=>Hn(aZ)(e))))})));var oZ=Ht([`synced`,`pending`,`unknown`]),sZ=H({port:Yt(iZ.fields.port),id:Mn,command:Mn,cwd:Yt(W),startedAt:Jt.pipe(q(Vt()),q(Qn(0))),state:Ht([`running`,`exited`,`uncertain`]),exitCode:Yt(Jt.pipe(q(Vt()))),sync:oZ,endedAt:Yt(Jt.pipe(q(Vt()),q(Qn(0))))}),cZ=H({processes:Pt(sZ)}),lZ=H({process:sZ,signalled:wt});H({requestId:Mn.pipe(q(G(256))),command:Mn.pipe(q(G(16384))),cwd:zn(W),port:zn(iZ.fields.port)}),Vm(`computer.processes`,1,B(()=>Hm({start:Wm(Um(Qe().transform(e=>Hn(sZ)(e)))),list:Wm(Um(Qe().transform(e=>Hn(cZ)(e)))),kill:Wm(Um(Qe().transform(e=>Hn(lZ)(e))))}))),Vm(`computer.readFile`,1,B(()=>Hm({open:Wm(Hm({response:Wm(S(Response)),close:Gm}))}))),Vm(`computer.writeFile`,3,B(()=>Hm({open:Wm(Hm({write:Gm,close:Gm})),mkdir:Gm,replace:Wm(Um(Qe().transform(e=>Hn(uZ)(e))))})));var uZ=Dn([H({kind:U(`replaced`),path:Mn,bytes:Jt.pipe(q(Vt()),q(Qn(0)))}),H({kind:U(`conflict`)})]),dZ=H({computerName:Mn.pipe(q(G(256))),teamName:Mn.pipe(q(G(256))),modelDoor:Mn.pipe(q(G(256))),uptimeSeconds:Jt.pipe(q(Vt()),q(Qn(0))),version:Mn.pipe(q(G(64)))});Vm(`computer.terminal`,2,B(()=>Hm({open:Wm(Hm({information:Wm(Um(Qe().transform(e=>Hn(dZ)(e)))),output:Wm(S(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(S(Uint8Array).parse(e))}})))),input:Wm(S(WritableStream)),resize:Gm,close:Gm}))})));function fZ({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function pZ(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var mZ=[],hZ=0,{link:gZ,unlink:_Z,propagate:vZ,checkDirty:yZ,shallowPropagate:bZ}=fZ({update(e){return e._update()},notify(e){mZ[SZ++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,EZ(e))}}),xZ=0,SZ=0,CZ,wZ=0;function TZ(e){try{++wZ,e()}finally{--wZ||DZ()}}function EZ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=_Z(n,e)}function DZ(){if(!(wZ>0)){for(;xZ<SZ;){let e=mZ[xZ];mZ[xZ++]=void 0,e.notify()}xZ=0,SZ=0}}function OZ(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return CZ!==void 0&&gZ(i,CZ,hZ),i._snapshot},subscribe(e){let t=pZ(e),n={current:!1},r=kZ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=CZ,o=t?.compare??Object.is;if(n)CZ=i,++hZ,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{CZ=a,n&&(i.flags&=-5),EZ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&yZ(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&bZ(e)}}else e&32&&(i.flags=e&-33);return CZ!==void 0&&gZ(i,CZ,hZ),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(vZ(e),bZ(e),DZ())}},i}function kZ(e){let t=()=>{let t=CZ;CZ=n,++hZ,n.depsTail=void 0,n.flags=6;try{return e()}finally{CZ=t,n.flags&=-5,EZ(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&yZ(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,EZ(this)}};return t(),n}var AZ=class{constructor(e,t){this.atom=OZ(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(pZ(e))}},jZ=class{constructor(e){this.atom=OZ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(pZ(e))}};function MZ(e,t){return typeof e==`function`?new jZ(e):t?new AZ(e,t):new AZ(e)}var NZ=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function PZ(e,t){return new NZ(e,t).maybeExecute}var FZ=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},IZ=new class extends FZ{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function LZ(e,t){return typeof e==`function`?e(t):e}function RZ(e,t){return KZ(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function zZ(e,t,n){let r=KZ(t);function i(e){if(!r.length)return LZ(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function BZ(e,t){let n=KZ(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var VZ=46,HZ=91,UZ=93,WZ=48,GZ=57;function KZ(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===HZ),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===VZ||s===HZ||s===UZ){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==WZ),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==UZ&&(a!==-1||s!==UZ)&&(a!==s||s!==VZ&&s!==HZ)&&n.push(``);r=o+1,i=!0}else(s<WZ||s>GZ)&&(i=!1);a=s}return n.length||n.push(``),n}function qZ(e){return!(Array.isArray(e)&&e.length===0)}function JZ(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function YZ(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var XZ=e=>!!e&&typeof e==`object`&&`fields`in e;function ZZ(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!ZZ(e[i],t[i]))return!1;return!0}var QZ=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},$Z=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function eQ(e,t){return e==null?t:{...e,...t}}for(var tQ=256,nQ=[],rQ;tQ--;)nQ[tQ]=(tQ+256).toString(16).substring(1);function iQ(){let e=0,t,n=``;if(!rQ||tQ+16>256){for(rQ=Array(256),e=256;e--;)rQ[e]=256*Math.random()|0;e=0,tQ=0}for(;e<16;e++)t=rQ[tQ+e],n+=e===6?nQ[t&15|64]:e===8?nQ[t&63|128]:nQ[t],e&1&&e>1&&e<11&&(n+=`-`);return tQ++,n}var aQ=PZ(e=>IZ.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function oQ(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=oQ(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,oQ(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(oQ(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=oQ(e[n]));return t}function sQ(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var cQ=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function lQ(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var uQ=(e,t)=>{let n=lQ(e,t);return{form:n,fields:n}},dQ={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:uQ(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:uQ(r.issues,e)}},fQ=e=>!!e&&`~standard`in e,pQ={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function mQ(e){function t(t){let n=e.getFieldMeta(t)??pQ;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>pQ;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function hQ(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var gQ=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{aQ(this)}),t=IZ.on(`request-form-state`,e=>{e.payload.id===this._formId&&IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=IZ.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=IZ.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),IZ.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!ZZ(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!ZZ(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(TZ(()=>{this.baseStore.setState(()=>hQ(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=mQ(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=zZ(t,e.instance.name,e.instance.options.defaultValue))}),hQ({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return TZ(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return TZ(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=JZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||cQ}),r=!1,i={};return TZ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=_Q(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=vQ(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??pQ,r=a?.[e],{newErrorValue:s,newSource:c}=QZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=pQ)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=vQ(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=vQ(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=YZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||cQ});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=vQ(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=_Q(r);s&&(i=i?{...i,...s}:s);let c=vQ(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??pQ,r=i?.[e],{newErrorValue:a,newSource:o}=QZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=pQ)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),TZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}TZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),TZ(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>RZ(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:LZ(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=pQ,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;TZ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:zZ(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=BZ(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),mQ(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],eQ(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),mQ(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),eQ(r,{dontValidate:!0})),mQ(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),eQ(n,{dontValidate:!0})),mQ(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return zZ(zZ(e,`${t}`,i),`${n}`,r)},eQ(r,{dontValidate:!0})),mQ(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},eQ(r,{dontValidate:!0})),mQ(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],eQ(t,{dontValidate:!0})),mQ(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=RZ(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:pQ},values:i===void 0?t.values:zZ(t.values,e,i)}})},this.setErrorMap=e=>{TZ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(XZ(t)){let{formError:e,fieldErrors:r}=_Q(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>dQ.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>dQ.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??iQ(),this._devtoolsSubmissionOverride=!1;let t=hQ({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!XZ(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=MZ(t);let n;this.fieldMetaDerived=MZ(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=RZ(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!qZ(u),f=!o.isDirty,p=ZZ(l,this.getFieldInfo(a)?.instance?.options.defaultValue??RZ(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=MZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!sQ(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&sQ(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=MZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&XZ(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&ZZ(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return fQ(e.validate)?dQ[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function _Q(e){return e?XZ(e)?{formError:_Q(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function vQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var yQ=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...pQ,isTouched:e.fieldMetaBase[this.name]?.isTouched??pQ.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??pQ.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??pQ.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(ZZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,eQ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,eQ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,eQ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,eQ(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=JZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||cQ}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=JZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;TZ(()=>{let e=(e,n)=>{let r=xQ(n.cause),a=n.validate?bQ(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=$Z({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=xQ(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=YZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||cQ}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=YZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));TZ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=xQ(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=bQ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=$Z({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),TZ(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[xQ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[xQ(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>dQ.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>dQ.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)sQ(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=MZ(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...pQ,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!ZZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return fQ(e.validate)?dQ[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function bQ(e){if(e)return e}function xQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function SQ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function CQ(e){return{...pQ,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var wQ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??SQ({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(ZZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...pQ,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??SQ({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;EQ(t)&&(n=t.group,r=t.fields);let i=TQ(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:SQ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,eQ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof yQ&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&sQ(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=QZ({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=pQ)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=JZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||cQ}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=JZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;TZ(()=>{let t=(t,r)=>{let i=OQ(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&EQ(s)&&(c=s.group,l=s.fields);let u=TQ(c),d=n[i],{newErrorValue:f,newSource:p}=$Z({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=OQ(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=YZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||cQ}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=YZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=OQ(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&EQ(o)&&(l=o.group,u=o.fields);let d=TQ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=$Z({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return TZ(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[OQ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),TZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}TZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),TZ(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=MZ(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??CQ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!ZZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(fQ(e.validate)){let t=dQ[e.type](e.value,e.validate);return e.type===`validate`?DQ(t):t.then(DQ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function TQ(e){if(e)return e}function EQ(e){return!!e&&typeof e==`object`&&`fields`in e}function DQ(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function OQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function kQ(e,t){if(!t)return;let n=Object.assign({},e,{state:oQ(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return TZ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function AQ(e,t){return e===t}function jQ(e,t=e=>e,n){let r=n?.compare??AQ,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,lV.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var MQ=typeof window<`u`?J.useLayoutEffect:J.useEffect;function NQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new yQ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new yQ({...e}),i(a),n({form:e.form,name:e.name}));let o=jQ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=jQ(a.store,e=>e.meta.isTouched),c=jQ(a.store,e=>e.meta.isBlurred),l=jQ(a.store,e=>e.meta.isDirty),u=jQ(a.store,e=>e.meta.errorMap),d=jQ(a.store,e=>e.meta.errorSourceMap),f=jQ(a.store,e=>e.meta.isValidating),p=(0,J.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return MQ(a.mount,[a]),MQ(()=>{a.update(e)}),p}var PQ=(({children:e,...t})=>{let n=NQ(t),r=(0,J.useMemo)(()=>LZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function FQ(){return(0,J.useState)(()=>iQ())[0]}var IQ=J,LQ=`18.3.1`.split(`.`)[0]===`17`?FQ:IQ.useId;function RQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new wQ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new wQ({...e})),n({form:e.form,name:e.name}));let a=jQ(r.store,e=>e.value),o=jQ(r.store,e=>e.meta.isTouched),s=jQ(r.store,e=>e.meta.isBlurred),c=jQ(r.store,e=>e.meta.isDirty),l=jQ(r.store,e=>e.meta.errorMap),u=jQ(r.store,e=>e.meta.errorSourceMap),d=jQ(r.store,e=>e.meta.isValidating),f=jQ(r.store,e=>e.meta.isSubmitting),p=jQ(r.store,e=>e.meta.isSubmitted),m=jQ(r.store,e=>e.meta.submissionAttempts),h=jQ(r.store,e=>e.meta.isSubmitSuccessful),g=jQ(r.store,e=>e.meta.canSubmit),_=jQ(r.store,e=>e.meta.isValid),v=jQ(r.store,e=>e.meta.isFieldsValid),y=jQ(r.store,e=>e.meta.isFieldsValidating),b=jQ(r.store,e=>e.meta.isGroupValid),x=(0,J.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return MQ(r.mount,[r]),MQ(()=>{r.update(e)}),x}var zQ=(({children:e,...t})=>{let n=RQ(t),r=(0,J.useMemo)(()=>LZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function BQ({form:e,selector:t=e=>e,children:n}){let r=jQ(e.store,t);return(0,X.jsx)(X.Fragment,{children:LZ(n,r)})}function VQ(e){let t=LQ(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new gQ({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new gQ({...e,formId:n})),r(n)}let o=(0,J.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,X.jsx)(PQ,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(zQ,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(BQ,{form:i,selector:e.selector,children:e.children})},e},[i]);MQ(i.mount,[]),MQ(()=>{i.update(e)});let s=(0,J.useRef)(!1);return MQ(()=>{s.current&&e?.transform&&kQ(i,e.transform)},[i,e?.transform]),MQ(()=>{s.current=!0}),o}var HQ=fn(W),UQ=fn(H({message:W}));function WQ(e){for(let t of e.errors){let e=fe(he(Be(UQ(t),e=>e.message),()=>HQ(t)));if(e!==void 0&&e.length>0)return e}}var GQ={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},KQ=(0,J.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,X.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:Q(`progress caps-gooey-motion caps-gooey-progress w-full`,GQ[t],e),ref:r})});(0,J.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Q(`caps-game-meter`,i),children:[(0,X.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,X.jsx)(KQ,{"aria-label":e,value:t,max:n,tone:r})]})});function qQ({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,X.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,X.jsx)(XQ,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function JQ({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(AG,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(rW,{}):(0,X.jsx)(cW,{}),onClick:()=>void n(t),type:`button`}):null}function YQ({item:e}){return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,X.jsx)(`div`,{className:`caps-upload-details`,children:(0,X.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function XQ({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,X.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,X.jsx)($U,{className:`size-4`})}),(0,X.jsx)(YQ,{item:e}),(0,X.jsx)(ZQ,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(KQ,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function ZQ({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,X.jsx)(JQ,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(JQ,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(JQ,{action:e.remove,id:t,onAction:r})]})}var QQ=J.createContext(void 0);function $Q(e){let t=J.useContext(QQ);if(t===void 0&&!e)throw Error(nE(47));return t}var e$={...TV,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!TV.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&TV.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>TV.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},t$=class extends gV{constructor(e,t,n){let r=new XB;super(n$(e,r,t,n),r$(r),e$)}setOpen=(e,t)=>{let n=t.reason===hz,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=WB(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=UB(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),QF.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function n$(e,t,n,r=!1){let i={...yV(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function r$(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new $T,stickIfOpen:!0,triggerElements:e}}var i$=aV(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=o$(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),YB(u,d),KB(u);let{forceUnmount:m}=qB(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),J.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),J.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,fz(bz))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(QQ.Provider,{value:u,children:[s&&(0,X.jsx)(BB,{handle:s,store:u}),h&&(0,X.jsx)(s$,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function a$(e){return $Q(!0)?(0,X.jsx)(i$,{props:e}):(0,X.jsx)(hB,{children:(0,X.jsx)(i$,{props:e})})}function o$(e,t){let n=zB((e,n)=>new t$(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function s$({store:e,modal:t}){let n=kB(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return JB(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function c$(e,t){function n(n,r,i){let a=n.currentTarget;QF.flushSync(()=>{e.setOpen(!1,fz(vz,n.nativeEvent,a))}),Ck(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&wk(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var l$=oV(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=$Q(!0),h=EV(s)??m;if(!h)throw Error(nE(74));let g=qE(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=J.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=GB(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=PV(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:HV(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=EB(v,{stickIfOpen:GT(()=>h.context.stickIfOpen)}),k=SU(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=lz({disabled:a,native:o}),N={open(e){return w?lO.open(e):cO.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=c$(h,x),ee=ME(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[$z]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),I=(0,X.jsx)(J.Fragment,{children:ee},g);return E?(0,X.jsxs)(J.Fragment,{children:[(0,X.jsx)(Lz,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),I,(0,X.jsx)(Lz,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):I}),u$=J.createContext(void 0);function d$(){let e=J.useContext(u$);if(e===void 0)throw Error(nE(45));return e}var f$=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return $Q().useState(`mounted`)||n?(0,X.jsx)(u$.Provider,{value:n,children:(0,X.jsx)(oB,{ref:t,...r})}):null}),p$=J.createContext(void 0);function m$(){let e=J.useContext(p$);if(!e)throw Error(nE(46));return e}function h$(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=J.useState(null),d=J.useRef(null),f=fB(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=BH({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=sD(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=J.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=J.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=J.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return zk(()=>{o&&(d.current=o)},[o]),zk(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),J.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var g$=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=FO(e,t)||{};if(l==null)return{};let d=$O(u),f={x:n,y:r},p=VO(i),m=zO(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=PO(D,k,O),j=!c.arrow&&LO(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),_$=(e,t)=>{let{name:n,fn:r}=g$(e);return{name:n,fn:r,options:[e,t]}},v$={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},y$={sideX:`left`,sideY:`top`},b$=`--available-width`,x$=`--available-height`,S$=`--anchor-width`,C$=`--anchor-height`,w$=`--transform-origin`,T$=b$,E$=x$;function D$(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function O$(e,t,n){let{rects:r,placement:i}=e;return{side:D$(t,IO(i),n),align:LO(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function k$(e){return A$(e,h$)}function A$(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=GT(O),A=O?k:n,j=kz(n),M=kz(g),N=Wk()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let ee=x===`placement`,I=P?IO(P):null,te=P&&ee?LO(P)||`center`:null,ne=I||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],re=te||o,ie=re===`center`?ne:`${ne}-${re}`,L=l;typeof L==`number`?L={top:L,right:L,bottom:L,left:L}:L&&={top:L.top||0,right:L.right||0,bottom:L.bottom||0,left:L.left||0};let ae=+(i===`bottom`),oe=+(i===`top`),R=+(i===`right`),se=+(i===`left`),ce={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},le=J.useRef(null),z=kz(a),ue=kz(s),de=typeof a==`function`?0:a,fe=typeof s==`function`?0:s,pe=[];p&&pe.push(p),pe.push(VH(e=>{let t=O$(e,i,N),n=typeof z.current==`function`?z.current(t):z.current,r=typeof ue.current==`function`?ue.current(t):ue.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[de,fe,N,i]));let me=w===`none`&&C!==`shift`,B=!me&&(u||E||C===`shift`),he=C===`none`?null:WH({...ce,padding:{top:L.top+1+ae,right:L.right+1+se,bottom:L.bottom+1+oe,left:L.left+1+R},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),ge=me?null:HH({...ce,rootBoundary:D,mainAxis:w!==`none`,crossAxis:B,limiter:u||E?void 0:UH(e=>{if(!le.current)return{};let{width:t,height:n}=le.current.getBoundingClientRect(),r=BO(IO(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})},[ce,u,E,D,L,w]);C===`shift`||w===`shift`||re===`center`?pe.push(ge,he):pe.push(he,ge),pe.push(GH({...ce,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(T$,`${t}px`),i.setProperty(E$,`${n}px`);let a=iD(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(S$,`${u}px`),i.setProperty(C$,`${d}px`)}}),_$(e=>({element:le.current||rk(e.elements.floating).createElement(`div`),padding:le.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=IO(r),u=LO(r),d=BO(l)===`y`,f=le.current,p=typeof a==`function`?a(O$(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return B&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(w$,d?`${m} ${h}`:`${h} ${m}`),{}}},v$,b),zk(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let _e=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ve,elements:ye,x:be,y:xe,middlewareData:Se,update:Ce,placement:we,context:Te,isPositioned:Ee,floatingStyles:De}=t({rootContext:h,open:m?g:void 0,placement:ie,middleware:pe,strategy:r,whileElementsMounted:m?void 0:(...e)=>OH(...e,_e),nodeId:y,externalTree:S}),{sideX:Oe,sideY:ke}=Se.adaptiveOrigin||y$,Ae=Ee?r:`fixed`,je=J.useMemo(()=>{let e;return e=Ee?b?{position:Ae,[Oe]:be,[ke]:xe}:{...De,position:Ae}:{position:Ae,top:0,left:0},e[T$]=`100vw`,e[E$]=`100vh`,Ee||(e.opacity=0),e},[b,Ae,Oe,be,ke,xe,De,Ee]),Me=J.useRef(null);zk(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(j$(t)?t.current:t)||null;n!==Me.current&&(ve.setPositionReference(n),Me.current=n)},[g,ve,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&j$(e)&&e.current!==Me.current&&(ve.setPositionReference(e.current),Me.current=e.current)},[g,ve,A,j]),J.useEffect(()=>{if(m&&g&&ye.reference&&ye.floating)return OH(ye.reference,ye.floating,Ce,_e)},[m,g,ye,Ce,_e]);let Ne=IO(we),Pe=D$(i,Ne,N),Fe=LO(we)||`center`,Ie=!!Se.hide?.referenceHidden;zk(()=>{x&&g&&Ee&&(Ne!==ne||ee&&Fe!==re)&&F(we)},[x,ee,g,Ee,we,Ne,Fe,ne,re]);let V=J.useMemo(()=>({position:`absolute`,top:Se.arrow?.y,left:Se.arrow?.x}),[Se.arrow]),Le=Se.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:je,arrowStyles:V,arrowRef:le,arrowUncentered:Le,side:Pe,align:Fe,physicalSide:Ne,anchorHidden:Ie,refs:ve,context:Te,isPositioned:Ee,update:Ce}),[je,V,le,Le,Pe,Fe,Ne,Ie,ve,Te,Ee,Ce])}function j$(e){return e!=null&&`current`in e}function M$(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=PB(r);zk(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),zk(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function N$(e){return e===`starting`?Qz:XT}function P$(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ME(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},N$(r),i],stateAttributesMapping:uO})}var F$=20;function I$(e,t,n,r){let[i,a]=J.useState(!1);zk(()=>{if(!e||!t||n==null){a(!1);return}let r=rk(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-F$)},[e,t,n]),fU(e&&(!t||i),r)}var L$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=eB,..._}=e,v=$Q(),y=d$(),b=pB(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=k$({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});M$({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;I$(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=P$(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,X.jsxs)(p$.Provider,{value:j,children:[S&&M&&(0,X.jsx)(eU,{inert:$H(!C),cutout:T}),(0,X.jsx)(mB,{id:b,children:P})]})}),R$=J.createContext(void 0);function z$(e){let t=J.useContext(R$);if(t===void 0&&!e)throw Error(nE(69));return t}var B$=J.createContext(void 0);function V$(){let[e,t]=J.useState(0),n=GT(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:J.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var H$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=$Q(),l=m$(),u=z$(!0)!=null,{context:d,hasClosePart:f}=V$(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);FB({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),MV(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?RB(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=ME(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...LB,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&JH.has(e.key)&&e.stopPropagation()}},N$(g),s],stateAttributesMapping:dO});return(0,X.jsx)(TB,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:cD(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(B$.Provider,{value:d,children:M})})}),U$=(0,J.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,X.jsxs)(`button`,{...r,ref:i,type:n,className:Q(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(JU,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function W$({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(t),[x,S]=(0,J.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,J.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=$G({getKey:n,isDisabled:o,items:T});(0,J.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(oG(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,J.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function G$(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,J.useId)(),F=O?.props??_,ee=g??F?.id??P,I={id:ee,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:te,onPointerMove:ne,activeItem:re,activeKey:ie,commit:L,groups:ae,inputValue:oe,listboxId:R,onInputChange:se,onInputKeyDown:ce,open:le,optionId:z,selectedKeys:ue,setOpen:de}=W$({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:ee,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});DU(()=>{O&&de(!1)});let fe=EU(`popover`),pe=s===void 0?fe:s,me=ZG(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),B=(0,X.jsx)(qG,{..._,...O?{}:I,"aria-activedescendant":re?z(f(re)):void 0,"aria-autocomplete":`list`,"aria-controls":R,"aria-expanded":!0,className:Q(`input-sm`,_?.className),id:O?_?.id??`${ee}-input`:ee,onChange:e=>{_?.onChange?.(e),se(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||ce(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:oe}),he=(0,X.jsx)(`div`,{id:R,ref:me,className:`caps-combobox-list`,"data-navigation":te?`keyboard`:`pointer`,onPointerMove:ne,role:`listbox`,"aria-multiselectable":C??void 0,children:ae.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):ae.map(e=>(0,X.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,X.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=ie===t,i={active:r,disabled:n,selected:ue.includes(t)};return(0,X.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&te,disabled:n,id:z(t),onClick:()=>{L(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,X.jsx)(qU,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(a$,{modal:!0,onOpenChange:de,open:le,children:[(0,X.jsx)(l$,{...I,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),pe===null?null:(0,X.jsx)(f$,{container:pe,children:(0,X.jsx)(L$,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(H$,{"data-active-tone":o,className:Q(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:B}),he]})})})]})}):(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(`div`,{className:Q(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:B}),he]})})}function K$({icon:e,caption:t}){return(0,X.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,X.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var q$=(0,J.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,X.jsx)(KG,{...a,appearance:r??`default`,"aria-label":e,className:Q(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(K$,{icon:t,caption:n}),ref:o})})});function J$({checked:e}){let t=`caps-radio-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=(0,J.useRef)(null),o=sS(a),{reduced:s}=o;return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=mA(o,{ease:`outCubic`,duration:75}),c=e?pA(o,{bounce:.65,duration:300}):mA(o,{ease:`inCubic`,duration:100}),l=fT(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,X.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,X.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var Y$=(0,J.createContext)(null),X$=(0,J.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,J.useId)(),d=(0,J.useRef)(null);(0,J.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,J.useState)(n),h=s??p;return(0,J.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,X.jsx)(Y$.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,X.jsx)(`fieldset`,{...c,className:Q(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),Z$=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)(Y$);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,X.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,X.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:Q(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,X.jsx)(J$,{checked:c}):t]})}),Q$=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)(Y$),s=(0,J.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,X.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,X.jsx)(Z$,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,X.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,X.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,X.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,X.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),$$=(0,J.forwardRef)(function({label:e,icon:t,caption:n,className:r,...i},a){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,children:(0,X.jsx)(Z$,{...i,"aria-label":e,className:Q(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(K$,{icon:t,caption:n}),ref:a})})}),e1=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,X.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,X.jsx)(JU,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function t1({checked:e}){let t=`caps-switch-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useRef)(e).current,a=(0,J.useRef)(e),o=_S();return(0,J.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=oS(n.current),c=pA(s,{bounce:.25,duration:440}),l=mA(s,{ease:`inOutSine`,duration:100}),u=fT(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=fT(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,X.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-track`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,X.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,X.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var n1=(0,J.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,J.useRef)(null),[c,l]=(0,J.useState)(n),u=t??c;return(0,J.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,J.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,X.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,X.jsx)(`input`,{...a,checked:u,className:Q(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,X.jsx)(t1,{checked:u})]})}),r1=fn(W),i1=fn(wt),a1=fn(Yt(Ft)),o1=fn(Pt(W)),s1=Pt(zt(File)),c1=fn(s1),l1=Dn([W,Ft,wt,Et,gn,Pt(W),s1]),u1=fn(l1),d1=e=>ce(r1(e.state.value),()=>``),f1=e=>ce(i1(e.state.value),()=>!1),p1=e=>ce(a1(e.state.value),()=>null),m1=e=>ce(o1(e.state.value),()=>[]),h1=e=>ce(c1(e.state.value),()=>[]),g1=e=>ce(u1(e.state.value),()=>null);function _1({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,X.jsxs)(jK,{children:[(0,X.jsx)(qG,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:d1(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,X.jsx)(ZU,{"aria-hidden":`true`}):(0,X.jsx)(QU,{"aria-hidden":`true`})})]})}var v1={text:`text`,email:`email`,url:`url`,tel:`tel`};function y1({spec:e,field:t,locked:n,...r}){let i=h1(t),a=n||e.readOnly===!0,o=(0,J.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(vS,{asChild:!0,children:(0,X.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,X.jsx)(qQ,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function b1({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,X.jsx)(qG,{...a,type:v1[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(RG,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(_1,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)(jK,{children:[(0,X.jsx)(MK,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(qG,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(qG,{...a,type:`date`,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(qK,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:p1(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(e1,{...a,value:d1(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,X.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,X.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,X.jsx)(G$,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:d1(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(U$,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===d1(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,X.jsx)(y1,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(KG,{...a,disabled:n||e.readOnly===!0,checked:f1(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(n1,{...a,disabled:n||e.readOnly===!0,checked:f1(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var x1=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function S1({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=m1(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(BK,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,X.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,X.jsx)(q$,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):e.options.map(r=>(0,X.jsx)(HK,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(KG,{name:e.name,value:r.value,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}})},r.value))})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,X.jsx)(BK,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,X.jsx)(X$,{name:e.name,"aria-label":o,value:d1(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,X.jsx)($$,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,X.jsx)(Q$,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(HK,{label:t.label,orientation:`inline`,children:(0,X.jsx)(Z$,{value:t.value,disabled:t.disabled})},t.value))})})}function C1({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:g1(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function w1({form:e,spec:t,locked:n,layout:r}){let i=NQ({form:e,name:t.name}),a=jQ(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?WQ(i.state.meta):void 0;if(t.render===void 0&&x1.has(t.kind))return(0,X.jsx)(S1,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,X.jsx)(HK,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,X.jsx)(b1,{spec:t,field:i,locked:n}):(0,X.jsx)(C1,{spec:t,field:i,locked:n,error:o,render:t.render})})}var T1=fn(Zt(W,l1));function E1({form:e,spec:t,locked:n,layout:r}){let i=t.when;return jQ(e.store,e=>i===void 0||i(ce(T1(e.values),()=>({}))))?(0,X.jsx)(w1,{form:e,spec:t,locked:n,layout:r}):null}function D1({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,X.jsx)(E1,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,X.jsx)(zK,{title:t.title,description:t.description,layout:r,children:i})}function O1({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(D1,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,X.jsx)(E1,{form:i,spec:a,locked:n,layout:r},t)})}var k1=class{annotation;constructor(e){this.annotation=e}},A1=class{sections;constructor(e){this.sections=e}},j1=`caps/form`,M1=0;function N1(e){M1+=1;let t={[`${j1}:${String(M1)}`]:new k1(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}W.annotate(N1({kind:`secret`})).pipe(on(`Secret`));var P1=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function F1(e){return Object.values(e??{}).reduce((e,t)=>t instanceof k1?{...e,...t.annotation}:e,{})}function I1(e){return e.reduce((e,t)=>({...e,...F1(t)}),{})}function L1(e){let t=e?.[j1];return t instanceof A1?t.sections:{}}var R1=fn(W);function z1(e){if(Wn(e))return Ge(R1(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!ut(e))return null;let t=[];for(let n of e.types){if(bn(n))continue;let e=z1(n);if(e===null)return null;t.push(...e)}return t}function B1(e){if(jt(e))return{type:`string`,literals:[]};if(gt(e))return{type:`number`,nullable:!1};if(It(e))return{type:`boolean`};let t=z1(e);if(t!==null)return{type:`string`,literals:t};if(Jn(e)){let[t]=e.rest;if(t===void 0)return null;if(jt(t))return{type:`strings`,literals:[]};let n=z1(t);return n===null?null:{type:`strings`,literals:n}}if(ut(e)){let t=e.types.filter(e=>!bn(e)&&!Rt(e)),n=e.types.some(e=>Rt(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=B1(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function V1(e){let t=e.ast;if(!pt(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Nt(e.type),r=I1([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:B1(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:kt(e.type),description:Ot(e.type)}}),sections:L1(vn(t))}}function H1(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof lt)n=!0,t=t.unwrap();else if(t instanceof y)r=!0,t=t.unwrap();else if(t instanceof O)t=t.unwrap();else if(t instanceof a)t=t.in;else return{node:t,optional:n,nullable:r}}function U1(e){if(e instanceof ne){let t=e.options.map(e=>U1(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof j?e.options:e instanceof d?[...e.values]:null;if(t===null)return null;let n=t.map(e=>R1(e));return n.every(Ce)?n.map(e=>e.value):null}function W1(e){let{node:t,nullable:n}=H1(e);if(t instanceof L)return{type:`string`,literals:[]};if(t instanceof w)return{type:`number`,nullable:n};if(t instanceof E)return{type:`boolean`};let r=U1(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof je){let e=H1(t.element).node;if(e instanceof L)return{type:`strings`,literals:[]};let n=U1(e);return n===null?null:{type:`strings`,literals:n}}return null}function G1(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof lt||e instanceof y||e instanceof O?e.unwrap():e instanceof a?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>k.get(e))}function K1(e){return G1(e).reduce((e,t)=>({...e,...t}),{})}function q1(e){return Object.entries(e.shape)}function J1(e){let t=H1(e).node;if(!(t instanceof P))throw Error(`A schema form needs a z.object.`);return{fields:q1(t).map(([e,t])=>{let n=I1(G1(t)),r=n.kind===`file`?{type:`files`}:W1(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=K1(t);return{name:e,valueType:r,optional:H1(t).optional,annotation:n,title:i.title,description:i.description}}),sections:L1(K1(e))}}function Y1(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??P1(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function X1(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function Z1(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function Q1(e){let t=e instanceof g?J1(e):V1(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=Y1(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??P1(e.name),help:a,kind:n??X1(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=Z1(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function $1(e){let t=e instanceof g?e:Qt(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>e0(e)):e0(n)}}}}function e0(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var t0=`onServer`;function n0(e){let t=e?.querySelector(`[aria-invalid="true"]`);t?.matches(`input, select, textarea, button, [tabindex]`)?t.focus():t?.querySelector(`input, select, textarea, button`)?.focus()}function r0(e){return e.state.meta.errorMap.onServer!==void 0}function i0(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[t0]:void 0}}))}function a0(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[t0]:n}}))}function o0(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(e.defaultValues),[s,c]=(0,J.useState)(null);ZZ(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>Q1(l),[l]),d=(0,J.useMemo)(()=>$1(l),[l]),f=VQ({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),r0(e)&&i0(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await $1(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&a0(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function s0(e){return{dirty:jQ(e.form.store,e=>!e.isDefaultValue),submitting:jQ(e.form.store,e=>e.isSubmitting),canSubmit:jQ(e.form.store,e=>e.canSubmit)}}function c0({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=s0(e),f=(0,J.useRef)(null);return(0,X.jsxs)(LK,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{setTimeout(()=>{n0(f.current)},0)})},children:[c??(0,X.jsx)(O1,{model:e,disabled:l,layout:o}),s===void 0?(0,X.jsx)(d0,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function l0({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=o0({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,X.jsx)(c0,{...a,model:o})}function u0(e){return`model`in e?(0,X.jsx)(c0,{...e}):(0,X.jsx)(l0,{...e})}function d0({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=s0(e),d=u?null:e.saved&&!l?(0,X.jsx)(OG,{tone:`success`,size:`compact`,label:e.saved}):l?(0,X.jsx)(OG,{tone:`neutral`,size:`compact`,label:o}):null;return(0,X.jsxs)(IK,{...c,error:e.error,status:d,children:[r?(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,X.jsx)(NT,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var f0=e=>e,p0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing burger path: ${t}`);return n},m0={apiVersion:1,name:`burger`,palette:{bottomBun:`#e9c46a`,bunSpot:`#d4a373`,cheese:`#f4d03f`,dead:`#636e72`,deadTongue:`#b2bec3`,eye:`#2d3436`,lettuce:`#7cb342`,mouth:`#2d3436`,patty:`#5d4037`,tomato:`#e74c3c`,topBun:`#f4a261`,blush:`#feaae4`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.cylinder({parent:r,name:`bottom-bun`,backface:t(`bottomBun`),color:t(`bottomBun`),diameter:34,frontFace:t(`bunSpot`),length:6,rotate:{x:Math.PI/2},stroke:!1,translate:{y:8}}),e.cylinder({parent:r,name:`patty`,color:t(`patty`),diameter:36,frontFace:t(`patty`),length:4,rotate:{x:Math.PI/2},stroke:!1,translate:{y:3}}),e.cylinder({parent:r,name:`tomato`,color:t(`tomato`),diameter:34,frontFace:t(`tomato`),length:2,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-2}});let i=e.hemisphere({parent:r,name:`top-bun`,backface:t(`bunSpot`),color:t(`topBun`),diameter:38,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-3}});for(let[n,r]of[{x:-8,y:-6,z:14},{x:6,y:-8,z:13},{x:0,y:-10,z:12},{x:10,y:-4,z:13},{x:-5,y:-2,z:15},{x:4,y:-12,z:11}].entries())e.path({parent:i,name:`seed.${String(n+1)}`,path:[{x:0,y:0}],color:t(`bunSpot`),stroke:1.2,translate:r});let a=e.group({parent:r,name:`face`,translate:{y:-5,z:16}}),o=cr(e,t,a,{blushMode:`medium-alias`,hideMouth:!0}),s=e.group({parent:r,name:`burger.mouth`,translate:{y:1,z:10}}),c=f0({angry:[{x:-13,y:2},{x:13,y:2},{x:13,y:5},{bezier:[{x:7,y:4},{x:0,y:5},{x:-7,y:4}]},{x:-13,y:5}],happy:[{x:-12,y:0},{bezier:[{x:-6,y:3},{x:0,y:5},{x:6,y:3}]},{x:12,y:0},{x:13,y:2},{bezier:[{x:7,y:5},{x:0,y:7},{x:-7,y:5}]},{x:-13,y:2}],open:[{x:-10,y:0},{bezier:[{x:-10,y:5},{x:-5,y:8},{x:0,y:8}]},{bezier:[{x:5,y:8},{x:10,y:5},{x:10,y:0}]},{x:10,y:1},{bezier:[{x:5,y:6},{x:-5,y:6},{x:-10,y:1}]}],pout:[{x:-8,y:2},{bezier:[{x:0,y:5},{x:8,y:2},{x:8,y:4}]},{x:0,y:6},{x:-8,y:4}],sad:[{x:-12,y:3},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:3},{x:13,y:5},{bezier:[{x:7,y:2},{x:0,y:1},{x:-7,y:2}]},{x:-13,y:5}],small:[{x:-6,y:1},{x:6,y:1},{x:7,y:3},{x:0,y:2},{x:-7,y:3}],surprised:[],worried:[{x:-11,y:1},{bezier:[{x:-6,y:3},{x:-3,y:1},{x:0,y:2}]},{bezier:[{x:3,y:1},{x:6,y:3},{x:11,y:1}]},{x:12,y:3},{x:0,y:4},{x:-12,y:3}],dead:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}],normal:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}]}),l=f0({angry:[{x:-13,y:0},{x:13,y:0},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:2},{x:-7,y:1}]},{x:-13,y:2}],happy:[{x:-12,y:2},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:2},{x:13,y:3},{bezier:[{x:7,y:1},{x:0,y:0},{x:-7,y:1}]},{x:-13,y:3}],open:[{x:-10,y:2},{bezier:[{x:-10,y:-3},{x:-5,y:-6},{x:0,y:-6}]},{bezier:[{x:5,y:-6},{x:10,y:-3},{x:10,y:2}]},{x:10,y:1},{bezier:[{x:5,y:-4},{x:-5,y:-4},{x:-10,y:1}]}],pout:[{x:-8,y:0},{bezier:[{x:-4,y:-1},{x:0,y:0},{x:4,y:-1}]},{x:8,y:0},{x:9,y:1},{x:0,y:1},{x:-9,y:1}],sad:[{x:-12,y:0},{bezier:[{x:-6,y:2},{x:0,y:3},{x:6,y:2}]},{x:12,y:0},{x:13,y:1},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:1}],small:[{x:-6,y:0},{bezier:[{x:-3,y:1},{x:0,y:0},{x:3,y:1}]},{x:6,y:0},{x:7,y:1},{x:0,y:1},{x:-7,y:1}],surprised:[{x:-13,y:2},{bezier:[{x:-7,y:-2},{x:0,y:-3},{x:7,y:-2}]},{x:13,y:2},{x:14,y:3},{bezier:[{x:8,y:0},{x:0,y:-1},{x:-8,y:0}]},{x:-14,y:3}],worried:[{x:-11,y:1},{bezier:[{x:-6,y:0},{x:-3,y:1},{x:0,y:0}]},{bezier:[{x:3,y:2},{x:6,y:0},{x:11,y:1}]},{x:12,y:2},{bezier:[{x:7,y:1},{x:0,y:1},{x:-7,y:1}]},{x:-12,y:2}],dead:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}],normal:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}]}),u={};for(let n of[`normal`,`happy`,`sad`,`angry`,`surprised`,`dead`,`small`,`worried`,`pout`,`open`]){let r=e.group({parent:s,name:`burger.mouth.${n}`}),i={y:n===`open`?2:n===`small`?.5:1.5,z:+(n===`pout`)};n===`surprised`?e.ellipse({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,height:8,stroke:2,translate:{y:2,z:0},width:6}):e.path({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,path:p0(c,n),stroke:2,translate:i});let a={y:n===`open`?1:n===`surprised`?-1:-.5,z:n===`pout`?2:1};e.path({parent:r,name:`lettuce.${n}`,color:t(`lettuce`),fill:!0,path:p0(l,n),stroke:1.5,translate:a}),u[n]=r}return{root:n,variants:{eyes:o.eyes,mouth:u,blush:o.blush}}},expressions:sr,activities:lr,defaultPresentation:{activity:`idle`,expression:`normal`}},h0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing cat face node: ${t}`);return n},g0=e=>e,_0={apiVersion:1,name:`cat`,palette:{body:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,blush:`#feaae4`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,stripes:`#dea38b`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.path({parent:r,name:`body.sphere`,path:[{x:0,y:0}],color:t(`body`),stroke:32});for(let n of[-1,1])e.path({parent:r,name:`ear.${n<0?`left`:`right`}`,color:t(`body`),fill:!0,path:[{x:-6,y:0},{x:6,y:0},{x:0,y:-10}],rotate:{z:.6*n},stroke:3,translate:{x:9*n,y:-10}});let i=e.group({parent:r,name:`face`,translate:{z:20}}),a=cr(e,t,i,{hideMouth:!0}),o=e.group({parent:i,name:`cat.mouth`,translate:{y:6,z:2}}),s=(n,r,i)=>e.path({parent:o,name:`cat.mouth.${n}`,closed:!1,color:t(`mouth`),path:r,stroke:i}),c=g0({normal:s(`normal`,[{x:-2,y:-1},{x:0,y:0},{x:2,y:-1}],1.5),sad:s(`sad`,[{x:-2.5,y:2},{bezier:[{x:0,y:0},{x:2.5,y:2},{x:2.5,y:2}]}],1.5),angry:s(`angry`,[{x:-3,y:1},{x:3,y:1}],2),small:s(`small`,[{x:-1.5,y:0},{x:1.5,y:0}],1),worried:s(`worried`,[{x:-2,y:1},{bezier:[{x:-.5,y:.5},{x:.5,y:.5},{x:2,y:1}]}],1)}),l=e.group({parent:o,name:`cat.mouth.happy`,translate:{y:1}});e.path({parent:l,closed:!1,color:t(`mouth`),path:[{x:-2.5,y:1},{bezier:[{x:0,y:3},{x:2.5,y:1},{x:2.5,y:1}]}],stroke:1.5}),e.ellipse({parent:l,width:2,height:1.5,stroke:0,fill:!0,color:t(`tongue`),translate:{y:2}}),c.happy=l,c.surprised=e.ellipse({parent:o,name:`cat.mouth.surprised`,width:2.5,height:3,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let u=e.group({parent:o,name:`cat.mouth.dead`,translate:{y:3}});e.ellipse({parent:u,width:2.5,height:1.5,stroke:1.5,fill:!0,color:t(`dead`)}),e.ellipse({parent:u,width:1.2,height:.8,stroke:0,fill:!0,color:t(`deadTongue`),translate:{y:.5}}),c.dead=u,c.pout=e.ellipse({parent:o,name:`cat.mouth.pout`,width:2,height:2.5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}}),c.open=e.ellipse({parent:o,name:`cat.mouth.open`,width:4,height:5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let d=e.group({parent:i,name:`whiskers`,translate:{y:5,z:2}});for(let n of[-1,1]){let r=n*12;for(let[i,a]of[-2,0,2].entries())e.path({parent:d,name:`whisker.${n<0?`left`:`right`}.${String(i)}`,closed:!1,color:t(`eye`),path:[{x:0,y:a},{x:n*8,y:a+(i-1)*1.5}],stroke:.8,translate:{x:r,y:a*.5}})}let f={normal:h0(c,`normal`),happy:c.happy,sad:h0(c,`sad`),angry:h0(c,`angry`),surprised:c.surprised,dead:c.dead,small:h0(c,`small`),worried:h0(c,`worried`),pout:c.pout,open:c.open};return{root:n,variants:{eyes:a.eyes,mouth:f,blush:a.blush}}},expressions:sr,activities:{...lr,listening:{motion:{target:`root`,rotate:{x:-.2},durationMs:300,repeat:`yoyo`},mouseInfluence:.3},thinking:{motion:{target:`root`,rotate:{z:.1},durationMs:800,repeat:`yoyo`},mouseInfluence:0}},defaultPresentation:{activity:`idle`,expression:`normal`}},v0={apiVersion:1,name:`mushroom`,palette:{body:`#fff7e4`,cap:`#f98284`,capSpot:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.hemisphere({parent:r,name:`body.hemisphere`,backface:t(`cap`),color:t(`body`),diameter:32,rotate:{x:3*Math.PI/2},stroke:!1,translate:{y:2}});let i=e.hemisphere({parent:r,name:`cap.hemisphere`,backface:t(`capSpot`),color:t(`cap`),diameter:42,rotate:{x:Math.PI/2},stroke:!1,translate:{y:2}});e.path({parent:i,name:`cap.spot.front`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:12,translate:{x:-8,y:8,z:12}}),e.path({parent:i,name:`cap.spot.top`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:18,translate:{x:8,y:-4,z:13}});let a=e.group({parent:r,name:`face`,translate:{y:7,z:8}}),o=cr(e,t,a,{blushMode:`none`});return{root:n,variants:{eyes:o.eyes,mouth:o.mouth,blush:o.blush}}},expressions:sr,activities:{...lr,error:{geometry:{eyes:`dead`,mouth:`dead`},motion:{target:`root`,rotate:{x:.9},durationMs:600,repeat:`none`},mouseInfluence:.1}},defaultPresentation:{activity:`idle`,expression:`sleepy`}},y0={mushroom:[`cap`,`capSpot`],cat:[`body`,`stripes`],burger:[`topBun`,`bottomBun`]},b0={mushroom:v0,cat:_0,burger:m0};function x0(e){let t=ar(or(b0[e])),n=rr.parse(t.data);return{controls:t.controls,expressions:Object.keys(n.expressions),identitySlots:y0[e]}}var S0=new Map;function C0(e){let t=S0.get(e);return t||(t=x0(e),S0.set(e,t)),t}var w0=Object.freeze({get mushroom(){return C0(`mushroom`)},get cat(){return C0(`cat`)},get burger(){return C0(`burger`)}}),T0={mushroom:`Shiitake`,cat:`Cat`,burger:`Burger`},E0=[[`Rose`,`#f98284`,`#ffe6c6`],[`Peach`,`#f6a55c`,`#ffe9c9`],[`Gold`,`#f2d06b`,`#fff6d1`],[`Leaf`,`#9bd47a`,`#e6f8d8`],[`Mint`,`#5fc7b4`,`#d9f6ef`],[`Sky`,`#6aaee8`,`#dcefff`],[`Lilac`,`#9b8cf0`,`#ebe6ff`],[`Plum`,`#e58bd6`,`#fbe2f6`]];function D0(e,t){if(t===e.character)return e;let n=w0[e.character].identitySlots,r=w0[t].identitySlots,i=Object.fromEntries(r.flatMap((t,r)=>{let i=n[r];return Object.hasOwn(e.appearance,i)?[[t,e.appearance[i]]]:[]}));return{...e,character:t,appearance:i,expression:`normal`}}function O0({value:e,disabled:t=!1,onChange:n}){let r=(0,J.useId)(),i=w0[e.character].identitySlots,a=E0.find(([,t,n])=>i.every((r,i)=>e.appearance[r]===(i===0?t:n)))?.[0]??``;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(X$,{"aria-label":`Character`,className:`grid grid-cols-3 gap-sm`,disabled:t,orientation:`horizontal`,value:e.character,onValueChange:t=>{n(D0(e,Lh.shape.character.parse(t)))},children:Nh.map(t=>(0,X.jsx)(Q$,{id:`${r}-${t}`,value:t,title:T0[t],description:(0,X.jsx)(EX,{avatar:D0(e,t),name:T0[t],size:40})},t))}),(0,X.jsx)(X$,{"aria-label":`Colour`,className:`flex flex-wrap gap-xs`,disabled:t,orientation:`horizontal`,value:a,onValueChange:t=>{let r=E0.find(([e])=>e===t);r&&n({...e,appearance:{...e.appearance,...Object.fromEntries(i.map((e,t)=>[e,r[t===0?1:2]]))}})},children:E0.map(([e,t])=>(0,X.jsx)(`label`,{title:e,className:`grid size-9 cursor-pointer place-items-center rounded-full border border-base-300`,style:{backgroundColor:t},children:(0,X.jsx)(Z$,{value:e,"aria-label":e})},e))})]})}var k0=Ln.check(In(1,{message:`Give your Agent a name.`}),G(256,{message:`Use at most 256 characters.`})),A0=fn(k0),j0=Gh.annotate(N1({label:`Computer`,kind:`select`,options:{new:`New Computer`,none:`No Computer`}})),M0=dt({family:`grove-agent-create-request`,version:1,kinds:{request:{prefix:`request`}}});function N0({create:e,canChooseComputer:t,inputRef:n,error:r,onCancel:i}){let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(()=>Vh(M0.request.generate())),c=o0({schema:(0,J.useMemo)(()=>H({name:k0.annotate(N1({label:`Name`,render:e=>(0,X.jsx)(qG,{ref:n,id:e.id,name:e.name,"aria-label":`New Agent name`,"aria-required":`true`,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],placeholder:`Name your Agent`,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})})),computer:j0}),[n]),defaultValues:{name:``,computer:Gh.make(`new`)},onSubmit:async({name:n,computer:r})=>{let i=t?r:void 0,s=a.current;if(s?.name!==n||s.computer!==i||s.avatar!==o){let e={name:n,requestId:M0.request.generate(),avatar:o};s=i===void 0?e:{...e,computer:i}}return a.current=s,await e(s)?(a.current=null,{kind:`saved`,values:{name:``,computer:Gh.make(`new`)}}):{kind:`refused`}}}),{submitting:l,canSubmit:u,dirty:d}=s0(c);return(0,X.jsxs)(u0,{model:c,"aria-label":`Create Agent`,footer:(0,X.jsxs)(IK,{divider:!1,error:r,children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:l,onClick:i,children:`Cancel`}),(0,X.jsx)(NT,{type:`submit`,className:`shrink-0 disabled:-outline-offset-1`,variant:`primary`,loading:l,disabled:l||!u||!d,children:`Create Agent`})]}),onSubmitCapture:e=>{M(A0(c.form.state.values.name))&&e.currentTarget.querySelector(`input[name="name"]`)?.focus()},onChange:()=>{let e=c.form.state.values;(e.name.trim()!==a.current?.name||t&&e.computer!==a.current.computer)&&(a.current=null)},children:[(0,X.jsx)(O1,{model:c,names:t?[`name`,`computer`]:[`name`]}),(0,X.jsxs)(`fieldset`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(`legend`,{className:`caps-label mb-xs text-sm font-semibold text-base-content`,children:`Avatar`}),(0,X.jsx)(O0,{value:o,disabled:l,onChange:e=>{s(e),a.current=null}})]})]})}function P0({open:e,pending:t,error:n,canChooseComputer:r,create:i,onClose:a,returnFocus:o}){let s=(0,J.useRef)(null);return(0,X.jsx)(kU,{open:e,onOpenChange:e=>{!e&&!t&&a()},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,initialFocus:s,finalFocus:o,keepMounted:!1,children:[(0,X.jsxs)(IU,{children:[(0,X.jsx)(LU,{children:`New Agent`}),(0,X.jsx)(RU,{children:`Agents chat, write and make little games with you.`})]}),(0,X.jsx)(N0,{create:i,canChooseComputer:r,inputRef:s,error:n,onCancel:a})]})})}function F0({open:e,agents:t,defaultAgentId:n,start:r,pending:i,onClose:a,onNewAgent:o,returnFocus:s}){let c=o0({schema:(0,J.useMemo)(()=>H({agentId:W.check(an(e=>t.some(t=>t.agentId===e)||`Choose an Agent.`)).annotate(N1({label:`Agent`,kind:`select`,options:Object.fromEntries(t.map(e=>[e.agentId,HX(e)]))}))}),[t]),defaultValues:{agentId:n??``},onSubmit:async({agentId:e})=>{let t=await r(e);if(t)return{kind:`refused`,error:t}}}),{submitting:l,canSubmit:u}=s0(c);return(0,X.jsx)(kU,{open:e,onOpenChange:e=>{!e&&!i&&!c.form.state.isSubmitting&&a()},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,keepMounted:!1,finalFocus:s,children:[(0,X.jsxs)(IU,{children:[(0,X.jsx)(LU,{children:`New conversation`}),(0,X.jsx)(RU,{children:`Choose who to talk with.`})]}),t.length===0?(0,X.jsxs)(`div`,{className:`grid gap-sm`,children:[(0,X.jsx)(`p`,{children:`No Agent has conversation access yet.`}),o?(0,X.jsx)(NT,{onClick:o,children:`New Agent`}):null,(0,X.jsx)(NT,{variant:`ghost`,onClick:a,children:`Cancel`})]}):(0,X.jsx)(u0,{model:c,"aria-label":`New conversation`,footer:(0,X.jsxs)(IK,{divider:!1,error:c.error,children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:l||i,onClick:a,children:`Cancel`}),(0,X.jsx)(NT,{type:`submit`,loading:l||i,disabled:!u||l||i,children:`Start`})]})})]})})}var I0=J.useLayoutEffect;function L0(e,t,n){J.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function R0(e){let t=J.useRef(null);return J.useImperativeHandle(e,()=>t.current,[]),t}function z0(e){return e[e.length-1]}function B0(e){return typeof e==`function`}function V0(e,t){return B0(e)?e(t):e}var H0=Object.prototype.hasOwnProperty,U0=Object.prototype.propertyIsEnumerable;function W0(e){for(let t in e)if(H0.call(e,t))return!0;return!1}var G0=()=>Object.create(null),K0=(e,t)=>q0(e,t,G0);function q0(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Z0(e)&&Z0(i);if(!a&&!(Y0(e)&&Y0(i)))return i;let o=a?e:J0(e);if(!o)return i;let s=a?i:J0(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:H0.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=q0(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function J0(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!U0.call(e,r))return!1;t.push(r)}return t}function Y0(e){if(!X0(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!X0(n)||!n.hasOwnProperty(`isPrototypeOf`))}function X0(e){return Object.prototype.toString.call(e)===`[object Object]`}function Z0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Q0(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Q0(e[r],t[r],n))return!1;return!0}if(Y0(e)&&Y0(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Q0(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Q0(e[o],t[o],n)))return!1;return i===a}return!1}var $0=/[\x00-\x1f\x7f"<>`{}]/g;function e2(e){return e.replace($0,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function t2(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return e2(t)}var n2=[`http:`,`https:`,`mailto:`,`tel:`];function r2(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function i2(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=t2(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=t2(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function a2(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function o2(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function s2(){throw Error(`Invariant failed`)}function c2(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var l2=4,u2=5;function d2(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function f2(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=d2(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function p2(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=f2(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=h2(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=g2(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=h2(r);e.kind=u2,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=h2(r);e.kind=l2,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)p2(e,t,r,c,i,a,o,s)}function m2(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function h2(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function g2(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function _2(e,t){let n=h2(`/`),r=new Uint16Array(6),i=[];for(let t of e)p2(!1,r,t,1,n,0,i);for(let e of i)e.sort(m2);t.masksTree=n,t.flatCache=c2(1e3)}function v2(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=C2(e,t.masksTree);return t.flatCache.set(e,r),r}function y2(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=h2(`/`),p2(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),C2(r,o,n)}function b2(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=C2(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=T2(a.route)),t.matchCache.set(r,a),a}function x2(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function S2(e,t=!1,n){let r=h2(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;p2(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&s2(),o[e.id]=e,c!==0&&e.path){let t=x2(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(m2);return{processedTree:{segmentTree:r,singleCache:c2(1e3),matchCache:c2(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function C2(e,t,n=!1){let r=e.split(`/`),i=D2(e,r,t,n);if(!i)return null;let[a]=w2(e,r,i);return{route:i.node.route,rawParams:a}}function w2(e,t,n){let r=E2(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===l2)break;if(u.kind===u2){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function T2(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function E2(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function D2(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!z0(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!j2(l,n))continue;if(i.parse){if(!A2(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==l2&&j2(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===l2||i.kind===2)&&j2(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(A2(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&k2(f,o))return n;j2(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+O2(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+O2(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+O2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+O2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function O2(e,t){return 2**(e-t-1)}function k2(e,t){return e===2**(t-1)-1}function A2(e,t,n){let r,i;try{[r,i]=w2(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function j2(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===l2)>(e.node.kind===l2)||t.node.kind===l2==(e.node.kind===l2)&&t.node.depth>e.node.depth)))}function M2(e){return N2(e.filter(e=>e!==void 0).join(`/`))}function N2(e){return e.replace(/\/{2,}/g,`/`)}function P2(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function F2(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function I2(e){return F2(P2(e))}function L2(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function R2(e,t,n){return L2(e,n)===L2(t,n)}function z2({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t===`.`,a=t.startsWith(`/`),o;if(r){o=a?t:i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else if(a)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&z0(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(z0(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=N2(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function B2(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function V2(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>U2(e,n)).join(`/`):U2(r,n):r}function H2({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=f2(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=V2(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=V2(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=V2(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function U2(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function W2(e){return e?.isNotFound===!0}function G2(){try{return sessionStorage}catch{return}}var K2=`tsr-scroll-restoration-v1_3`,q2=G2();function J2(){try{return JSON.parse(q2?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Y2(){try{q2?.setItem(K2,JSON.stringify(X2))}catch{}}var X2=J2(),Z2=`data-scroll-restoration-id`,Q2=e=>e.state.__TSR_key||e.href;function $2(e){let t=e.getAttribute(Z2);if(t)return`[${Z2}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var e4=!1,t4=`window`;function n4(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function r4(e){let t=new Set;for(let n of e){if(n===t4)continue;let e=n4(n);e&&t.add(e)}return t}function i4(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Q2,a=new Set,o=e=>{let t=X2[e]||={};for(let e of a)e===document?t[t4]={scrollX,scrollY}:e.isConnected&&(t[$2(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,e4=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{e4||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Y2()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=X2[d];if(e){let t=X2[u];for(let n in e){if(n===t4){if(s)continue}else{let e=n4(n);if(!e||s&&o&&(l??=r4(o),l.has(e)))continue}t||=X2[u]={},t[n]??=e[n]}}}e4=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=r4(o));let t=e&&i&&c,s=r.restoring?X2[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===t4){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=n4(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{e4=!1}}))}function a4(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function o4(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function s4(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=o4(r):Array.isArray(t)?t.push(o4(r)):n[e]=[t,o4(r)]}return n}var c4=/^(?:\s|["[{\d-]|fa|nu|tr)/,l4=d4(JSON.parse),u4=f4(JSON.stringify,JSON.parse);function d4(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=s4(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function f4(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!c4.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=a4(e,r);return t?`?${t}`:``}}var p4=`__root__`;function m4(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function h4(e){return e instanceof Response&&!!e.options}function g4(e){return{input:({url:t})=>{for(let n of e)t=v4(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=y4(e[n],t);return t}}}function _4(e){let t=I2(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=M2([`/`,t,e.pathname]),e)}}function v4(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function y4(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function b4(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{o2(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var x4=`__TSR_index`,S4=`popstate`,C4=`beforeunload`;function w4(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=k4(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[x4];i=T4(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[x4];i=T4(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[x4]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function T4(e,t){t||={};let n=A4();return{...t,key:n,__TSR_key:n,[x4]:e}}function E4(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>k4(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=A4();t.history.replaceState({[x4]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=k4(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[x4]-l.state[x4],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=w4({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(C4,x,{capture:!0}),t.removeEventListener(S4,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(C4,x,{capture:!0}),t.addEventListener(S4,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function D4(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,r=t.map((e,t)=>T4(t,void 0)),i=()=>k4(t[n],r[n]),a=[];return w4({getLocation:i,getLength:()=>t.length,pushState:(e,i)=>{n<t.length-1&&(t.splice(n+1),r.splice(n+1)),r.push(i),t.push(e),n=Math.max(t.length-1,0)},replaceState:(e,i)=>{r[n]=i,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:e=>e,getBlockers:()=>a,setBlockers:e=>a=e})}function O4(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function k4(e,t){let n=O4(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=A4();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[x4]:0,key:a,__TSR_key:a}}}function A4(){return(Math.random()+1).toString(36).substring(7)}function j4(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function M4(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function N4({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function P4(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var F4=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=B2(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:E4()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=c2(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=b4(this.latestLocation,e),i4(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=I2(a);t&&t!==`/`&&e.push(_4({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:g4(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=S2(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&_2(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:i2(e).path,external:!1,searchStr:o,search:K0(t?.search,i),hash:i2(r.slice(1)).path,state:q0(t?.state,a)}}let o=new URL(i,this.origin),s=v4(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:i2(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:K0(t?.search,c),hash:i2(s.hash.slice(1)).path,state:q0(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>z2({base:e,to:t.includes(`//`)?N2(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=b2(F2(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=t.to?`${t.to}`:void 0,o=r[2],s=Object.assign(Object.create(null),r[3]),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=V4(t.params,s),d=this.routesByPath[F2(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let[e,t,n]=this.getMatchedRoutes(l);f=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&W0(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:i2(H2({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,R4(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=z4(m,t,f,e._includeValidateSearch),m=K0(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?V0(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?V0(t.state,n.state):{};v=q0(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=y4(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=a2(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=v2(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=V4(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=F2(this.latestLocation.href)===F2(n.href)&&Q0(N4(n.state),N4(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=k4(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=v4(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(r2(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await N3(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(M4(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&j4(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=(e.options._builtLocation??this.buildLocation(e.options)).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&r2(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=G4,this.preloadRoute=e=>P3(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=y2(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Q0(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Q0(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??u4,parseSearch:e.parseSearch??l4,protocolAllowlist:e.protocolAllowlist??n2}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=T2(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:F2(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?B4(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=R4(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof I4||(r=new I4(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=H2({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),v=i.id+g+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(_,d);let x;if(!b)try{H4(i,d)}catch(e){if(x=W2(e)||h4(e)?e:new L4(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:K0(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=j4(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:g,updatedAt:Date.now(),search:y?K0(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?q0(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?K0(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=z0(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=z0(a),c={...e.search};for(let e of a)try{Object.assign(c,R4(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{H4(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},I4=class extends Error{},L4=class extends Error{};function R4(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new I4(`Async validation not supported`);if(n.issues)throw new I4(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function z4(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=R4(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=V0(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function B4(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return p4}function V4(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,V0(e,t))}function H4(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function U4(e,t){return e.options[t]?.preload?.()}function W4(e,t){let n=U4(e,`component`),r=U4(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function G4(e,t,n){let r=()=>t===!1?void 0:t?U4(e,t):W4(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function K4(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var q4=0,J4=1,Y4=2,X4=3,Z4=4;function Q4(e){return typeof e[0]==`number`}function $4(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function e3(e,t){return e.routesById[t.routeId]}function t3(e,t,n){return h4(e)?[X4,e]:W2(e)?(e.routeId||=n,[Y4,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[J4,e]:[q4,e])}function n3(e,t){let n=t3(t,!0,e.id);if(n[0]!==J4)return n;try{e.options.onError?.(n[1])}catch(t){n=t3(t,!0,e.id)}return n}function r3(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[Z4]):n3(e,t)}function i3(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function a3(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[4];for(let t=n[7]??0;t<r;t++){let r=s[t],i=e3(e,r);r.abortController=n[0];let u=s[t-1]?.context??e.options.context??{},d={params:r.params,location:o,navigate:i3(e,o),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:i.id},f=u;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...d,deps:r.loaderDeps,context:u})||{}),f={...u,...e},r.context=f}catch(a){return s3(e,r),[t,r3(i,a,n)]}if(c.aborted||!n[2]())return n[0].abort(),[t,[Z4]];let p=r.paramsError??r.searchError;if(p!==void 0)return s3(e,r),[t,r3(i,p,n)];let m=i.options.beforeLoad;if(!m)continue;let h={...d,search:r.search,context:f,...e.options.additionalContext},g=r.status;g===`success`&&t>=a&&(r.status=`pending`),n[8]?.();try{u3(e,r,`beforeLoad`,n[0]);let a=await $4(m(h),c);if(!n[2]())return n[0].abort(),[t,[Z4]];let o=t3(a,!1,i.id);if(o[0]!==q4)return s3(e,r),[t,o];r.context={...f,...a}}catch(a){return s3(e,r),[t,r3(i,a,n)]}finally{g===`success`&&r.status===`pending`&&(r.status=`success`),u3(e,r,!1,n[0])}}i()}function o3(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function s3(e,t){let n=t._flight;t._flight=void 0,o3(e,t,n)?.abort()}function c3(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=o3(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function l3(e){for(let t of e){let e=t._flight;e&&e[2]++}}function u3(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function d3(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:i3(e,s),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function f3(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[Z4];if(!i)return[q4,void 0];let l=n._flight;u3(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(d3(e,t,n,r,s,a,o))).then(e=>t3(e,!1,r.id),e=>t3(e,!0,r.id)).then(t=>(t[0]!==q4&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===J4&&l[2]?n3(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await $4(l[0],c)}catch(t){if(t!==c)throw t;return s3(e,n),[Z4]}finally{u3(e,n,!1,s)}}function p3(e,t,n){t[0]===q4?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==X4&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function m3(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&s3(e,r)}function h3(e,t){return t[0]===J4||t[0]===Y4?{...e,status:t[0]===J4?`error`:`notFound`,error:t[1],_flight:void 0}:e}function g3(e,t,n,r,i,a,o){let s=t[1][n],c=e3(e,s),l=!!a[4],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(d3(e,t,s,c,a[0],i,l))),a[2]()||(a[0].abort(),p=[Z4])),!p){if(s.status!==`success`)f=!0;else{let t=a[4]||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[6]||s.cause===`enter`||a[3].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(t){s.invalid=!0,s3(e,s),p=r3(c,t,a)}let m=c.options.loader,h=typeof m==`function`?m:m?.handler,g=(!l||c.options.preload!==!1)&&m?e._flights?.get(s.id):void 0;g===s._flight||p?g=void 0:g&&!f&&!l&&d===void 0?f=!0:f||(g=void 0);let _=!!(m&&f&&s.status===`success`&&!l&&!a[5]&&((typeof m==`function`?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),v=f&&(!l||c.options.preload!==!1),y=v&&!_&&(s.status!==`success`||!!m),b=c.lazyFn&&c._lazy!==!0?a[8]:void 0;if(v&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),g&&g[2]++,y){let t=s._flight;s._flight=g,o3(e,s,t)?.abort(),s.status===`success`&&n>=o&&(s.status=`pending`),a[8]?.()}v||(s.isFetching=!1);let x=(p?Promise.resolve(p):y?f3(e,t,s,c,h,i,l,a[0]):Promise.resolve([q4,s.loaderData])).then(t=>(y&&(p3(s,t,l),t[0]===q4&&(m&&!a[0].signal.aborted&&m3(e,s,u),s.status=`pending`)),t)),S=$4(Promise.resolve().then(()=>G4(c,void 0,b)),a[0].signal).then(()=>void 0,e=>[n,r3(c,e,a)]).then(e=>x.then(t=>(y&&!e&&t[0]===q4&&s.status===`pending`&&a[2]()&&(s.status=`success`,a[8]?.()),e)));if(r.push([n,x,S]),!_)return x.then(e=>h3(s,e));let C={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let w=f3(e,t,C,c,h,i,!1,a[0]).then(e=>(s.isFetching=!1,p3(C,e,!1),e));return(t[2]??=[]).push([n,w,S,C]),w.then(e=>h3(C,e))}async function _3(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=e3(e,t[n]),a=G4(i,!1);if(a)try{await $4(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function v3(e,t){t[2]&&=(c3(e,t[2].map(e=>e[3])),void 0)}async function y3(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=X4)throw[a,t];!i&&t[0]!==q4&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===X4)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function b3(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Y4?_3(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=X4)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==q4&&t[0]<X4&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=X4){let n=c[1];if(n[0]!==X4||n[1].options.reloadDocument||i<20)return v3(e,t),n;l=!0,c=[0,[J4,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===J4?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};f();let m=e3(e,u);try{await $4(i?Promise.resolve().then(()=>G4(m,a===J4?`errorComponent`:`notFoundComponent`)):Promise.all([G4(m),G4(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return v3(e,t),[Z4]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),v3(e,t),c3(e,s),f()):(u.status=`success`,o?.())}return t}async function x3(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=e3(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await $4(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function S3(e,t,n,r){let i=[t,n],a=e.stores.matches.get(),o=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&o>=0){let t=await _3(e,i[1],void 0,r[0].signal,o);t!==o&&(n[o]._notFound=void 0,n[t]._notFound=!0),o=t}let s=o<0?n.length:o+1,c=0;for(;c<s&&c!==o;){let e=n[c],t=r[3][c],i=a[c];if(t?.id!==e.id||t.status!==`success`||t._notFound||e.preload||i?.id!==e.id||i.status!==`success`||i._notFound)break;c++}let l=[],u=r[7]??0,d=u?Promise.resolve(i[1][u-1]):void 0,f=()=>{for(let t=u;t<s&&!r[0].signal.aborted;t++)d=g3(e,i,t,l,d,r,c)},p=await a3(e,i,r,s,f,c);if(p&&(r[5]=!0,s=p[0],p[1][0]===Y4?(p[2]=await _3(e,i[1],p,r[0].signal),s=Math.min(s,p[2]+1)):p[1][0]>=X4&&(s=0),f()),r[2]()&&!r[4]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let m;try{let t=b3(e,i,l,r[0],r[1],y3(l,p,i[2]),r[8]);i[2]?.length&&(i[3]=y3(i[2],void 0,void 0,t.then(e=>Q4(e)?0:K4(e[1]).length,()=>0))),m=await t}catch(t){throw v3(e,i),t}return Q4(m)?m:x3(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function C3(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=t[3],o=e.stores.matches.get(),s=-1,c,l,u,d=!1;for(let t=0;t<a.length;t++){let n=a[t],r=n.status===`success`;if(d=o[t]?.id===n.id&&o[t]?.status===`pending`,r&&!d)continue;let i=e3(e,n);if(c=r&&d||n.invalid?0:i.options.pendingMs??e.options.defaultPendingMs,u=i.options.pendingComponent??e.options.defaultPendingComponent,!u||typeof c!=`number`||c===1/0)return;s=t,l=i.options.pendingMinMs??e.options.defaultPendingMinMs??0;break}if(s<0)return;let f=a[s].id;if((!n||n[1]!==s||i!==f)&&(clearTimeout(n?.[3]),e._pending=n=[t,s,d?Date.now()+l:t[4]+c,void 0,d?Promise.resolve(!0):void 0,u]),n[4]&&!r&&n[5]===u)return;if(n[5]=u,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>C3(e,t),r);return}n[2]=0}let p=a.map(e=>({...e,_flight:void 0}));p[s].status=`pending`;let m=e.startTransition(()=>e.stores.setMatches(p),p).then(t=>(t&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+l),t));n[4]=m}function w3(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function T3(e,t){e._committed=t,e.stores.setMatches(t)}function E3(e,t){c3(e,t[1]),v3(e,t)}function D3(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=K4(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=e3(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,T3(e,n),c3(e,[...a.values(),...i],[...n,...s.values()]),P4(e,i,n,()=>e._tx===t)}async function O3(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function k3(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function A3(e,t){w3(e,t),t[0].abort(),c3(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function j3(e,t,n,r,i){let a=n.map(e=>({...e}));l3(a);for(let t of r)s3(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await b3(e,o,r,t[0],t[1],i)}catch(t){throw c3(e,a),t}if(Q4(s)){c3(e,a),s[0]===X4&&e._tx===t&&e._committed===n&&await k3(e,t,s[1]);return}let c=await x3(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){c3(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),s3(e,n))}T3(e,c[1]),c3(e,n,c[1])}async function M3(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await S3(e,t[2],t[3],o);if(Q4(s)){s[0]===X4&&e._tx===t?(w3(e,t),c3(e,t[3]),t[3]=[],e._tx===t&&await k3(e,t,s[1])):A3(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await $4(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await $4(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){w3(e,t),E3(e,s);return}let l=t[2],u=M4(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){E3(e,s);return}let n=await e.startTransition(()=>{w3(e,t),D3(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){v3(e,s);return}d?.length&&j3(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function N3(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await O3(e,n);return}let f=M4(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await O3(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),l3(m)}catch(t){if(u.abort(),!h4(t)){await O3(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await O3(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){c3(e,m),await O3(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>M3(e,_,p,()=>C3(e,_),t?.sync,g)).catch(()=>{e._tx===_&&A3(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&u3(e,t,!1)}n[0].abort(),c3(e,n[3],_[3],!0)}if(e._tx!==_){c3(e,_[3]),_[3]=[],await O3(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),!r&&!m.some(e=>e._notFound)&&C3(e,_);try{await _[5]}finally{await O3(e,_)}}async function P3(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),l3(o)}catch(e){a.abort(),W2(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await S3(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),c3(e,o),a.abort()}if(!Q4(t))return t[1];if(s&&t[0]===X4&&!t[1].options.reloadDocument)return P3(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){W2(e)||console.error(e)}}var F3=`Error preloading route! ☝️`,I3=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=p4:this.parentRoute||s2();let r=n?p4:t?.path;r&&r!==`/`&&(r=P2(r));let i=t?.id||r,a=n?p4:M2([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=M2([`/`,a]));let o=a===`__root__`?`/`:M2([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=F2(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>m4({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},L3=class extends I3{constructor(e){super(e)}};function R3(e){return(0,X.jsx)(z3,{...e})}var z3=class extends J.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?J.createElement(this.props.errorComponent??B3,{error:e,reset:this.reset}):this.props.children}};function B3({error:e}){let[t,n]=J.useState(!1);return(0,X.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,X.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,X.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,X.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,X.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,X.jsx)(`div`,{children:(0,X.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,X.jsx)(`code`,{children:e.message}):null})}):null]})}function V3({children:e,fallback:t=null}){return(0,X.jsx)(J.Fragment,{children:H3()?e:t})}function H3(){return J.useSyncExternalStore(U3,()=>!0,()=>!1)}function U3(){return()=>{}}var W3=J.createContext(null);function G3(e){return J.useContext(W3)}var K3=J.createContext(void 0),q3=J.createContext(void 0),J3=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(J3||{});function Y3({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function X3(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Z3=[],Q3=0,{link:$3,unlink:e6,propagate:t6,checkDirty:n6,shallowPropagate:r6}=Y3({update(e){return e._update()},notify(e){Z3[a6++]=e,e.flags&=~J3.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=J3.Mutable|J3.Dirty,l6(e))}}),i6=0,a6=0,o6,s6=0;function c6(e){try{++s6,e()}finally{--s6||u6()}}function l6(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=e6(n,e)}function u6(){if(!(s6>0)){for(;i6<a6;){let e=Z3[i6];Z3[i6++]=void 0,e.notify()}i6=0,a6=0}}function d6(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?J3.None:J3.Mutable,get(){return o6!==void 0&&$3(i,o6,Q3),i._snapshot},subscribe(e){let t=X3(e),n={current:!1},r=f6(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=o6,o=t?.compare??Object.is;if(n)o6=i,++Q3,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=J3.Mutable|J3.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{o6=a,n&&(i.flags&=~J3.RecursedCheck),l6(i)}}};return n?(i.flags=J3.Mutable|J3.Dirty,i.get=function(){let e=i.flags;if(e&J3.Dirty||e&J3.Pending&&n6(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&r6(e)}}else e&J3.Pending&&(i.flags=e&~J3.Pending);return o6!==void 0&&$3(i,o6,Q3),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(t6(e),r6(e),u6())}},i}function f6(e){let t=()=>{let t=o6;o6=n,++Q3,n.depsTail=void 0,n.flags=J3.Watching|J3.RecursedCheck;try{return e()}finally{o6=t,n.flags&=~J3.RecursedCheck,l6(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:J3.Watching|J3.RecursedCheck,notify(){let e=this.flags;e&J3.Dirty||e&J3.Pending&&n6(this.deps,this)?t():this.flags=J3.Watching},stop(){this.flags=J3.None,this.depsTail=void 0,l6(this)}};return t(),n}var p6=t((e=>{var t=dr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),m6=t(((e,t)=>{t.exports=p6()})),h6=t((e=>{var t=dr(),n=m6();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),g6=t(((e,t)=>{t.exports=h6()}))();function _6(e,t){return e===t}function v6(e,t,n=_6){let r=(0,J.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,J.useCallback)(()=>e?.get(),[e]);return(0,g6.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var y6={};function b6(e,t){let n=J.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=q0(n.current,i):i}}function x6(e){let t=G3(),n=J.useContext(e.from?q3:K3),r=e.from??n,i=t.stores.getMatchStore(r),a=b6(e,t),o=v6(i,e=>e?a(e):y6);if(o!==y6)return o;(e.shouldThrow??!0)&&s2()}function S6(e){return x6({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function C6(e){let{select:t,...n}=e;return x6({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function w6(e){return x6({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function T6(e){return x6({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function E6(e){let t=G3();return J.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function D6(e){return x6({...e,select:t=>e.select?e.select(t.context):t.context})}function O6(e){let t=J.useRef(e);return Q0(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function k6(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function A6(e,t,n){if(e?.external)return r2(e.href,n)?void 0:e.href;if(!V6(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),r2(t,n)?void 0:t}catch{}}function j6(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!R2(e.pathname,t.pathname,r))return!1}else{let n=L2(e.pathname,r),i=L2(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!Q0(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function M6(e,t){let n=G3(),r=R0(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:ee,...I}=e,te=H3(),ne=O6(e.search),re=O6(e.params),ie=O6(o),L=J.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ne,re,e.state,e.mask,e.unsafeRelative]),ae=J.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...L}),r=B6(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=A6(r,s,n.protocolAllowlist);return[r?.href,i,j6(e,t,ie,n.basepath,te,i!==void 0)]},[ie,v,te,L,n,s]),[oe,R,se]=v6(n.stores.location,ae,k6),ce=se?V0(i,{})??P6:N6,le=se?N6:V0(a,{})??N6,z=[b,ce.className,le.className].filter(Boolean).join(` `),ue=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},de=J.useRef(!1),fe=e.reloadDocument||R||v?!1:c??n.options.defaultPreload,pe=l??n.options.defaultPreloadDelay??0,me=J.useCallback(()=>{n.preloadRoute(L).catch(e=>{console.warn(e),console.warn(F3)})},[n,L]),B=J.useCallback(e=>{if(!e){R6(r);return}if(!(e.isIntersecting??fe===`intent`)){e.isIntersecting===!1&&R6(r);return}if(!pe){me();return}L6.has(r)||L6.set(r,setTimeout(()=>{L6.delete(r),me()},pe))},[me,r,fe,pe]);L0(r,B,fe!==`viewport`),J.useEffect(()=>{de.current||fe===`render`&&(me(),de.current=!0)},[me,fe]);let he=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!U6(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...L,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(R)return{...I,ref:r,href:R,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ge=()=>{fe===`intent`&&me()},_e=()=>{fe===`intent`&&R6(r)};return{...I,...ce,...le,href:oe,ref:r,onClick:z6([x,he]),onBlur:z6([S,_e]),onFocus:z6([C,B]),onMouseEnter:z6([w,B]),onMouseLeave:z6([T,_e]),onTouchStart:z6([E,ge]),disabled:!!v,target:_,...ue&&{style:ue},...z&&{className:z},...v&&F6,...se&&I6}}var N6={},P6={className:`active`},F6={role:`link`,"aria-disabled":!0},I6={"data-status":`active`,"aria-current":`page`},L6=new WeakMap,R6=e=>{clearTimeout(L6.get(e)),L6.delete(e)},z6=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function B6(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function V6(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var H6=J.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=M6(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return J.createElement(`a`,t,o)}return J.createElement(n,a,o)});function U6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var W6=class extends I3{constructor(e){super(e),this.useMatch=e=>x6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>D6({...e,from:this.id}),this.useSearch=e=>T6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>w6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>C6({...e,from:this.id}),this.useLoaderData=e=>S6({...e,from:this.id}),this.useNavigate=()=>E6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(H6,{ref:t,from:this.fullPath,...e}))}};function G6(e){return new W6(e)}var K6=class extends L3{constructor(e){super(e),this.useMatch=e=>x6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>D6({...e,from:this.id}),this.useSearch=e=>T6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>w6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>C6({...e,from:this.id}),this.useLoaderData=e=>S6({...e,from:this.id}),this.useNavigate=()=>E6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(H6,{ref:t,from:this.fullPath,...e}))}};function q6(e){return new K6(e)}function J6(e){let t=G3(),n=`not-found-${v6(t.stores.location,e=>e.pathname)}-${v6(t.stores.status,e=>e)}`;return(0,X.jsx)(R3,{getResetKey:()=>n,onCatch:(t,n)=>{if(W2(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(W2(t))return e.fallback?.(t);throw t},children:e.children})}function Y6(){return(0,X.jsx)(`p`,{children:`Not Found`})}function X6(e){return(0,X.jsx)(X.Fragment,{children:e.children})}function Z6(e,t,n){return t.options.notFoundComponent?(0,X.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,X.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,X.jsx)(Y6,{})}function Q6(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,X.jsx)(n,{}):null}var $6=(e,t)=>e[0]===t[0]&&e[1]===t[1],e8=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,t8=J.memo(function({routeId:e}){let t=G3();return(0,X.jsx)(n8,{router:t,match:v6(t.stores.getMatchStore(e),e=>e)})});function n8({router:e,match:t}){let n=e.routesById[t.routeId],r=Q6(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=e8(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?J.Suspense:X6,l=i?R3:X6,u=o?J6:X6;return(0,X.jsxs)(n.isRoot?n.options.shellComponent??X6:X6,{children:[(0,X.jsx)(K3.Provider,{value:t.routeId,children:(0,X.jsx)(c,{fallback:r,children:(0,X.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(W2(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,X.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return J.createElement(o,e)},children:s?(0,X.jsx)(V3,{fallback:r,children:(0,X.jsx)(r8,{match:t})}):(0,X.jsx)(r8,{match:t})})})})}),null]})}var r8=J.memo(function({match:e}){let t=G3(),n=e.routeId,r=t.routesById[n],i=J.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=J.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,X.jsx)(e,{},i):(0,X.jsx)(i8,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!e8(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Q6(t,r)}if(e.status===`notFound`)return Z6(t,r,e.error);if(e.status===`error`)throw e.error;return a}),i8=J.memo(function(){let e=G3(),t=J.useContext(K3),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=v6(a,e=>[!!e._notFound,e.error],$6),i=v6(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Z6(e,e.routesById[t],r);if(!i)return null;let a=(0,X.jsx)(t8,{routeId:i});return t===`__root__`?(0,X.jsx)(J.Suspense,{fallback:Q6(e),children:a}):a});function a8(e,t){let n=e[1];e.length=0,n?.(t)}function o8({t:e}){let t=G3(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{a8(n,!1),n.push(i,a),e(t),J.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),I0(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(F2(r.publicHref)!==F2(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...M4(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function s8(){let e=G3(),t=e.routesById[p4],n=Q6(e,t),r=e.ssr?X6:J.Suspense,i=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o8,{t:J.useState()[1]}),(0,X.jsx)(r,{fallback:n,children:(0,X.jsx)(c8,{})})]});return e.options.InnerWrap?(0,X.jsx)(e.options.InnerWrap,{children:i}):i}function c8(){let e=G3(),t=e._rendered,n=v6(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;I0(()=>{t[0]===n&&a8(t,!0)},[t,n]);let a=i?(0,X.jsx)(t8,{routeId:i}):null;return(0,X.jsx)(K3.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,X.jsx)(R3,{getResetKey:()=>r,onCatch:void 0,children:a})})}var l8=e=>({createMutableStore:d6,createReadonlyStore:d6,batch:c6}),u8=e=>new d8(e),d8=class extends F4{constructor(e){super(e,l8)}};function f8({router:e,children:t,...n}){W0(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,X.jsx)(W3.Provider,{value:e,children:t});return e.options.Wrap?(0,X.jsx)(e.options.Wrap,{children:r}):r}function p8({router:e,...t}){return(0,X.jsx)(f8,{router:e,...t,children:(0,X.jsx)(s8,{})})}function m8(e){let t=G3({warn:e?.router===void 0}),n=e?.router||t;return v6(n.stores.__store,b6(e,n))}function h8(){return v6(G3().stores.location,e=>e.state.__TSR_index!==0)}var g8=(0,J.createContext)(null),_8=g8.Provider,v8=q6({validateSearch:Ze({agent:V().min(1).optional()}),component:()=>null}),y8=G6({getParentRoute:()=>v8,path:`/`}),b8=G6({getParentRoute:()=>v8,path:`/sessions/$agentId/$sessionId`,params:{parse:e=>Ze({agentId:V().min(1),sessionId:V().min(1)}).parse(e)}});function x8(){return u8({routeTree:v8.addChildren([y8,b8]),history:D4(),InnerWrap:({children:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,J.useContext)(g8),e]}),defaultPendingMs:0,defaultPendingMinMs:0})}function S8(e,t){let n=m8({router:e,select:e=>e.location.search}),r=x6({from:b8.id,shouldThrow:!1});Rm(t,{canGoBack:h8(),onBack:()=>e.history.canGoBack()?(e.history.back(),!0):!1});let i=(0,J.useCallback)(t=>{e.navigate({to:`.`,search:{agent:t??void 0},replace:!0})},[e]),a=(0,J.useCallback)((t,n)=>{e.navigate({to:`/sessions/$agentId/$sessionId`,params:{agentId:t,sessionId:n},search:!0})},[e]);return{agentFilterId:n.agent??null,setFilter:i,selection:r?.params,open:a}}var C8=Ln.check(In(1,{message:`Give your Agent a name.`}),G(256,{message:`Use at most 256 characters.`}));function w8({agentId:e,name:t,rename:n}){let[r,i]=(0,J.useState)(!1),a=o0({schema:(0,J.useMemo)(()=>H({name:C8.annotate(N1({label:`Agent name`,render:e=>(0,X.jsx)(qG,{id:e.id,name:e.name,"aria-label":`Agent name`,"aria-invalid":e[`aria-invalid`],"aria-describedby":e[`aria-describedby`],autoFocus:!0,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})}))}),[]),defaultValues:{name:t},onSubmit:async({name:r})=>r===t||await n(e,r)?(i(!1),{kind:`saved`,values:{name:r}}):{kind:`refused`}}),{submitting:o,canSubmit:s}=s0(a);return r?(0,X.jsxs)(u0,{model:a,"aria-label":`Rename Agent`,footer:null,className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(O1,{model:a,names:[`name`]})}),(0,X.jsx)(NT,{type:`submit`,size:`sm`,loading:o,disabled:o||!s,children:`Save`}),(0,X.jsx)(AG,{"aria-label":`Cancel rename`,type:`button`,icon:(0,X.jsx)(cW,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!1)}})]}):(0,X.jsx)(AG,{"aria-label":`Rename Agent`,icon:(0,X.jsx)(tW,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!0)}})}function T8({status:e,approving:t,onApprove:n}){return e?.status===`pending`?(0,X.jsx)(NT,{variant:`outline`,size:`sm`,className:`flex-none`,loading:t,disabled:t,onClick:n,children:`Allow App tools`}):null}var E8=H({text:W}),D8=_r(structuredClone(pn(E8,{onExcessProperty:`error`}).schema));function O8(e){return[{id:`new-conversation`,title:`New conversation`,category:`Conversation`,description:`Start a new conversation with this Agent`,projections:{slash:{aliases:[`new`],order:20},palette:{}},handler:()=>{e().newConversation()}},{id:`permissions`,title:`App permissions`,category:`Conversation`,description:`Review what Grove may access`,projections:{slash:{aliases:[`permissions`],order:21},palette:{}},handler:()=>{e().openPermissions()}},{id:`set-draft`,title:`Set draft`,category:`Conversation`,description:`Replace the open writable Grove conversation's draft without sending it`,projections:{agent:{}},action:{inputSchema:D8,presentation:{type:`action`}},handler:({arguments:t})=>{let{text:n}=Hn(E8,{onExcessProperty:`error`})(t);return{accepted:e().setDraft(n)}}}]}function k8(e,t){let n=(0,J.useRef)(e);n.current=e;let r=(0,J.useMemo)(()=>O8(()=>n.current),[]),i=(0,J.useMemo)(()=>Jr(),[]);return(0,J.useEffect)(()=>{let e=i.contribute({sourceId:`grove`,namespace:`grove`,commands:r});return()=>{e.dispose()}},[r,i]),(0,J.useEffect)(()=>t?Ui(t,r):void 0,[r,t]),i}function A8(e){let t=$i(),n=e?.capabilities.has(cg)===!0||e?.capabilities.has(lg)===!0,r=Zy(n?e:null),i=e&&!n?{...r,status:`live`}:r,a=qy.of(e,`agents`),o=Oo({...Xy(e,Zh,a,e=>e.list()),enabled:e?.capabilities.has(Zh)===!0}),s=new Set(o.data?.map(e=>e.agentId)),c=o.isSuccess?JSON.stringify([...new Set(i.items.filter(e=>!(`kind`in e)).map(e=>e.agentId))].filter(e=>!s.has(e)).sort()):`[]`,{refetch:l}=o;return(0,J.useEffect)(()=>{c!==`[]`&&i.items.length>0&&l()},[c,i.items,l]),{directory:o,inbox:i,createAgent:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return ug(e.capabilities,t)},onMutate:()=>({directoryKey:a}),onSuccess:(e,n,r)=>{t.setQueryData(r.directoryKey,(t=[])=>t.some(t=>t.agentId===e.agentId)?t:[...t,e])}}),renameAgent:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return tg(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}}),setAgentAvatar:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return ig(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}})}}function j8(e,t){let n=$i(),r=e?.capabilities.has(sg)===!0,i=qy.of(e,`agent-tool-policy`,t??`none`);return{canRead:r,status:Oo({...Xy(e,sg,i,e=>t===null?Promise.resolve(null):e.status({agentId:t})),enabled:r&&t!==null}),approve:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return e.capabilities.require(sg).approve({agentId:t.agentId,level:`write`,expectedRevision:t.expectedRevision})},onSuccess:e=>{`error`in e||n.setQueryData(i,e)}})}}function M8({agentId:e,name:t,avatar:n,setAvatar:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),c=(0,X.jsx)(EX,{avatar:n,name:t,size:24});return r===void 0?(0,X.jsx)(`span`,{className:`flex-none`,children:c}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,"aria-label":`Change avatar`,className:`flex-none p-0`,onClick:()=>{a(n)},children:c}),(0,X.jsx)(kU,{open:i!==null,onOpenChange:e=>{!e&&!o&&a(null)},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,keepMounted:!1,children:[(0,X.jsxs)(IU,{children:[(0,X.jsxs)(LU,{children:[t,`'s avatar`]}),(0,X.jsxs)(RU,{children:[`Every conversation with `,t,` shows this look.`]})]}),i===null?null:(0,X.jsx)(O0,{value:i,disabled:o,onChange:a}),(0,X.jsxs)(FU,{children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:o,onClick:()=>{a(null)},children:`Cancel`}),(0,X.jsx)(NT,{type:`button`,variant:`primary`,loading:o,disabled:o||i===null,onClick:()=>{i!==null&&(s(!0),r(e,i).then(e=>{s(!1),e&&a(null)}))},children:`Save`})]})]})})]})}var N8=(0,J.forwardRef)(function({className:e,orientation:t,variant:n=`grip`,value:r,min:i,max:a,onValueChange:o,onKeyDown:s,...c},l){return(0,X.jsx)(`div`,{...c,ref:l,className:Q(`caps-resize-handle`,e),"data-resize-variant":n,role:`separator`,"aria-orientation":t,"aria-valuemin":Math.round(i),"aria-valuemax":Math.round(a),"aria-valuenow":Math.round(r),tabIndex:c.tabIndex??0,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;if(e.key===`Home`||e.key===`End`){e.preventDefault(),o(e.key===`Home`?i:a);return}let n=t===`horizontal`?e.key===`ArrowUp`?-32:e.key===`ArrowDown`?32:null:e.key===`ArrowLeft`?-32:e.key===`ArrowRight`?32:null;n!==null&&(e.preventDefault(),o(Math.min(a,Math.max(i,r+n))))},children:(0,X.jsx)(`span`,{className:`caps-resize-grip`,"aria-hidden":`true`})})});$({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map});function P8(e,t=!0,n){let r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(null);return(0,J.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,J.useEffect)(()=>{let e=()=>{i.current?.release(!0)};return n?.addEventListener(`abort`,e),()=>{n?.removeEventListener(`abort`,e)}},[n]),{onPointerDown:e=>{if(!t||n?.aborted||i.current||e.pointerType===`mouse`&&e.button!==0)return;let{currentTarget:a,pointerId:o}=e;if(a.setPointerCapture(o),!r.current.begin(e)){a.releasePointerCapture(o);return}let s=r.current.end,c=()=>{l(!0)},l=e=>{a.removeEventListener(`lostpointercapture`,c),i.current=null,s(e),a.hasPointerCapture(o)&&a.releasePointerCapture(o)};i.current={id:o,element:a,x:e.clientX,y:e.clientY,release:l},a.addEventListener(`lostpointercapture`,c)},onPointerMove:e=>{let t=i.current;t?.id===e.pointerId&&(r.current.move(e.clientX-t.x,e.clientY-t.y,e),t.x=e.clientX,t.y=e.clientY)},onPointerUp:e=>{i.current?.id===e.pointerId&&i.current.release(!1)},onPointerCancel:e=>{i.current?.id===e.pointerId&&i.current.release(!0)}}}(0,J.createContext)(null);var F8=(0,J.createContext)(null);(0,J.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,J.useContext)(F8),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(!s)return;let e=()=>{l(Array.from(s.querySelectorAll(`*`)).some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}))};e();let t=new MutationObserver(e);return t.observe(s,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[s]);let u=(0,J.useRef)(null);(0,J.useImperativeHandle)(i,()=>u.current);let d=(0,J.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,J.createElement)(`div`,{...r,ref:d,onFocusCapture:t=>{e===`windows`&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&a?.dismiss?.(),r.onFocusCapture?.(t)},"data-maosaico-layer":e,inert:e===`windows`&&c?``:void 0,style:{position:`relative`,...t,isolation:`isolate`,zIndex:`var(--stipe-layer-${e})`}},n)});var I8={min:224,max:480,initial:320},L8={agentRailOpen:!0,listRailOpen:!0,listWidth:I8.initial},R8=`fungi.grove.layout.v1`,z8=fn(Gn(H({agentRailOpen:wt,listRailOpen:wt,listWidth:Jt.pipe(q(yt()))})));function B8(e){return Math.round(Math.min(I8.max,Math.max(I8.min,e)))}function V8(e){try{let t=e?.getItem(R8);if(t==null)return L8;let n=z8(t);return Ce(n)?{...n.value,listWidth:B8(n.value.listWidth)}:L8}catch(e){return console.warn(`Grove could not read its saved rail layout`,e),L8}}function H8(e,t){try{e?.setItem(R8,JSON.stringify(t))}catch(e){console.warn(`Grove could not save its rail layout`,e)}}function U8(){try{return globalThis.localStorage}catch(e){console.warn(`Grove rail layout storage is unavailable`,e);return}}function W8(){let[e,t]=(0,J.useState)(()=>V8(U8()));return(0,J.useEffect)(()=>{H8(U8(),e)},[e]),[e,t]}var G8={2:`h2`,3:`h3`,4:`h4`};function K8(e,t){let{reduced:n}=t,r=e&&!n,i=cS(t,600),[a,o]=(0,J.useState)(r);return(0,J.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var q8=(0,J.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,J.useId)(),p=(0,J.useRef)(null),m=sS(p),h=K8(l===`speech`,m)&&!a,g=G8[r],_=c?c({speaking:h,thinking:a}):s,v=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,X.jsx)(`p`,{children:n}),i&&i.length>0?(0,X.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(NT,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,X.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,X.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:Q(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,X.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})});function J8({description:e,icon:t,label:n,density:r=`regular`,appearance:i=`plain`,iconSize:a=`default`,size:o,trailing:s,...c}){return(0,X.jsxs)(NT,{...c,className:Q(`caps-action-row`,i===`card`&&`caps-action-row-card`,r===`compact`?`h-auto min-h-10 w-full justify-start gap-xs px-xs py-2xs text-left`:`h-auto min-h-14 w-full justify-start gap-sm px-sm py-xs text-left`,c.className),size:o??(r===`compact`?`default`:`lg`),variant:c.variant??`ghost`,children:[t?(0,X.jsx)(`span`,{className:r===`compact`?`grid ${a===`lg`?`size-8`:`size-7`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-5`:`grid ${a===`lg`?`size-12`:`size-10`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-7`,children:t}):null,(0,X.jsxs)(`span`,{className:`caps-action-row-copy`,children:[(0,X.jsx)(`span`,{className:`caps-action-row-label max-w-full truncate`,children:n}),e?(0,X.jsx)(`span`,{className:`caps-action-row-description max-w-full truncate`,children:e}):null]}),s?(0,X.jsx)(`span`,{className:`caps-action-row-trailing`,children:s}):null]})}function Y8(e,t,n,r,i){let a=[];r&&a.push({kind:`hint`,key:`loading`,loading:!0});let o=0,s=[...e.active,...e.settled],c=new Map(s.map(e=>[VX(e.agentId,e.sessionId),e]));for(let e of[`Needs you`,`Working`,`Ready`,`Finished`]){let n=t.filter(t=>t.shelf===e).flatMap(e=>{let t=c.get(e.key);return t===void 0?[]:[t]});if(n.length!==0){a.push({kind:`heading`,key:e,title:e,gap:o++>0});for(let t of n)a.push({kind:`session`,key:VX(t.agentId,t.sessionId),shelf:e,session:t})}}if(e.unavailable.length>0){a.push({kind:`heading`,key:`Unavailable`,title:`Unavailable`,gap:o>0});for(let t of e.unavailable)a.push({kind:`unavailable`,key:VX(t.agentId,t.sessionId),session:t})}if(n.length>0){a.push({kind:`heading`,key:`Websites`,title:`Websites`,gap:a.length>0});for(let e of n)a.push({kind:`website`,key:`website:${e.bindingId}:${e.conversation.sessionId}`,website:e})}return a.length===0&&!i&&a.push({kind:`hint`,key:`empty`,loading:!1}),a}function X8({viewport:e,view:t,agents:n,loading:r,failed:i,pendingSelection:a,selectedAgentId:o,selectedSessionId:s,onSelect:c,onDelete:l,deleting:u,websites:d,selectedWebsite:f,onSelectWebsite:p}){let m=o!==null&&s!==null?VX(o,s):null,[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),y=h||_,[b,x]=(0,J.useState)(0),[S,C]=(0,J.useState)({placements:null,openKey:m,reopened:b}),w=(0,J.useMemo)(()=>LX(S.placements,[...t.active,...t.settled],{openKey:S.openKey===m?m:null,held:y,reorder:S.openKey!==m||S.reopened!==b}),[S,t,m,y,b]);(0,J.useEffect)(()=>{!y&&(S.placements!==w||S.openKey!==m||S.reopened!==b)&&C({placements:w,openKey:m,reopened:b})},[y,S,w,m,b]),(0,J.useEffect)(()=>{let t=e.current;if(t===null)return;let n=t.clientWidth>0&&t.clientHeight>0,r=`ResizeObserver`in globalThis?new ResizeObserver(([e])=>{let t=e.contentRect.width>0&&e.contentRect.height>0;t&&!n&&x(e=>e+1),n=t}):void 0;r?.observe(t);let i=()=>{document.visibilityState===`visible`&&x(e=>e+1)};return document.addEventListener(`visibilitychange`,i),()=>{r?.disconnect(),document.removeEventListener(`visibilitychange`,i)}},[e]);let T=(0,J.useMemo)(()=>Y8(t,w,d,r,i),[t,w,d,r,i]),E=(0,J.useCallback)(e=>T[e]?.key??e,[T]),D=RW({count:T.length,getScrollElement:()=>e.current,getItemKey:E,estimateSize:e=>T[e]?.kind===`heading`?24:44,measureElement:(e,t,n)=>{let r=AW(e,t,n);return r>0?r:AW(e,void 0,n)||n.options.estimateSize(n.indexFromElement(e))},initialRect:{width:320,height:800},overscan:5,useFlushSync:!1});return(0,X.jsx)(`div`,{className:`inbox-list px-1 py-1`,onPointerEnter:()=>{g(!0)},onPointerLeave:()=>{g(!1)},onFocusCapture:()=>{v(!0)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},children:(0,X.jsx)(`div`,{style:{height:D.getTotalSize(),position:`relative`,width:`100%`},children:D.getVirtualItems().map(e=>{let t=T[e.index],r=t.kind===`session`||t.kind===`unavailable`?t.session:null,i=r?n.get(r.agentId):void 0;return(0,X.jsx)(`div`,{"data-index":e.index,ref:D.measureElement,"data-inbox-shelf":t.kind===`session`?t.shelf:t.kind===`unavailable`?`Unavailable`:void 0,className:t.kind===`heading`?`inbox-shelf`:void 0,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${String(e.start)}px)`,paddingTop:t.kind===`heading`&&t.gap?4:0},children:t.kind===`heading`?(0,X.jsx)(Fx,{style:{paddingBottom:0},children:t.title}):t.kind===`hint`?(0,X.jsx)(`p`,{className:t.loading?`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`:`m-0 px-2 py-3 text-xs text-(--stipe-fg-muted)`,role:t.loading?`status`:void 0,children:t.loading?`Loading conversations…`:`No conversations yet.`}):t.kind===`website`?(0,X.jsx)(J8,{appearance:`plain`,density:`compact`,className:`inbox-row${f?.bindingId===t.website.bindingId&&f.conversation.sessionId===t.website.conversation.sessionId?` is-selected bg-base-300`:``}`,"data-testid":`inbox-website-row`,label:t.website.conversation.label||`Website visitor`,description:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(Uq,{name:`internet`,size:14}),t.website.siteLabel]}),trailing:t.website.conversation.held?(0,X.jsx)(`span`,{className:`text-xs`,children:t.website.conversation.heldByYou?`You're replying`:`With a teammate`}):t.website.conversation.needsYou?(0,X.jsx)(OG,{size:`compact`,tone:`accent`,title:t.website.conversation.needsYou.reason}):null,onClick:()=>{p(t.website)},variant:`ghost`}):t.kind===`unavailable`?i?(0,X.jsx)(Q8,{agent:i,row:t.session}):null:i?(0,X.jsx)(Z8,{agent:i,session:t.session,attention:t.session.unseen,pending:a?.agentId===t.session.agentId&&a.sessionId===t.session.sessionId,selected:o===t.session.agentId&&s===t.session.sessionId,onDelete:l&&i.sessionOperations.includes(`agent.manage`)?()=>{l(t.session.agentId,t.session.sessionId)}:void 0,deleting:u?.agentId===t.session.agentId&&u.sessionId===t.session.sessionId,onSelect:()=>{c(t.session.agentId,t.session.sessionId)}}):null},e.key)})})})}function Z8({agent:e,session:t,attention:n,pending:r,selected:i,onSelect:a,onDelete:o,deleting:s}){let c=AX(t.state),l=t.state===`errored`,u=(0,X.jsxs)(`span`,{className:`inbox-row-activity inline-grid shrink-0 grid-cols-[1rem_7ch] items-center gap-1.5 text-[0.6875rem]`,children:[(0,X.jsxs)(`span`,{className:`inbox-row-status flex items-center justify-center`,children:[r||c||l?(0,X.jsx)(`span`,{className:`sr-only`,children:r?`Opening`:OX[t.state]}):null,r||c?(0,X.jsx)(OG,{size:`compact`,title:r?`Opening`:OX[t.state],motion:t.state===`running`||r?`pulse`:`none`,tone:r?`neutral`:t.state===`needs_you`?`accent`:`info`}):l?(0,X.jsx)(OG,{size:`compact`,title:OX.errored,tone:`error`}):n?(0,X.jsx)(OG,{size:`compact`,title:`Finished since your last visit`,tone:`neutral`}):null]}),(0,X.jsx)(`time`,{className:`inbox-row-age min-w-0 truncate text-right tabular-nums text-(--stipe-fg-muted)`,dateTime:new Date(t.lastActivityAt).toISOString(),children:$8(t.lastActivityAt)})]});return(0,X.jsxs)(`div`,{className:`relative group`,children:[(0,X.jsx)(J8,{"aria-current":i?`page`:void 0,"aria-label":`${t.title||`Untitled session`} — ${HX(e)}${n?` — Finished since your last visit`:``}${t.ready?` — Ready`:c||l?` — ${OX[t.state]}`:``}`,"aria-busy":r||void 0,appearance:`plain`,className:`inbox-row pr-9${i?` is-selected bg-base-300`:``}`,"data-attention":n?`true`:`false`,"data-pending":r?`true`:`false`,"data-session-id":t.sessionId,"data-status":t.state,"data-testid":`inbox-session-row`,density:`compact`,description:HX(e),label:t.title||`Untitled session`,onClick:a,trailing:u,variant:`ghost`}),o?(0,X.jsx)(AG,{"aria-label":`Delete conversation ${t.title||`Untitled session`}`,title:`Delete conversation`,icon:(0,X.jsx)(sW,{}),iconSize:`sm`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 max-[899px]:opacity-100`,disabled:c||s,onClick:o}):null]})}function Q8({agent:e,row:t}){return(0,X.jsxs)(`div`,{className:`inbox-row is-unavailable flex min-h-11 w-full items-center gap-2 rounded-field border-(length:--border) border-transparent px-2 py-1 pr-9 text-left text-base-content`,"data-session-id":t.sessionId,"data-testid":`inbox-unavailable-row`,role:`group`,children:[(0,X.jsxs)(`span`,{className:`inbox-row-copy flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:`Conversation unavailable`}),(0,X.jsxs)(`small`,{className:`truncate text-xs text-(--stipe-fg-muted)`,children:[HX(e),` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` This saved conversation could not be read.`]})]}),(0,X.jsx)(`span`,{className:`inbox-row-activity inline-grid shrink-0 grid-cols-[1rem_7ch] items-center gap-1.5 text-[0.6875rem]`,children:(0,X.jsx)(`span`,{className:`inbox-row-status flex items-center justify-center`,children:(0,X.jsx)(OG,{size:`compact`,tone:`error`,title:`This saved conversation could not be read`})})})]})}function $8(e){let t=Math.max(0,Date.now()-e);return t<6e4?`now`:t<36e5?`${String(Math.floor(t/6e4))}m`:t<864e5?`${String(Math.floor(t/36e5))}h`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var e5=V().min(1).max(256),t5=Pe().int().nonnegative();Xe(`state`,[He({state:Ve(`agent`),version:t5}),He({state:Ve(`requested`),version:t5,reason:V().max(4e3),at:Pe().int().nonnegative()}),He({state:Ve(`person`),version:t5,memberId:e5,memberName:V().min(1).max(128),since:Pe().int().nonnegative()})]);var n5=He({bindingId:e5,agentId:e5,origins:se(V().min(1).max(2048)).min(1).max(16),lifecycle:oe([`active`,`suspended`])}),r5=He({sessionId:e5,label:V().max(4096),lastEventAt:Pe().int().nonnegative(),needsYou:He({at:Pe().int().nonnegative(),reason:V().max(4e3)}).nullable(),held:n(),heldByYou:n(),heldByName:V().min(1).max(128).nullable(),holdVersion:Pe().int().nonnegative()}),i5=He({bindingId:e5}).extend({sessionId:e5});i5.extend({requestId:V().min(1).max(128),text:V().trim().min(1).max(4e3)});var a5=He({expectedVersion:t5,confirm:n()});i5.extend(a5.shape),i5.extend({expectedVersion:t5});var o5=He({websites:se(n5).max(1e3)}),s5=He({conversations:se(r5).max(100)});He({conversation:r5});var c5=He({status:Ve(`sent`)}),l5=Vm(`channels.read`,1,B(()=>Hm({list:Wm(Um(o5)),conversations:Wm(Um(s5))}))),u5=Vm(`channels.personal.manage`,1,B(()=>Hm({hold:Wm(Um(r5)),release:Wm(Um(r5)),dismiss:Wm(Um(r5)),reply:Wm(Um(c5))})));function d5(e,t){let n=!1,r=async()=>{try{return await t.read()}catch(e){if(!(e instanceof kn)||e.boundary!==`runtime`||e.cause!==`unavailable`)throw e;if(await new Promise(e=>setTimeout(e,150)),n)throw Error(`Conversation opening cancelled`,{cause:e});return t.read()}},i,a=new Promise((e,t)=>{i=()=>{t(Error(`Conversation opening cancelled`))}});return{ready:Promise.race([r(),a]).then(r=>{if(n)throw Error(`Conversation opening cancelled`);ZP(e,t,r)}),close:()=>{n=!0,i()}}}function f5(e){return class{#e;constructor(t){this.#e=new jg(t,{fetch:(t,n)=>e(t,n)})}get readyState(){return this.#e.readyState}addEventListener(e,t,n){this.#e.addEventListener(e,t,n)}close(){this.#e.close()}}}function p5(e){let{connection:t,queryClient:n,services:r}=e,i=null,a=null,o=null,s=!1,c=(e,t)=>e?.agentId===t.agentId&&e.sessionId===t.sessionId,l=e=>!s&&i===e,u=(u,d,f=!1)=>{if(s)return;let p={agentId:u,sessionId:d};if(c(i,p)||(i?.close(),i=null,e.onPending(null),e.onError(null),c(a,p)))return;let m=null,h=!1,g={...p,close:()=>{h||(h=!0,m?.())}};i=g,e.onPending(p),(async()=>{try{let s=await r.openAgent(t.capabilities,{agentId:u});if(!l(g)){await s.close();return}let c=r.createClient({baseUrl:s.baseUrl,eventSource:f5(s.fetch),fetch:s.fetch}),f=c.session(d),p=d5(n,f);if(m=()=>{p.close(),Promise.allSettled([c.close(),s.close()])},await p.ready,e.reportsSelection!==!1&&await t.ui.reportAgentSessionSelection({agentId:u,sessionId:d}),!l(g))return;let h={agentId:u,sessionId:d,session:f},_=o;i=null,a=h,o=g.close,e.onConversation(h),e.onPending(null),_?.()}catch(t){console.error(`Chat Session opening failed`,t),g.close(),l(g)&&(i=null,e.onPending(null),e.onError(f?`That Session could not be opened. ${a?`The current conversation remains open.`:`Choose another Session from the list.`}`:`Could not open this Session${t instanceof Error?`: ${t.message}`:``}. ${a?`The previous conversation remains open.`:`Try opening it again.`}`))}})()},d=()=>{if(s)return;let n=i!==null||a!==null;i?.close(),i=null,o?.(),o=null,a=null,e.onPending(null),e.onConversation(null),e.onError(null),!(!n||e.reportsSelection===!1)&&t.ui.reportAgentSessionSelection(null).catch(e=>{console.error(`Chat Session selection could not be reported`,e)})};return{select:u,clear:d,close:()=>{d(),s=!0}}}function m5(e,t){async function n(e){if(e.type!==`prompt`||(e.images?.length??0)>0)throw new Y(`Website conversations support text replies only`,{code:`COMMAND_NOT_DECLARED`,retryable:!1});if(!t.canReply())throw new Y(`Use Take over to reply to this visitor`,{code:`CAPABILITY_DENIED`,retryable:!1});return await t.reply({bindingId:t.bindingId,sessionId:t.sessionId,requestId:e.requestId,text:e.text}),{status:`recorded`}}return{latestPending:()=>Promise.resolve(null),withdraw:t=>e.withdraw(t),address:e.address,read:t=>e.read(t),watch:t=>e.watch(t),extension:()=>({call:()=>Promise.reject(new Y(`Website Session controls are unavailable`,{code:`COMMAND_NOT_DECLARED`,retryable:!1}))}),command:n}}function h5(e,t){(0,J.useSyncExternalStore)(t=>e?.capabilities.subscribe(t)??(()=>void 0),()=>e?.capabilities.version??0);let n=$i(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=e?.capabilities.has(l5)===!0,u=e?.capabilities.has(u5)===!0,d=Oo({...Xy(e,l5,qy.of(e,`websites`),e=>e.list()),enabled:l}),f=l?d.data?.websites??[]:[],p=Eo({queries:f.map(t=>({...Xy(e,l5,qy.of(e,`website-conversations`,t.bindingId),e=>e.conversations({bindingId:t.bindingId})),enabled:l}))}),m=f.flatMap((e,t)=>(p[t]?.data?.conversations??[]).map(t=>({bindingId:e.bindingId,agentId:e.agentId,siteLabel:e.origins.map(e=>new URL(e).host).join(`, `),conversation:t}))).sort((e,t)=>t.conversation.lastEventAt-e.conversation.lastEventAt),h=m.find(e=>e.bindingId===r?.bindingId&&e.conversation.sessionId===r.sessionId),g=(0,J.useMemo)(()=>e===null?null:p5({connection:e,queryClient:n,services:t,onPending:()=>void 0,onConversation:o,onError:c}),[e,n,t]);(0,J.useEffect)(()=>()=>{g?.close()},[g]),(0,J.useEffect)(()=>{l||g?.clear()},[l,g]);let _=jo({mutationFn:t=>{if(e===null)throw Error(`No App connection`);let n=e.capabilities.require(u5);return t.kind===`hold`?n.hold({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm}):n.release({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm})},onSuccess:(t,r)=>{n.setQueryData(qy.of(e,`website-conversations`,r.bindingId),e=>e===void 0?void 0:{conversations:e.conversations.map(e=>e.sessionId===t.sessionId?t:e)})}}),v=h?.bindingId,y=h?.conversation.sessionId,b=h?.conversation.heldByYou===!0,x=(0,J.useMemo)(()=>a===null||v===void 0||y===void 0||e===null?null:m5(a.session,{bindingId:v,sessionId:y,canReply:()=>b&&e.capabilities.has(u5),reply:t=>e.capabilities.require(u5).reply(t)}),[e,a,v,y,b]),S=(0,J.useCallback)(()=>{g?.clear(),i(null),o(null),_.reset()},[g,_.reset]);return{canRead:l,canManage:u,rows:m,selected:h,session:x,action:_,openingError:s,loading:l&&(d.isPending||p.some(e=>e.isPending)),failed:l&&(d.isError||p.some(e=>e.isError)),clear:S,select:e=>{l&&(h?.bindingId!==e.bindingId||h.conversation.sessionId!==e.conversation.sessionId||a===null)&&(i({bindingId:e.bindingId,sessionId:e.conversation.sessionId}),o(null),_.reset(),g?.select(e.agentId,e.conversation.sessionId))}}}function g5({inbox:e}){let{selected:t,session:n,action:r,canManage:i,openingError:a}=e,[o,s]=(0,J.useState)(null);if((0,J.useEffect)(()=>{s(null)},[t?.bindingId,t?.conversation.sessionId,i]),t===void 0)return null;let c=t.conversation;return(0,X.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:c.heldByYou?`You're replying. The Agent is paused.`:c.held?`${c.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),i?(0,X.jsx)(NT,{size:`sm`,disabled:r.isPending,onClick:()=>{let e={bindingId:t.bindingId,sessionId:c.sessionId};c.heldByYou?r.mutate({kind:`release`,...e,expectedVersion:c.holdVersion,confirm:!1}):c.held?s({...e,version:c.holdVersion,name:c.heldByName??`A teammate`}):r.mutate({kind:`hold`,...e,expectedVersion:c.holdVersion,confirm:!1})},children:c.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,X.jsx)(kU,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(PU,{children:[(0,X.jsxs)(IU,{children:[(0,X.jsxs)(LU,{children:[o?.name,` is replying — take over?`]}),(0,X.jsx)(RU,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,X.jsxs)(FU,{children:[(0,X.jsx)(zU,{render:(0,X.jsx)(NT,{variant:`outline`}),children:`Cancel`}),(0,X.jsx)(NT,{disabled:r.isPending||!i,onClick:()=>{o!==null&&(r.mutate({kind:`hold`,bindingId:o.bindingId,sessionId:o.sessionId,expectedVersion:o.version,confirm:!0}),s(null))},children:`Take over`})]})]})}),i?null:(0,X.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:`This conversation changed or website access was removed. Refresh and try again.`}):null,a?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:a}):null,n?(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(uX,{authorOf:At,disambiguateAuthors:!0,session:n,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${t.bindingId}:${c.sessionId}`)}):null]})}var _5=(0,J.lazy)(async()=>({default:(await ir(()=>import(`./parakeet-conversation-gakMmXhW.js`),__vite__mapDeps([12,1,2,3,4,5,13]))).ParakeetConversation})),v5={openAgent:pg,createClient:sn},y5=[`agent.list`,`agent.manage`,`agent.read`,`agent.send`],b5=[`agent.read`,`agent.send`,`agent.manage`],x5=dt({family:`grove-session-create-request`,version:1,kinds:{request:{prefix:`request`}}});async function S5(e,t,n,r){let i=await n.openAgent(e.capabilities,{agentId:t}),a=n.createClient({baseUrl:i.baseUrl,eventSource:f5(i.fetch),fetch:i.fetch});try{return await r(a)}finally{Promise.allSettled([a.close(),i.close()])}}function C5({open:e,renderConversation:t,connection:n,commands:r,composeDraft:i,onPrefilled:a,onForked:o,onOpen:s,label:c=`Conversation`}){let l=e.session;return(0,J.useEffect)(()=>{let e=NL(r,l,{sourceId:`grove-session`,namespace:`session`,sessionResumeAvailable:!1,forkAvailable:!0,onForked:o});return()=>{e.dispose()}},[r,l,o]),(0,X.jsx)(`section`,{className:`inbox-conversation min-h-0 min-w-0 flex-1`,"data-inbox-conversation":!0,"aria-label":c,children:t?t(e,i,s):(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(`p`,{className:`p-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Opening conversation…`}),children:(0,X.jsx)(_5,{session:l,draftIdentity:{agentId:e.agentId,sessionId:e.sessionId},connection:n,commands:r,prefill:i,onPrefilled:a,onOpen:s})})})}function w5(e){return Im(e.connection),(0,X.jsx)(T5,{...e},JSON.stringify(qy.of(e.connection)))}function T5(e){let t=(0,J.useMemo)(x8,[e.connection]);return(0,X.jsx)(_8,{value:(0,X.jsx)(E5,{...e,router:t}),children:(0,X.jsx)(p8,{router:t})})}function E5({router:e,connection:t,services:n=v5}){let{agentFilterId:r,setFilter:i,selection:a,open:o}=S8(e,t?.window.navigation),s=$i(),c=h5(t,n),{directory:l,inbox:u,createAgent:d,renameAgent:f,setAgentAvatar:p}=A8(t),m=l.data??[],h=l.isPending&&(t?.capabilities.has(Zh)??!0),g=l.error?.message??null,_=d.isPending,v=jo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return S5(t,e.agentId,n,t=>t.createSession(e.requestId))}}),y=jo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return S5(t,e.agentId,n,t=>t.deleteSession(e.sessionId))},onSuccess:(t,n)=>{a?.agentId===n.agentId&&a.sessionId===n.sessionId&&(he?.clear(),e.navigate({to:`/`,search:!0,replace:!0})),u.refresh()}}),b=v.isPending?v.variables.agentId:null,[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(!1),D=C?.agentId??null,O=C?.sessionId??null,[k,A]=(0,J.useState)(null),j=(0,J.useRef)(null),[M,N]=W8(),{agentRailOpen:P,listRailOpen:F,listWidth:ee}=M,I=e=>{N(t=>({...t,agentRailOpen:e(t.agentRailOpen)}))},te=e=>{N(t=>({...t,listRailOpen:e(t.listRailOpen)}))},ne=e=>{N(t=>({...t,listWidth:B8(e(t.listWidth))}))},re=P8({begin:()=>!0,move:e=>{ne(t=>t+e)},end:()=>void 0}),[ie,L]=(0,J.useState)(!1),ae=YX(),oe=(0,J.useRef)(null),[R,se]=(0,J.useState)(null),ce=d.error?.message??null,le=d.data,z=(0,J.useRef)(null),[ue,de]=(0,J.useState)(null),[fe,pe]=(0,J.useState)(null),me=Im(t)?.openRequest??null,B=(0,J.useRef)(null),he=(0,J.useMemo)(()=>t===null?null:p5({connection:t,queryClient:s,services:n,onPending:S,onConversation:w,onError:de}),[t,s,n]);(0,J.useEffect)(()=>{if(he!==null)return()=>{z.current=null,he.close()}},[he]);let[ge,_e]=(0,J.useState)(null),ve=(0,J.useMemo)(()=>Jr(),[]),ye=(0,J.useMemo)(()=>t===null?null:p5({connection:t,queryClient:s,services:n,onPending:()=>void 0,onConversation:_e,onError:de,reportsSelection:!1}),[t,s,n]);(0,J.useEffect)(()=>ye===null?void 0:()=>{ye.close()},[ye]);let be=(0,J.useCallback)(e=>{let t=t=>e.params.find(e=>e.key===t)?.value,n=t(`agent`),r=t(`session`);n!==void 0&&r!==void 0&&ye?.select(n,r)},[ye]),xe=(0,J.useRef)(null),Se=(0,J.useCallback)((e,t,n=!1)=>{he!==null&&(v.isError&&v.reset(),c.clear(),E(!1),xe.current={agentId:e,sessionId:t},he.select(e,t,n),o(e,t))},[he,o,c.clear,v.isError,v.reset]),Ce=a?.agentId,we=a?.sessionId;(0,J.useEffect)(()=>{let e=xe.current;xe.current=null,Ce===void 0||we===void 0?he?.clear():(e?.agentId!==Ce||e.sessionId!==we)&&he?.select(Ce,we)},[he,Ce,we]);let Te=(0,J.useCallback)(e=>{C&&(Se(C.agentId,e),u.refresh())},[C,Se,u.refresh]);(0,J.useEffect)(()=>{if(!t||me===null){me===null&&(B.current=null);return}if(me.kind!==`navigate`||B.current===me.requestId)return;let e=me.params.find(e=>e.key===`agent`)?.value,n=me.params.find(e=>e.key===`session`)?.value;!e||!n||(B.current=me.requestId,i(e),Se(e,n,!0))},[t,me,Se,i]);let Ee=(0,J.useCallback)(async e=>{if(!t||_||!t.capabilities.has(Qh))return!1;try{let t=await d.mutateAsync(e);return i(t.agentId),se(t.agentId),A(null),!0}catch{return!1}},[t,_,d.mutateAsync,i]),De=(0,J.useCallback)(async e=>{if(!t||b!==null)return`Conversation creation is unavailable.`;de(null);let n=z.current?.agentId===e?z.current:{agentId:e,requestId:x5.request.generate()};z.current=n;try{let t=await v.mutateAsync(n);Se(e,t),u.refresh(),A(null),L(!1),z.current===n&&(z.current=null);return}catch(e){return console.error(`Grove conversation creation failed`,e),e instanceof Error?e.message:`Couldn't start the conversation.`}},[t,Se,b,v.mutateAsync,u.refresh]);(0,J.useEffect)(()=>{if(!(!t||me?.kind!==`compose`)&&B.current!==me.requestId&&!(!C&&h)&&(B.current=me.requestId,pe({requestId:me.requestId,text:me.text}),!C)){let e=t.capabilities.has(lg)?m.find(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)):void 0;e?De(e.agentId):A(`agent`)}},[m,t,h,C,me,De]);let Oe=k8({setDraft:e=>x!==null||!C||!t?.capabilities.has(lg)||!m.some(e=>e.agentId===C.agentId&&e.sessionOperations.includes(`agent.send`))?!1:(pe({requestId:ih(),text:e}),!0),newConversation:()=>{C&&De(C.agentId)},openPermissions:()=>{t?.ui.requestAppPermissions({}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})}},t?.commands),ke=new Set(c.rows.map(e=>`${e.agentId}:${e.conversation.sessionId}`)),Ae=u.items.filter(e=>!(`kind`in e)).filter(e=>!ke.has(`${e.agentId}:${e.sessionId}`)),je=Eo({queries:(C?[C.session]:[]).map(e=>({...XP(e),enabled:!1}))}).at(0)?.data?.snapshot,Me=(0,J.useMemo)(()=>C&&je?{agentId:C.agentId,sessionId:C.sessionId,state:sM(je)}:void 0,[C,je]),Ne=(0,J.useMemo)(()=>zX(m,T&&c.canRead?[]:Ae,r,Me),[r,m,Ae,T,c.canRead,Me]),Pe=(0,J.useMemo)(()=>{let e=new Map;for(let t of Ae)`state`in t&&(t.state===`needs_you`?e.set(t.agentId,`speaking`):t.state===`running`&&!e.has(t.agentId)&&e.set(t.agentId,`thinking`));return e},[Ae]),Fe=(0,J.useMemo)(()=>new Map(m.map(e=>[e.agentId,e])),[m]),Ie=(0,J.useRef)(null),V=Ae.find(e=>e.agentId===D&&e.sessionId===O),Le=V!==void 0&&V.state!==`unavailable`,Re=V!==void 0&&V.state!==`unavailable`?V.settledAt:void 0;(0,J.useEffect)(()=>{!Le||D===null||O===null||u.visit(D,O).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},[Le,Re,D,O,u.visit]);let ze=u.status===`loading`,Be=u.status===`error`,Ve=t?.capabilities.has(Qh)??!1,He=t?.capabilities.has(lg)??!1,Ue=m.filter(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)),We=Ue.find(e=>e.agentId===(R??r))??Ue.at(0),Ge=He&&We!==void 0,Ke=()=>{t?.ui.requestAppPermissions({agents:y5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},qe=le&&(!le.sessionOperations.includes(`agent.read`)||!le.sessionOperations.includes(`agent.send`)||!le.sessionOperations.includes(`agent.manage`))?`Agent created. Allow Grove to read, send messages and manage its sessions to start a conversation.`:fe&&!C&&!Ge&&d.isIdle?`Choose an Agent to compose your game idea.`:null,Je=(0,J.useMemo)(()=>zX(m,Ae,null,Me),[m,Ae,Me]),Ye=(e,t)=>{L(!1),Se(e,t)},Xe=()=>{oe.current=document.activeElement instanceof HTMLElement?document.activeElement:null,L(!0)};Lm(t,[...ae?[{kind:`button`,id:`agents`,text:`Agents`,expanded:P,title:P?`Hide Agents`:`Show Agents`},{kind:`button`,id:`conversations`,text:`Conversations`,expanded:F,title:F?`Hide conversations`:`Show conversations`}]:[{kind:`button`,id:`agents`,text:`Agents and conversations`,opens:`dialog`,expanded:ie}],...ge===null?[]:[{kind:`button`,id:`close-beside`,text:`Close beside`,title:`Close beside conversation`}]],e=>{if(k!==null)return!1;if(e.itemId===`close-beside`&&ge!==null)ye?.clear();else if(ae&&e.itemId===`agents`)I(e=>!e);else if(ae&&e.itemId===`conversations`)te(e=>!e);else if(!ae&&e.itemId===`agents`)ie?L(!1):Xe();else return!1;return!0});let Ze=e=>{i(e),se(e);let t=[...Je.active,...Je.settled].filter(t=>t.agentId===e).sort((e,t)=>t.lastActivityAt-e.lastActivityAt).at(0);t&&Ye(e,t.sessionId)},Qe={"--grove-list-width":`${String(ee)}px`},$e=C?Fe.get(C.agentId):void 0,et=r===null?void 0:Fe.get(r),tt=t?.capabilities.has(eg)??!1,nt=t?.capabilities.has(rg)??!1,rt=j8(t,et?.agentId??null),it=Ne.active.length+Ne.settled.length,at=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await f.mutateAsync({agentId:e,name:n}),!0}catch{return!1}},[t,f.mutateAsync]),ot=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await p.mutateAsync({agentId:e,avatar:n}),!0}catch{return!1}},[t,p.mutateAsync]),st=(0,J.useCallback)(()=>{let e=rt.status.data;!et||e==null||rt.approve.mutate({agentId:et.agentId,expectedRevision:e.revision})},[et,rt.status.data,rt.approve]),ct=(0,J.useCallback)(e=>{!t||_||b!==null||e===`agent`&&!Ve||(k===null&&(j.current=ie?oe.current:document.activeElement instanceof HTMLElement?document.activeElement:null),L(!1),e===`session`&&se($e?.agentId??r??Ue.at(0)?.agentId??null),A(e))},[t,_,b,Ve,k,ie,$e?.agentId,r,Ue]);(0,J.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||!e.ctrlKey||e.altKey||e.metaKey||e.key.toLowerCase()!==`n`||!t||e.shiftKey&&!Ve||(e.preventDefault(),ct(e.shiftKey?`agent`:`session`))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[t,Ve,ct]);let lt=v.isError?v.variables:null,H=lt&&k!==`session`?(0,X.jsx)(Mx,{className:C||c.selected?`inbox-error m-2`:`inbox-empty m-auto max-w-[28rem]`,tone:`error`,title:`Couldn't start the conversation.`,description:v.error?.message,action:(0,X.jsx)(NT,{variant:`outline`,onClick:()=>void De(lt.agentId),children:`Retry`})}):null;return(0,X.jsxs)(`main`,{className:`inbox-app grove-shell relative flex h-dvh min-h-0 bg-base-200 font-sans text-base-content`,"data-inbox-app":!0,"data-conversation":!!C||c.selected!==void 0,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P0,{open:k===`agent`,pending:_,error:ce,canChooseComputer:t.capabilities.has(QX),create:Ee,onClose:()=>{A(null)},returnFocus:j}),k===`session`?(0,X.jsx)(F0,{open:!0,agents:He?Ue:[],defaultAgentId:We?.agentId??null,start:De,pending:b!==null,onClose:()=>{A(null)},onNewAgent:Ve?()=>{A(`agent`)}:void 0,returnFocus:j}):null]}):null,(0,X.jsxs)(XX,{open:ie,onOpenChange:L,returnFocus:oe,children:[(0,X.jsx)(WX,{open:P,agents:m,agentActivity:Pe,agentFilterId:r,websitesSelected:T,websitesVisible:c.canRead,canCreate:t!==null&&Ve,createOpen:k===`agent`,onAll:()=>{i(null),E(!1)},onWebsites:()=>{i(null),E(!0)},onAgent:e=>{E(!1),Ze(e)},onCreate:()=>{ct(`agent`)}}),(0,X.jsxs)(`aside`,{id:`grove-list-rail`,className:`inbox-sidebar group relative min-h-0 min-w-0 flex-1 flex-col border-r border-base-300 min-[900px]:w-[var(--grove-list-width)] min-[900px]:flex-none ${F?`flex`:`flex min-[900px]:hidden`}`,style:Qe,"aria-label":`Conversations`,children:[ae?(0,X.jsx)(N8,{"aria-label":`Conversation list width`,"aria-controls":`grove-list-rail`,className:`absolute right-0 top-1/2 z-10 translate-x-1/2 -translate-y-1/2`,orientation:`vertical`,value:ee,min:I8.min,max:I8.max,onValueChange:e=>{ne(()=>e)},onDoubleClick:()=>{ne(()=>I8.initial)},...re}):null,(0,X.jsxs)(`header`,{className:`inbox-header flex h-10 flex-none items-center gap-1 border-b border-base-300 pl-3 pr-1`,children:[et?(0,X.jsx)(M8,{agentId:et.agentId,name:HX(et),avatar:et.avatar,...nt?{setAvatar:ot}:{}},et.agentId):null,(0,X.jsx)(Fx,{className:`min-w-0 flex-1 truncate`,children:T&&c.canRead?`Websites`:et?HX(et):`All Agents`}),et&&tt?(0,X.jsx)(w8,{agentId:et.agentId,name:et.name,rename:at},et.agentId):null,t&&(Ge||Ve)?(0,X.jsx)(AG,{"aria-label":`New conversation`,"aria-haspopup":`dialog`,icon:(0,X.jsx)(aW,{}),iconSize:`sm`,size:`sm`,onClick:()=>{ct(`session`)}}):null]}),et&&rt.canRead?(0,X.jsx)(T8,{status:rt.status.data,approving:rt.approve.isPending,onApprove:st}):null,qe?(0,X.jsx)(Mx,{tone:`info`,title:qe,action:(0,X.jsx)(NT,{variant:`ghost`,onClick:()=>{t?.ui.requestAppPermissions({agents:b5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},children:`Allow conversation access`})}):null,t&&m.length>0&&!Ge&&!Ve?(0,X.jsxs)(`section`,{className:`inbox-create inbox-access flex flex-col items-start gap-3 border-b border-base-300 py-2`,"aria-labelledby":`inbox-agent-access-title`,children:[(0,X.jsx)(zx,{level:2,id:`inbox-agent-access-title`,className:`inbox-access-title m-0`,children:`Let Grove manage your Agents`}),(0,X.jsx)(`p`,{children:`Grove creates Agents and carries their conversations. Your Team decides what it may do.`}),(0,X.jsx)(NT,{size:`sm`,onClick:Ke,children:`Allow Agent access`})]}):null,y.error?(0,X.jsx)(Mx,{tone:`error`,title:y.error.message}):null,g?(0,X.jsx)(Mx,{className:`inbox-error`,tone:`error`,title:g,action:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{l.refetch()},children:`Try again`})}):null,Be?(0,X.jsx)(Mx,{className:`inbox-error`,tone:`error`,title:`Conversations are unavailable.`,action:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{u.refresh()},children:`Retry conversations`})}):null,(0,X.jsx)(bA,{ref:Ie,className:`inbox-surface min-h-0 flex-1`,"aria-label":`Conversations`,children:t?h?(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Loading Agents…`}):(0,X.jsx)(X8,{viewport:Ie,view:Ne,agents:Fe,loading:ze||c.loading,failed:!!g||Be||c.failed,pendingSelection:x,selectedAgentId:D,selectedSessionId:O,onSelect:Ye,onDelete:He?(e,t)=>{y.mutate({agentId:e,sessionId:t})}:void 0,deleting:y.isPending?y.variables:null,websites:c.rows.filter(e=>r===null||e.agentId===r),selectedWebsite:c.selected,onSelectWebsite:e=>{he?.clear(),L(!1),c.select(e)}}):(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,children:`Connect to the host to browse Agents.`})},r)]})]}),(0,X.jsxs)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Conversation`,children:[(0,X.jsx)(GX,{app:t}),ue?(0,X.jsx)(Mx,{className:`inbox-error m-2`,tone:`error`,title:ue}):null,C||c.selected?H:null,c.selected?(0,X.jsx)(g5,{inbox:c}):C?(0,X.jsx)(C5,{open:C,connection:t,commands:Oe,renderConversation:n.renderConversation,composeDraft:fe,onPrefilled:()=>{pe(null)},onForked:Te,onOpen:be}):!t||h?null:m.length===0&&!g?(0,X.jsx)(q8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`speech`,thinking:_,renderVisual:({speaking:e,thinking:t})=>(0,X.jsx)(DX,{className:`h-full w-full`,state:{activity:t?`thinking`:e?`speaking`:`idle`,expression:`normal`}}),title:Ve?`No one's here yet.`:`Welcome to Grove`,description:Ve?`Agents chat, write and make little games with you. Name someone?`:`Let Grove find your Agents, create new ones, and open conversations. Your Team controls this access.`,actions:Ve?(0,X.jsx)(NT,{onClick:()=>{ct(`agent`)},children:`Name your first Agent`}):(0,X.jsx)(NT,{onClick:Ke,children:`Allow Agent access`})}):H??(0,X.jsx)(q8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`panel`,title:it>0?`Pick up a conversation`:We?`Say hello to ${HX(We)}`:`No conversations yet`,description:it>0?`Choose one from the list, or ask for something new. A tiny game is a good start.`:`Ask for anything. Try: “Make me a tiny game where a mushroom catches raindrops.”`,actions:(0,X.jsxs)(X.Fragment,{children:[ae||it===0?null:(0,X.jsx)(NT,{variant:`outline`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":ie,onClick:Xe,children:`Agents and conversations`}),Ge?(0,X.jsx)(NT,{variant:`outline`,loading:b===We.agentId,disabled:b!==null,onClick:()=>void De(We.agentId),children:it>0?`Ask ${HX(We)} something`:`Start a conversation`}):null]})})]}),ge===null?null:(0,X.jsx)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col border-l border-base-300`,"aria-label":`Beside conversation`,"data-inbox-beside":!0,children:(0,X.jsx)(C5,{open:ge,connection:t,commands:ve,renderConversation:n.renderConversation,composeDraft:null,onPrefilled:()=>void 0,onForked:e=>{ye?.select(ge.agentId,e)},onOpen:be,label:`Beside conversation`})})]})}var D5=document.getElementById(`inbox-root`);if(!D5)throw Error(`Inbox root is missing`);Nm(D5,{name:`Grove`,queryClient:Yy()},({app:e})=>(0,J.createElement)(w5,{connection:e}));export{$S as $,NT as A,YC as B,GF as C,lj as D,BM as E,Pw as F,uC as G,NC as H,Ow as I,sC as J,oC as K,dw as L,Zw as M,Iw as N,$A as O,Nw as P,nC as Q,cw as R,UF as S,WF as T,LC as U,zC as V,cC as W,IC as X,lC as Y,PC as Z,XU as _,Oo as _t,jK as a,Lx as at,GI as b,dr as bt,nG as c,Rx as ct,ZW as d,qy as dt,TS as et,XW as f,Um as ft,KW as g,Vm as gt,qW as h,Gm as ht,HY as i,vS as it,dT as j,qA as k,eG as l,zx as lt,GW as m,Wm as mt,m0 as n,YS as nt,AK as o,Bx as ot,JW as p,Hm as pt,aC as q,rX as r,wS as rt,qG as s,Vx as st,_0 as t,jS as tt,$W as u,Q as ut,qU as v,Zi as vt,ZF as w,$F as x,tL as y,gr as yt,tw as z};
174
+ `),header:e.label,...e.language===void 0?{}:{language:e.language}}),(0,X.jsx)(JY,{hidden:i,onShowAll:n})]})}}}function ZY({call:e,tool:t,disclosure:n,onToggle:r,mediaClaimed:i}){let a=`${e.id}:full`,o=OP(n,a,!1),s=()=>{r(a,!1)};return(0,X.jsxs)(`div`,{className:`space-y-1.5 py-1.5 pr-2`,"data-parakeet-call-body":!0,children:[e.error===void 0?null:(0,X.jsx)(`p`,{className:`not-prose m-0 font-mono text-[11px] text-error`,role:`alert`,children:e.error}),e.sections.map((e,t)=>(0,X.jsx)(XY,{full:o,onShowAll:s,section:e},`${e.kind}:${String(t)}`)),(i?[]:t?.result?.content??[]).filter(e=>e.type===`image`).map((t,n)=>(0,X.jsx)(`img`,{alt:`Tool result`,className:`max-w-full`,src:`data:${t.mimeType};base64,${t.data}`,style:{maxHeight:400}},`${e.id}-image-${String(n)}`))]})}function QY({call:e,tool:t,disclosureId:n,size:r,disclosure:i,onToggle:a,renderToolActions:o,claimsToolMedia:s}){let c=DP(e),l=OP(i,n,c),u=e.status===`running`;return(0,X.jsxs)(`div`,{"data-parakeet-call":e.kind,"data-status":e.status,children:[(0,X.jsx)(kK,{leading:(0,X.jsx)(Uq,{name:wN[e.kind],size:16}),onOpenChange:()=>{a(n,c)},open:l,size:r,summary:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:u?e.activeVerb:e.verb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:e.label})]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.exitCode===void 0?null:(0,X.jsxs)(HY,{size:`sm`,tone:`error`,children:[`exit `,String(e.exitCode)]}),e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:gP(e.durationMs)}),(0,X.jsx)(OG,{motion:u?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:CN(e.status)})]}),children:(0,X.jsx)(ZY,{call:e,disclosure:i,onToggle:a,mediaClaimed:t!==void 0&&s?.(t)===!0,tool:t})}),e.live===void 0?null:(0,X.jsx)(`pre`,{className:YY,"aria-label":`Live tool output`,children:EN(e,l).map((e,t)=>(0,X.jsx)(`span`,{className:`block whitespace-pre`,children:e||`\xA0`},String(t)))}),e.status===`completed`&&t?.result!==void 0?o?.(t):null]})}var $Y=(0,J.memo)(function({group:e,disclosure:t,onToggle:n,renderToolActions:r,claimsToolMedia:i}){let a=TP(e),o=OP(t,e.id,a),s=e.status===`running`,c=e.active,l=e.calls.length===1?e.calls[0]:void 0;return l===void 0?(0,X.jsxs)(`div`,{className:`px-1`,children:[(0,X.jsx)(kK,{className:`[&>.caps-disclosure-panel]:hidden`,leading:(0,X.jsx)(Uq,{name:`list`,size:16}),onOpenChange:()=>{n(e.id,a)},open:o,summary:s&&c!==void 0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:c.activeVerb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:c.label}),` ·`,` `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}):(0,X.jsxs)(`span`,{className:`text-base-content`,children:[e.summary,` · `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.failedCount>0?(0,X.jsxs)(`span`,{className:`text-error`,children:[String(e.failedCount),` failed`]}):null,e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:gP(e.durationMs)}),(0,X.jsx)(OG,{motion:s?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:CN(e.status)})]})}),EP(e,o).map(a=>(0,X.jsx)(QY,{call:a,disclosure:t,disclosureId:a.id,onToggle:n,renderToolActions:r,claimsToolMedia:i,size:`row`,tool:e.tools.find(e=>e.id===a.id)},a.id)),e.status===`completed`&&e.calls.length>3?(0,X.jsx)(`button`,{"aria-expanded":o,className:`btn btn-ghost btn-xs text-dim`,onClick:()=>{n(e.id,a)},type:`button`,children:o?`Show less`:`Show all ${String(e.calls.length)} calls`}):null]}):(0,X.jsx)(`div`,{className:`px-1`,children:(0,X.jsx)(QY,{call:l,disclosure:t,disclosureId:l.id,onToggle:n,renderToolActions:r,claimsToolMedia:i,size:`row`,tool:e.tools[0]})})}),eX=()=>void 0,tX={nothing_to_compact:`nothing to compact`,failed:`compaction failed`,stale:`compaction skipped: the context moved on`,insufficient:`compaction skipped: the summary would not fit`},nX=(0,J.memo)(function({item:e,onDismissFailed:t,onCancelQueued:n,cancellingQueued:r=!1,renderToolActions:i,claimsToolMedia:a,renderAssistantAttachment:o,formatAssistantText:s,toolDisclosure:c=wP,onToggleTool:l=eX}){switch(e.kind){case`user_message`:{let i=e.status===`pending`||e.status===`queued`,a=e.requestId,o=e.commandId,s=e.status===`queued`&&o!==void 0&&n!==void 0?(0,X.jsx)(`div`,{className:`flex justify-end px-3`,children:(0,X.jsx)(NT,{"aria-label":`Cancel queued message`,disabled:r,size:`sm`,variant:`ghost`,onClick:()=>{n(o)},children:`Cancel`})}):null,u=a===void 0||t===void 0?null:(0,X.jsx)(NT,{"aria-label":`Dismiss failed prompt`,variant:`outline`,size:`xs`,onClick:()=>{t(a)},type:`button`,children:`Dismiss`}),d=e.status===`failed`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs text-error`,role:`alert`,children:[(0,X.jsx)(`span`,{children:e.author?.kind===`agent`?`That Agent message didn’t make it through.`:`Your prompt didn’t make it through.`}),u]}):null;if(e.author?.kind===`agent`){let t=OP(c,e.id,!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:e.status===`confirmed`?`px-3 text-xs`:`px-3 text-xs opacity-60`,"data-agent-message":e.author.id,"data-author":e.author.id,children:[(0,X.jsx)(zY,{pending:i}),(0,X.jsxs)(`button`,{"aria-expanded":t,className:`text-dim flex w-full min-w-0 items-center gap-sm text-left`,onClick:()=>{l(e.id,!1)},type:`button`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0`,children:(0,X.jsx)(Uq,{name:`agent`,size:16})}),(0,X.jsx)(`span`,{className:`shrink-0`,children:e.author.name}),t?null:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.text]})]}),t?(0,X.jsx)(`div`,{className:`whitespace-pre-wrap break-words pl-3`,children:e.text}):null]}),d,s]})}return(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BY,{pending:i,speaker:`user`,children:e.text}),d,s]})}case`assistant_message`:return TM(e)?(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BY,{isError:e.isError===!0,pending:e.pending,speaker:`agent`,...e.thinking?{thinking:e.thinking}:{},children:s?.(e.text)??e.text}),e.isError&&e.repeatCount!==void 0?(0,X.jsxs)(`span`,{className:`px-3 text-error`,children:[`x`,e.repeatCount]}):null,e.isError&&e.errorDetail?(0,X.jsx)(`p`,{className:`px-3 text-dim`,children:e.errorDetail}):null,e.isError&&e.providerError!==void 0?(0,X.jsx)(`div`,{className:`px-3 text-error`,"data-provider-error":e.id,children:(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{children:`Provider details (latest response)`}),(0,X.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:e.providerError})]})}):null,!e.pending&&!e.isError?o?.(e.text):null]}):null;case`tool_group`:return(0,X.jsx)($Y,{disclosure:c,group:e,onToggle:l,renderToolActions:i,claimsToolMedia:a});case`compaction_divider`:return(0,X.jsx)(`div`,{className:`divider text-dim my-2 text-xs`,role:`separator`,children:e.tokensAfter===null?`compacted · the agent’s memory starts below`:`compacted ${EA(e.tokensBefore)} → ${EA(e.tokensAfter)}`});case`compaction_notice`:return(0,X.jsxs)(`div`,{className:`px-3 text-xs ${e.result===`failed`?`text-error`:`text-dim`}`,role:`status`,children:[`· `,tX[e.result],e.diagnostic===null?``:`: ${e.diagnostic}`]})}});function rX({disambiguateAuthors:e,visitor:t,composerActionVariant:n,empty:r,commands:i,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c,onLink:l,onOpen:u}){let d=(0,J.useRef)(null),[f]=(0,J.useState)(()=>Jr()),p=tR({enabled:t===void 0,commands:i??f,origin:`browser`,keys:{newline:`Shift+Enter`},busy:aX()}),m=ZR(i??f),h=XF(),{draft:g}=GF(),_=WL(p.awaiting,g)?.key,v=WF(),y=(0,J.useMemo)(()=>tz(h,v.commandAnchors,v.positionAnchors),[h,v.commandAnchors,v.positionAnchors]);return(0,X.jsxs)(`div`,{className:`parakeet flex h-full flex-col items-stretch`,"data-parakeet":`standalone`,"data-testid":`parakeet-view`,onClickCapture:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null;t instanceof HTMLAnchorElement&&l?.(t.href)&&e.preventDefault()},children:[(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col border-r border-base-300`,children:[(0,X.jsx)(sX,{disambiguateAuthors:t===void 0&&e===!0,clientActions:m,onOpen:u,focusAfterJump:d,empty:r,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c}),h.some(({entryId:e,value:t})=>t.panel.some(t=>JSON.stringify([e,t.id])!==_))?(0,X.jsx)(`section`,{"aria-label":`Session extension controls`,className:`w-full shrink-0 border-t border-base-300 bg-base-100`,children:h.map(({entryId:e,value:t})=>{let n={...t,panel:t.panel.filter(t=>JSON.stringify([e,t.id])!==_)},r=n.panel.length===0?void 0:y.omitted.find(t=>t.entryId===e),i=n.panel.length===0?[]:y.unanchored.filter(t=>t.entryId===e).flatMap(({cell:e})=>e.rows.map(t=>({...t,id:`unanchored:${e.id}:${t.id}`})));return(0,X.jsx)(hq,{entryId:e,rows:[...n.panel,...r===void 0?[]:[{id:`omitted:${e}`,title:`${String(r.count)} earlier change${r.count===1?``:`s`} omitted`,tone:`muted`}],...i],actions:m,onOpen:u},e)})}):null,(0,X.jsx)(cX,{clientActions:m}),(0,X.jsx)(lX,{visitor:t,textareaRef:d,composerActionVariant:n,slash:p})]}),t===void 0?(0,X.jsx)(oX,{slash:p}):null]})}var iX=new Set([`cancelling`,`queued`,`retrying`,`sending`,`streaming`,`thinking`]);function aX(){return iX.has(YF().status)}function oX({slash:e}){let t=e.interactions.open;return(0,X.jsx)(kU,{open:t!==void 0,onOpenChange:t=>{t||e.store.close()},children:(0,X.jsx)(PU,{className:`w-[min(32rem,calc(100vw-2rem))] rounded-box bg-base-100 p-md shadow-lg`,keepMounted:!1,children:t===void 0?null:(0,X.jsx)(XK,{host:t.host,onClose:e.store.close},t.key)})})}function sX({disambiguateAuthors:e,clientActions:t,onOpen:n,focusAfterJump:r,empty:i,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c}){let l=KF(),u=WF(),d=(0,J.useCallback)(e=>{u.cancelQueued(e)},[u.cancelQueued]),f=(0,J.useMemo)(()=>NA(e?[...u.settled,...u.tail].flatMap(e=>`author`in e&&e.author?[e.author]:[]):[]),[e,u.settled,u.tail]),p=tz(XF(),u.commandAnchors,u.positionAnchors),m=p.before.map(({entryId:e,cell:r})=>(0,X.jsx)(hq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`)),[h,g]=(0,J.useState)(wP),_=(0,J.useCallback)((e,t)=>{g(n=>kP(n,e,t))},[]),v=YF(),y=(0,J.useRef)(null),b=(0,J.useRef)(void 0),x=u.settled.length+u.tail.length,S=(0,J.useCallback)(e=>e<u.settled.length?u.settled[e]:u.tail[e-u.settled.length],[u.settled,u.tail]),C=RW({anchorTo:`end`,count:x,estimateSize:()=>72,followOnAppend:`auto`,getItemKey:VW(u.settled,u.tail),getScrollElement:()=>y.current,initialRect:{height:800,width:800},overscan:6,useFlushSync:!1}),w=C.getVirtualItems(),T=C.isAtEnd(),[E,D]=(0,J.useState)(0),O=x>0?S(x-1)?.id:void 0,k=(0,J.useRef)({count:x,lastItem:O});(0,J.useEffect)(()=>{let e=k.current;k.current={count:x,lastItem:O},T?D(0):e.lastItem!==void 0&&O!==e.lastItem&&D(t=>t+Math.max(1,x-e.count))},[T,x,O]);let A=(w[0]?.index??1/0)<3,{hasMoreHistory:j,hasNewerHistory:M,loadingOlderHistory:N,loadOlderHistory:P,loadNewerHistory:F}=u,ee=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(!A){ee.current=!1;return}j&&!N&&!ee.current&&(ee.current=!0,P())},[j,P,N,A]);let I=(0,J.useCallback)(()=>{D(0),b.current=void 0,u.jumpToLatest(),C.scrollToEnd({behavior:`smooth`})},[C,u]);return(0,X.jsxs)(`div`,{className:`prose relative min-h-0 flex-1`,children:[(0,X.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:cq(v.status,v.viewState)}),v.observation.status===`unavailable`?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-1 text-xs text-dim`,role:`status`,children:[(0,X.jsx)(`span`,{children:v.observation.reason}),(0,X.jsx)(NT,{variant:`outline`,size:`xs`,onClick:()=>void v.reconnect(),type:`button`,children:`Reconnect`})]}):null,(0,X.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,"data-chat-scroller":!0,ref:y,onScroll:e=>{let t=e.currentTarget.scrollTop;b.current!==void 0&&t<b.current&&u.pinVisibleHistory(),b.current=t},onWheel:e=>{let t=y.current;t===null||N||(e.deltaY<0&&u.pinVisibleHistory(),e.deltaY<0&&t.scrollTop<=1&&j&&P(),e.deltaY>0&&t.scrollTop+t.clientHeight>=t.scrollHeight-1&&M&&F())},style:{overscrollBehavior:`contain`},children:x>0?(0,X.jsx)(`div`,{className:`relative w-full`,style:{height:`${String(C.getTotalSize())}px`},children:w.map(e=>{let r=S(e.index);return r===void 0?null:(0,X.jsxs)(`div`,{"data-index":e.index,"data-parakeet-entry":r.kind===`user_message`?`user`:r.kind,"data-parakeet-id":r.id,"data-status":r.kind===`assistant_message`?r.isError?`error`:void 0:r.kind===`compaction_divider`||r.kind===`compaction_notice`?void 0:r.status,"data-tone":r.kind===`assistant_message`&&r.isError?`error`:void 0,ref:C.measureElement,style:{left:0,position:`absolute`,top:0,transform:`translateY(${String(e.start)}px)`,width:`100%`},children:[e.index===0?m:null,(0,X.jsx)(nX,{item:`author`in r&&r.author&&f.has(r.author.id)?{...r,author:{...r.author,name:f.get(r.author.id)??r.author.name}}:r,onDismissFailed:l,onCancelQueued:d,cancellingQueued:u.cancellingQueued,onToggleTool:_,renderToolActions:a,claimsToolMedia:o,renderAssistantAttachment:s,formatAssistantText:c,toolDisclosure:h}),p.after.get(r.id)?.map(({entryId:e,cell:r})=>(0,X.jsx)(hq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`))]},e.key)})}):m.length>0?m:j?null:i??(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center text-center`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1 text-xs text-base-content`,children:`Ready`}),(0,X.jsx)(`p`,{className:`text-[10px] text-dim`,children:`What would you like to build?`})]})})}),x>0?(0,X.jsx)(mW,{direction:`forward`,unread:E,focusAfterJump:r,onJump:I,scrollerRef:y}):null]})}function cX({clientActions:e}){let{viewState:t}=YF(),n=XF(),r=t.kind===`idle`?n.find(({value:e})=>e.waiting!==null):void 0;return(0,X.jsx)(X.Fragment,{children:r?.value.waiting===void 0||r.value.waiting===null?null:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs`,children:[(0,X.jsx)(`span`,{children:r.value.waiting.summary}),(0,X.jsx)(NT,{size:`xs`,variant:`outline`,disabled:!e.enabled||e.state.get(r.value.waiting.cancel)?.pending===!0,onClick:()=>{r.value.waiting!==null&&e.execute(r.entryId,r.value.waiting.cancel,!0)},children:r.value.waiting.cancel.label})]})})}function lX({visitor:e,textareaRef:t,composerActionVariant:n,slash:r}){let i=GF(),a=YF(),o=XF(),s=WF();(0,J.useEffect)(()=>{i.failure!==void 0&&t.current?.focus()},[i.failure,t]);let c=(0,J.useCallback)(()=>{i.cancel()},[i.cancel]),l={queuedRecall:e===void 0?i:void 0,onImagesChange:e===void 0?i.setImages:void 0,statusChips:o.flatMap(({value:e})=>e.chips).sort((e,t)=>e.order-t.order).map(({row:e})=>e.title),actionVariant:n,draft:i.draft,failure:i.failure,failureCause:a.viewState.kind===`error`?a.viewState.cause:void 0,admissionError:i.admissionError,onAbort:c,onChange:i.setDraft,onRetry:i.retry,onSend:r.submit,slash:e===void 0?r:void 0,placeholder:e===void 0?void 0:`Ask ${e.agentName}…`,showFooter:e===void 0,status:a.status,viewState:a.viewState,textareaRef:t,model:s.model,usage:s.usage,context:a.context};return(0,X.jsx)(pq,{...l})}function uX({authorOf:e,disambiguateAuthors:t,visitor:n,markdownPolicy:r=`session`,composerActionVariant:i,empty:a,session:o,clients:s,renderToolActions:c,claimsToolMedia:l,renderAssistantAttachment:u,formatAssistantText:d,commands:f,onLink:p,onOpen:m}){return(0,X.jsx)(FY.Provider,{value:r,children:(0,X.jsx)(UF,{session:o,clients:s,authorOf:e,children:(0,X.jsx)(rX,{disambiguateAuthors:t,visitor:n,composerActionVariant:i,empty:a,renderToolActions:c,claimsToolMedia:l,renderAssistantAttachment:u,formatAssistantText:d,commands:f,onLink:p,onOpen:m})})})}function dX(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}var fX=[`primary`,`secondary`,`accent`,`info`,`success`,`warning`];function pX(e){return fX[dX(e)%fX.length]??`primary`}var mX=(0,J.forwardRef)(function({className:e,name:t,seed:n,size:r=`default`,subject:i=`actor`,variant:a=`initial`,...o},s){let c=Array.from(t.trim())[0]?.toLocaleUpperCase()??`?`;return(0,X.jsx)(`span`,{"aria-hidden":`true`,...o,className:Q(`caps-monogram`,e),"data-subject":i===`actor`?void 0:i,"data-size":r==="default"?void 0:r,"data-tone":pX(n??t),ref:s,children:a===`specimen`?(0,X.jsx)(`svg`,{viewBox:`0 0 48 48`,width:`80%`,height:`80%`,fill:`none`,"aria-hidden":`true`,children:(0,X.jsxs)(`g`,{transform:`rotate(${String((n??t).split(``).reduce((e,t)=>e+(t.codePointAt(0)??0),0)%360)} 24 24)`,stroke:`currentColor`,strokeWidth:`1.5`,children:[Array.from({length:20},(e,t)=>(0,X.jsx)(`path`,{d:`M24 19 Q19 12 24 5`,transform:`rotate(${String(t*18)} 24 24)`},t)),(0,X.jsx)(`circle`,{cx:`24`,cy:`24`,r:`5`})]})}):c})}),hX=(0,J.createContext)(null),gX=(0,J.createContext)(void 0);function _X(e){let t=(0,J.useContext)(gX);return e??t}var vX=(0,J.forwardRef)(function({service:e,src:t,activity:n,expression:r,appearance:i,renderStyle:a,performance:o,timeMs:s,paused:c=!1,onState:l,...u},d){let f=_X(s),p=f!==void 0,m=(0,J.useContext)(hX),h=e??m;if(!h)throw Error(`Sprite needs a configured SpriteProvider or service`);let g=(0,J.useRef)(null),_=(0,J.useRef)(null),v=(0,J.useRef)(l);return v.current=l,(0,J.useImperativeHandle)(d,()=>{if(!g.current)throw Error(`Sprite host is not mounted`);return g.current}),(0,J.useEffect)(()=>{if(!g.current)return;let e=h.mount(g.current),t=e.subscribe(e=>{g.current&&(g.current.dataset.spriteStatus=e.status),v.current?.(e)});return _.current=e,()=>{t(),e.dispose().catch(e=>{console.error(`Sprite cleanup failed`,e)}),_.current=null}},[h]),(0,J.useEffect)(()=>{let e=_.current;if(!e)return;let s={src:t};n!==void 0&&(s={...s,activity:n}),r!==void 0&&(s={...s,expression:r}),i!==void 0&&(s={...s,appearance:i}),a!==void 0&&(s={...s,renderStyle:a}),o!==void 0&&(s={...s,performance:o}),f!==void 0&&(s={...s,timeMs:f}),e.set(s)},[h,t,n,r,i,a,o,f]),(0,J.useEffect)(()=>{_.current?.pause(c||p)},[h,c,p]),(0,X.jsx)(`div`,{...u,ref:g})});function yX(e){return{src:{local:e.character},appearance:e.appearance,expression:e.expression,renderStyle:e.renderStyle}}function bX(e){for(let[t,n]of Object.entries({maxBytes:e.maxBytes,maxTotalBytes:e.maxTotalBytes,maxRequests:e.maxRequests}))if(!Number.isSafeInteger(n)||n<=0)throw Error(`Avatar ${t} must be a positive safe integer`);let t=new Set(e.allowedOrigins.map(e=>new URL(e).origin)),n=e.fetch??globalThis.fetch;return()=>{let r=0,i=0;return async(a,o,s=e.baseURL)=>{let c=new URL(a,s);if(![`http:`,`https:`].includes(c.protocol)||!t.has(c.origin)||c.username||c.password)throw Error(`Avatar asset is not admitted: ${c.origin}`);if(i+=1,i>e.maxRequests)throw Error(`Avatar asset request limit reached`);let l=await n(c.href,{signal:o,redirect:`error`});if(!l.ok)throw Error(`Avatar asset request failed: ${String(l.status)}`);let u=Number(l.headers.get(`content-length`));if(u>e.maxBytes||u>e.maxTotalBytes-r)throw await l.body?.cancel(),Error(`Avatar asset exceeds the byte limit`);let d=l.body?.getReader();if(!d)throw Error(`Avatar asset has no response body`);let f=[],p=0;try{for(;;){o.throwIfAborted();let t=await d.read();if(t.done)break;if(p+=t.value.byteLength,p>e.maxBytes)throw Error(`Avatar asset exceeds the byte limit`);if(t.value.byteLength>e.maxTotalBytes-r)throw Error(`Avatar selection exceeds the total byte limit`);r+=t.value.byteLength,f.push(t.value)}}catch(e){let t=await d.cancel().then(()=>({kind:`cancelled`}),e=>({kind:`failed`,error:e instanceof Error?e:Error(String(e))}));throw t.kind===`failed`?AggregateError([e,t.error],`Avatar asset read and cancellation failed`,{cause:e}):e}finally{d.releaseLock()}let m=new Uint8Array(p),h=0;for(let e of f)m.set(e,h),h+=e.byteLength;return{url:c.href,bytes:m,contentType:l.headers.get(`content-type`)??`application/octet-stream`}}}}var xX=(e,t)=>{let n=tr.safeParse(e);return n.success?{kind:`local`,key:n.data.local}:{kind:`remote`,url:new URL(V().parse(e),t).href}},SX=e=>e instanceof Error?e:Error(String(e),{cause:e}),CX=e=>qt(e)?SX(Fn(e.cause)):Error(`Unexpected Sprite success`);function wX(e){let t=e.maxPixels??4194304;if(!Number.isSafeInteger(t)||t<=0)throw Error(`Sprite pixel limit must be a positive safe integer`);let n=e.assets??{baseURL:`https://sprite.invalid/`,allowedOrigins:[],maxBytes:1,maxTotalBytes:1,maxRequests:1},r=bX(n),i=new WeakSet,a=new WeakMap,o=e=>{let t=xX(e,n.baseURL);return t.kind===`remote`?t.url:`local:${t.key}`};return{mount(s){if(i.has(s))throw Error(`A Sprite already owns this target`);i.add(s);let c=ge(Kt()),l=new Set,u={status:`empty`},d,f,p=0,m=!1,h,g,_,v=!1,y=!1,b=s.ownerDocument.defaultView?.matchMedia(`(prefers-reduced-motion: reduce)`),x=e=>{if(!(v&&e.status!==`destroyed`)){u=e;for(let t of l)try{t(e)}catch(e){console.error(`Sprite state observer failed`,e)}}},S=e=>{f?.controller.abort(),f?.holder.remove(),x({status:`error`,error:e}),T().catch(t=>{x({status:`error`,error:AggregateError([e,t],`Avatar failed and cleanup also failed`)})})},C=Mh(s),w=()=>{let e=y||s.ownerDocument.hidden||b?.matches===!0;C.still(e);try{f?.native?.pause(e)}catch(e){S(SX(e))}};ge(Ut(c,Ue(()=>{s.ownerDocument.removeEventListener(`visibilitychange`,w),b?.removeEventListener(`change`,w),C.dispose()}))),s.ownerDocument.addEventListener(`visibilitychange`,w),b?.addEventListener(`change`,w);let T=async()=>{if(g)return g;let e=f;if(!e)return;f=void 0,e.controller.abort(),e.holder.remove();let t=Ke(St(e.scope,un)).then(e=>{if(qt(e))throw CX(e)});g=t;try{await t}finally{g===t&&(g=void 0)}},E=e=>{let t=e.native,n=e.document,r=d;if(!t||!n||!r||f!==e)return;let i=r.activity??`idle`,a=r.expression??t.expressions[0]??null,o,s;try{o=nr(n.controls,r.appearance),s=ah.parse(r.renderStyle??`plain`)}catch(e){let t=SX(e);u.status===`ready`?u.updateError?.message!==t.message&&x({...u,updateError:t}):S(t);return}let c={requestedActivity:i,requestedExpression:a,activity:t.activities.includes(i)?i:`idle`,expression:a!==null&&t.expressions.includes(a)?a:t.expressions[0]??null,appearance:o,renderStyle:s,fallback:!t.activities.includes(i)||a!==null&&!t.expressions.includes(a)},l=r.performance===void 0?c:{...c,performance:r.performance};r.timeMs!==void 0&&(l={...l,timeMs:r.timeMs});let p=JSON.stringify([l.activity,l.expression,l.appearance,l.timeMs]);if(C.set(s,e.holder),p!==e.appliedKey||r.performance!==e.appliedPerformance||u.status!==`ready`||u.presentation.renderStyle!==s||u.updateError!==void 0||u.presentation.requestedActivity!==i||u.presentation.requestedExpression!==a)try{if((p!==e.appliedKey||r.performance!==e.appliedPerformance)&&t.set(l),e.appliedKey=p,e.appliedPerformance=r.performance,w(),f===e){let t={status:`ready`,document:n,presentation:l};x(e.progress===void 0?t:{...t,progress:e.progress})}}catch(e){S(SX(e))}},D=async(i,a,o)=>{let c=r(),l=ge(Kt()),d=new AbortController,m=s.ownerDocument.createElement(`div`);m.style.cssText=`width:100%;height:100%;position:relative`;let h={key:a,scope:l,controller:d,holder:m};f=h,ge(Ut(l,Ue(()=>{m.remove()}))),s.append(m);let g=ke(function*(){let r,a,o=n.baseURL,s=xX(i.src,n.baseURL);if(s.kind===`remote`){let t=yield*$e({try:()=>c(s.url,d.signal),catch:SX});o=t.url,r=er.parse(JSON.parse(new TextDecoder().decode(t.bytes)));let n=e.renderers&&Object.hasOwn(e.renderers,r.renderer)?e.renderers[r.renderer]:void 0;if(!n)throw Error(`Renderer is not installed: ${r.renderer}`);a=(yield*$e({try:n,catch:SX})).default}else{let t=s.key,n=e.characters&&Object.hasOwn(e.characters,t)?e.characters[t]:void 0;if(!n)throw Error(`Character is not installed: ${t}`);let i=yield*$e({try:n,catch:SX});r=er.parse(i.document),a=i.render}d.signal.throwIfAborted();let l=yield*a({target:m,document:r,signal:d.signal,maxPixels:t,reportError:e=>{f===h&&!d.signal.aborted&&S(e)},reportProgress:e=>{f!==h||d.signal.aborted||(h.progress=e,u.status===`ready`&&x({...u,progress:e}))},assetURL:e=>ke(function*(){let t=yield*$e({try:()=>c(e,d.signal,o),catch:SX});return yield*Ye(Ue(()=>URL.createObjectURL(new Blob([t.bytes],{type:t.contentType}))),e=>Ue(()=>{URL.revokeObjectURL(e)}))})});if(!l.activities.includes(`idle`))throw Error(`Character has no idle fallback`);return l.pause(!0),{native:l,document:r}}).pipe(bt(l)),_=await Ke(g,{signal:d.signal});if(!(v||o!==p||f!==h)){if(qt(_)){let e=CX(_);try{await T(),x({status:`error`,error:e})}catch(t){x({status:`error`,error:AggregateError([e,t],`Avatar load and cleanup failed`)})}return}h.native=_.value.native,h.document=_.value.document,E(h)}},O=async()=>{let e=e=>v||e!==p;for(;m&&!v;){m=!1;let t=p;if(await T(),e(t)||!d)continue;let n=await a.get(s);if(n?.kind===`failed`)throw n.error;e(t)||(x({status:`loading`}),await D(d,o(d.src),t))}},k=()=>{m=!0,f?.controller.abort(),f?.holder.remove(),!h&&(h=O().catch(e=>{x({status:`error`,error:SX(e)})}).finally(()=>{h=void 0,m&&!v&&k()}))};return{get state(){return u},subscribe(e){return l.add(e),()=>l.delete(e)},set(e){if(v)throw Error(`Sprite is destroyed`);d=e;let t=o(e.src);f?.key===t&&u.status===`ready`?E(f):(f?.key!==t||u.status===`error`)&&(p+=1,k())},pause(e){if(v)throw Error(`Sprite is destroyed`);y=e,w()},dispose(){return _||(v=!0,p+=1,i.delete(s),f?.controller.abort(),f?.holder.remove(),x({status:`destroyed`}),_=(async()=>{await h,await T();let e=await Ke(St(c,un));if(qt(e))throw CX(e)})(),a.set(s,_.then(()=>({kind:`closed`}),e=>({kind:`failed`,error:SX(e)}))),_)}}}}}var TX=wX({characters:{mushroom:async()=>(await ir(async()=>{let{default:e}=await import(`./mushroom-BcYLQ0Mq.js`);return{default:e}},__vite__mapDeps([6,7,2,8,1]))).default,cat:async()=>(await ir(async()=>{let{default:e}=await import(`./cat-DYC4NkHa.js`);return{default:e}},__vite__mapDeps([9,7,2,8,1,10]))).default,burger:async()=>(await ir(async()=>{let{default:e}=await import(`./burger-DGwSIRh1.js`);return{default:e}},__vite__mapDeps([11,7,2,8,1,10]))).default}}),EX=(0,J.memo)(function({activity:e=`idle`,avatar:t,className:n,name:r,size:i=24,timeMs:a}){let o=_X(a),[s,c]=(0,J.useState)(!1),l=(0,J.useMemo)(()=>yX(t),[t]);return(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0 ${n??``}`,"data-agent-head":s?`ready`:`loading`,style:{height:i,width:i},children:[s?null:(0,X.jsx)(mX,{className:`absolute inset-0`,name:r,seed:r}),(0,X.jsx)(vX,{activity:e,...o===void 0?{}:{timeMs:o},appearance:l.appearance,className:`absolute inset-0`,expression:l.expression,onState:e=>{c(e.status===`ready`)},paused:o!==void 0||e===`idle`,renderStyle:l.renderStyle,service:TX,src:l.src})]})}),DX=(0,J.memo)(function({avatar:e,className:t=`h-12 w-12 shrink-0`,service:n=TX,state:r}){let i=(0,J.useMemo)(()=>e?yX(e):void 0,[e]);return(0,X.jsx)(vX,{"aria-hidden":`true`,className:t,service:n,src:i?.src??{local:`mushroom`},...i?{appearance:i.appearance,renderStyle:i.renderStyle}:{},...r})}),OX={needs_you:`Waiting for you`,running:`Working`,errored:`Failed`,done:`Done`},kX={needs_you:0,errored_unseen:1,running:2,recent:3};function AX(e){return e===`running`||e===`needs_you`}function jX(e,t){return e!==void 0&&(t===void 0||e>t)}function MX(e,t){switch(e){case`needs_you`:return`needs_you`;case`running`:return`running`;case`errored`:return t?`errored_unseen`:`recent`;case`done`:return`recent`}}function NX(e,t){return kX[e.tier]-kX[t.tier]||(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)}var PX=[`Needs you`,`Working`,`Ready`,`Finished`];function FX(e){return e.tier===`running`?`Working`:e.shelf===`active`?`Needs you`:e.ready?`Ready`:`Finished`}function IX(e){return{key:VX(e.agentId,e.sessionId),shelf:FX(e),attention:e.tier===`needs_you`||e.tier===`errored_unseen`?`${e.tier}:${String(e.settledAt??e.createdAt)}`:null}}function LX(e,t,n){let r=new Map(t.map(e=>[VX(e.agentId,e.sessionId),e]));if(e!==null&&n.held)return e;let i=[...t].sort((e,t)=>(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)),a=new Map(e?.map(e=>[e.key,e])),o=i.map(IX).filter(e=>{let t=a.get(e.key);return t===void 0||e.key!==n.openKey&&e.attention!==null&&e.attention!==t.attention}),s=new Set(o.map(e=>e.key)),c=a.get(n.openKey??``),l=c===void 0?-1:(e??[]).filter(e=>e.shelf===c.shelf).findIndex(e=>e.key===c.key),u=PX.flatMap(t=>{let a;a=e===null||n.reorder?i.map(IX).filter(e=>e.shelf===t):[...o.filter(e=>e.shelf===t),...e.filter(e=>e.shelf===t&&!s.has(e.key)).flatMap(e=>{let t=r.get(e.key);return t===void 0?[]:[{...e,attention:IX(t).attention}]})];let u=c===void 0?void 0:r.get(c.key);return c!==void 0&&u!==void 0&&(a=a.filter(e=>e.key!==c.key),c.shelf===t&&a.splice(Math.min(l,a.length),0,{...c,attention:IX(u).attention})),a});return e!==null&&u.length===e.length&&u.every((t,n)=>t.key===e[n]?.key&&t.shelf===e[n]?.shelf&&t.attention===e[n]?.attention)?e:u}function RX(e){switch(e.kind){case`idle`:return`done`;case`waiting_for_you`:return`needs_you`;case`error`:return`errored`;default:return`running`}}function zX(e,t,n=null,r){let i=new Set(e.map(e=>e.agentId));return BX(t.filter(e=>!(`kind`in e)&&i.has(e.agentId)&&(n===null||e.agentId===n)),r)}function BX(e,t){let n=[],r=[];for(let i of e){if(`kind`in i)continue;if(i.state===`unavailable`){r.push({agentId:i.agentId,sessionId:i.sessionId});continue}let e=jX(i.settledAt,i.visitedAt),a=t?.agentId===i.agentId&&t.sessionId===i.sessionId?t.state:void 0,o=a?RX(a):i.state,s=a?a.kind===`idle`:o===`done`&&i.settledAt===void 0,c=MX(o,e);n.push({...i,state:o,ready:s,unseen:e,tier:c,shelf:c===`recent`?`settled`:`active`})}return n.sort(NX),{active:n.filter(e=>e.shelf===`active`),settled:n.filter(e=>e.shelf===`settled`),unavailable:r.sort((e,t)=>e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId))}}function VX(e,t){return`${e}\u0000${t}`}function HX(e){return e.name}function UX({children:e}){return(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:e})}function WX({open:e,agents:t,agentActivity:n,agentFilterId:r,websitesSelected:i,websitesVisible:a,canCreate:o,createOpen:s,onAll:c,onWebsites:l,onAgent:u,onCreate:d}){let[f,p]=(0,J.useState)(null),m=`grove-rail-cell relative size-12 rounded-field p-0`,h=r===null&&!(i&&a);return(0,X.jsxs)(`nav`,{id:`grove-agent-rail`,"aria-label":`Agents`,className:`grove-rail min-h-0 w-16 flex-none flex-col items-center gap-1 border-r border-base-300 py-2 ${e?`flex`:`flex min-[900px]:hidden`}`,children:[(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`All Agents`,"aria-pressed":h,className:`${m} text-xs ${h?`bg-base-300`:``}`,onClick:c,children:(0,X.jsx)(UX,{children:`All`})}),a?(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`Websites`,"aria-pressed":i,className:`${m} ${i?`bg-base-300`:``}`,onClick:l,children:(0,X.jsx)(UX,{children:(0,X.jsx)(Uq,{name:`internet`,size:28})})}):null,(0,X.jsx)(bA,{className:`w-full flex-1`,style:{width:`100%`},children:(0,X.jsx)(`div`,{className:`flex flex-col items-center gap-1 py-1`,children:t.map(e=>(0,X.jsx)(NT,{variant:`ghost`,"aria-label":HX(e),title:HX(e),"aria-pressed":r===e.agentId&&!i,"data-agent-id":e.agentId,className:`${m} ${r===e.agentId&&!i?`bg-base-300`:``}`,onPointerEnter:()=>{p(e.agentId)},onPointerLeave:()=>{p(null)},onFocus:()=>{p(e.agentId)},onBlur:()=>{p(null)},onClick:()=>{u(e.agentId)},children:(0,X.jsx)(UX,{children:(0,X.jsx)(EX,{activity:n.get(e.agentId)??(f===e.agentId?`thinking`:`idle`),avatar:e.avatar,name:HX(e),size:32})})},e.agentId))})}),o?(0,X.jsx)(NT,{variant:`ghost`,"aria-label":`New Agent`,"aria-expanded":s,"aria-haspopup":`dialog`,className:`${m} mt-auto`,onClick:d,children:(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:(0,X.jsx)(nW,{size:20})})}):null]})}function GX({app:e}){let[t,n]=(0,J.useState)(null),r=Oo({queryKey:qy.of(e,`team-inbox-notices`,t),enabled:e!==null&&(e.capabilities.has(cg)||e.capabilities.has(lg)),queryFn:async()=>{if(!e)throw Error(`No App connection`);let n=await hg(e.capabilities);try{return await Vy(n,t)}finally{await n.close()}}});return!r.isError&&!r.data?.items.length?null:(0,X.jsx)(`section`,{"aria-label":`Team notices`,className:`min-h-0 shrink-0`,children:(0,X.jsxs)(bA,{className:`max-h-52 border-b border-base-300`,children:[r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Team notices unavailable.`}):(0,X.jsx)(Nx,{density:`compact`,className:`px-3 py-2`,children:r.data.items.map(e=>(0,X.jsx)(Px,{children:(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-[var(--spacing-xs)]`,children:[(0,X.jsx)(OG,{className:`col-span-2 grid grid-cols-subgrid`,size:`compact`,tone:`warning`,label:`kind`in e?`Seller closed`:`Installed App safety notice`}),(0,X.jsx)(`p`,{className:`m-0 col-start-2 text-sm [overflow-wrap:anywhere]`,children:`kind`in e?`${e.sellerName} closed. Your installation of ${e.displayName} continues; no new purchases are available.`:`${e.displayName} was removed. Fungi will disable it on your Team.`})]})},e.dispositionId))}),r.data?.next?(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{n(r.data.next)},children:`Older notices`}):null,t===null?null:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{n(null)},children:`Newest notices`})]})})}var KX=`(min-width: 900px)`;function qX(e){let t=globalThis.matchMedia(KX);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}}function JX(){return globalThis.matchMedia(KX).matches}function YX(){return(0,J.useSyncExternalStore)(qX,JX,()=>!0)}function XX({open:e,onOpenChange:t,returnFocus:n,children:r}){let i=YX(),[a,o]=(0,J.useState)(null);return(0,X.jsxs)(kU,{open:i||e,modal:!i,disablePointerDismissal:i,onOpenChange:e=>{i||t(e)},children:[(0,X.jsx)(`div`,{ref:o,className:`contents`}),(0,X.jsxs)(jU,{container:a,keepMounted:!0,className:`contents`,children:[i?null:(0,X.jsx)(MU,{className:`grove-nav-scrim z-30 bg-base-200`}),(0,X.jsx)(NU,{id:`grove-nav`,role:i?`presentation`:`dialog`,"aria-label":i?void 0:`Agents and conversations`,initialFocus:!i&&void 0,finalFocus:!i&&n,className:`grove-nav min-h-0 flex-none rounded-none p-0 overflow-visible max-w-none max-h-none ${i?`static flex w-auto shadow-none`:`fixed inset-y-0 left-0 z-40 w-[min(22rem,88vw)] data-[open]:flex`}`,children:r})]})]})}var ZX=H({path:W,entries:Pt(H({name:W,type:Ht([`file`,`directory`,`symlink`]),size:Jt,modifiedAt:Jt})),nextOffset:Yt(Jt)}),QX=Vm(`computer.list`,1,B(()=>Hm({list:Wm(Um(Qe().transform(e=>Hn(ZX)(e))))}))),$X=Dn([H({state:Ht([`running`,`sleeping`,`starting`])}),H({state:U(`queued`),position:Jt.pipe(q(Vt()),q(Ct(0)))})]),eZ=H({enabled:wt,effective:wt,blockedBy:Yt(Ht([`team`,`global`]))}),tZ=H({computerId:Mn,name:Mn,runtime:$X,backends:Pt(H({id:Mn,kind:Ht([`platform-container`,`on-box-vm`,`local`]),status:Ht([`ready`,`queued`,`online`,`offline`]),queuePosition:Yt(Jt.pipe(q(Vt()),q(Ct(0)))),hostId:Yt(W),hostLabel:Yt(W),folderLabel:Yt(W),detachable:wt})),internet:eZ});Vm(`computer.instrument.read`,1,B(()=>Hm({read:Wm(Um(Qe().transform(e=>Hn(tZ)(e))))}))),Vm(`computer.instrument.control`,1,B(()=>Hm({start:Wm(Um(Qe().transform(e=>Hn($X)(e)))),setInternetAccess:Wm(Um(Qe().transform(e=>Hn(eZ)(e)))),detachLocal:Wm(Um(Qe().transform(e=>Hn(H({detached:wt}))(e))))})));var nZ=H({ports:Pt(H({port:Jt.pipe(q(Vt()),q(mt({minimum:1,maximum:65535}))),previewUrl:Mn,openMode:Ht([`inline`,`external-only`]),expiresAt:Jt.pipe(q(Vt()),q(Ct(0)))})).pipe(q(G(64)))}),rZ=Dn([nZ,H({error:U(`port_previews_not_configured`)})]),iZ=H({port:Jt.annotate({message:`Use a port from 1 to 65535.`}).check(Vt({message:`Use a port from 1 to 65535.`}),mt({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:wt}),aZ=H({port:Jt.pipe(q(Vt()),q(mt({minimum:1,maximum:65535}))),removed:wt});Vm(`computer.ports`,2,B(()=>Hm({list:Wm(Um(Qe().transform(e=>Hn(rZ)(e)))),expose:Wm(Um(Qe().transform(e=>Hn(iZ)(e)))),unexpose:Wm(Um(Qe().transform(e=>Hn(aZ)(e))))})));var oZ=Ht([`synced`,`pending`,`unknown`]),sZ=H({port:Yt(iZ.fields.port),id:Mn,command:Mn,cwd:Yt(W),startedAt:Jt.pipe(q(Vt()),q(Qn(0))),state:Ht([`running`,`exited`,`uncertain`]),exitCode:Yt(Jt.pipe(q(Vt()))),sync:oZ,endedAt:Yt(Jt.pipe(q(Vt()),q(Qn(0))))}),cZ=H({processes:Pt(sZ)}),lZ=H({process:sZ,signalled:wt});H({requestId:Mn.pipe(q(G(256))),command:Mn.pipe(q(G(16384))),cwd:zn(W),port:zn(iZ.fields.port)}),Vm(`computer.processes`,1,B(()=>Hm({start:Wm(Um(Qe().transform(e=>Hn(sZ)(e)))),list:Wm(Um(Qe().transform(e=>Hn(cZ)(e)))),kill:Wm(Um(Qe().transform(e=>Hn(lZ)(e))))}))),Vm(`computer.readFile`,1,B(()=>Hm({open:Wm(Hm({response:Wm(S(Response)),close:Gm}))}))),Vm(`computer.writeFile`,3,B(()=>Hm({open:Wm(Hm({write:Gm,close:Gm})),mkdir:Gm,replace:Wm(Um(Qe().transform(e=>Hn(uZ)(e))))})));var uZ=Dn([H({kind:U(`replaced`),path:Mn,bytes:Jt.pipe(q(Vt()),q(Qn(0)))}),H({kind:U(`conflict`)})]),dZ=H({computerName:Mn.pipe(q(G(256))),teamName:Mn.pipe(q(G(256))),modelDoor:Mn.pipe(q(G(256))),uptimeSeconds:Jt.pipe(q(Vt()),q(Qn(0))),version:Mn.pipe(q(G(64)))});Vm(`computer.terminal`,2,B(()=>Hm({open:Wm(Hm({information:Wm(Um(Qe().transform(e=>Hn(dZ)(e)))),output:Wm(S(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(S(Uint8Array).parse(e))}})))),input:Wm(S(WritableStream)),resize:Gm,close:Gm}))})));function fZ({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function pZ(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var mZ=[],hZ=0,{link:gZ,unlink:_Z,propagate:vZ,checkDirty:yZ,shallowPropagate:bZ}=fZ({update(e){return e._update()},notify(e){mZ[SZ++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,EZ(e))}}),xZ=0,SZ=0,CZ,wZ=0;function TZ(e){try{++wZ,e()}finally{--wZ||DZ()}}function EZ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=_Z(n,e)}function DZ(){if(!(wZ>0)){for(;xZ<SZ;){let e=mZ[xZ];mZ[xZ++]=void 0,e.notify()}xZ=0,SZ=0}}function OZ(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return CZ!==void 0&&gZ(i,CZ,hZ),i._snapshot},subscribe(e){let t=pZ(e),n={current:!1},r=kZ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=CZ,o=t?.compare??Object.is;if(n)CZ=i,++hZ,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{CZ=a,n&&(i.flags&=-5),EZ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&yZ(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&bZ(e)}}else e&32&&(i.flags=e&-33);return CZ!==void 0&&gZ(i,CZ,hZ),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(vZ(e),bZ(e),DZ())}},i}function kZ(e){let t=()=>{let t=CZ;CZ=n,++hZ,n.depsTail=void 0,n.flags=6;try{return e()}finally{CZ=t,n.flags&=-5,EZ(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&yZ(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,EZ(this)}};return t(),n}var AZ=class{constructor(e,t){this.atom=OZ(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(pZ(e))}},jZ=class{constructor(e){this.atom=OZ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(pZ(e))}};function MZ(e,t){return typeof e==`function`?new jZ(e):t?new AZ(e,t):new AZ(e)}var NZ=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function PZ(e,t){return new NZ(e,t).maybeExecute}var FZ=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},IZ=new class extends FZ{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function LZ(e,t){return typeof e==`function`?e(t):e}function RZ(e,t){return KZ(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function zZ(e,t,n){let r=KZ(t);function i(e){if(!r.length)return LZ(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function BZ(e,t){let n=KZ(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var VZ=46,HZ=91,UZ=93,WZ=48,GZ=57;function KZ(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===HZ),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===VZ||s===HZ||s===UZ){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==WZ),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==UZ&&(a!==-1||s!==UZ)&&(a!==s||s!==VZ&&s!==HZ)&&n.push(``);r=o+1,i=!0}else(s<WZ||s>GZ)&&(i=!1);a=s}return n.length||n.push(``),n}function qZ(e){return!(Array.isArray(e)&&e.length===0)}function JZ(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function YZ(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var XZ=e=>!!e&&typeof e==`object`&&`fields`in e;function ZZ(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!ZZ(e[i],t[i]))return!1;return!0}var QZ=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},$Z=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function eQ(e,t){return e==null?t:{...e,...t}}for(var tQ=256,nQ=[],rQ;tQ--;)nQ[tQ]=(tQ+256).toString(16).substring(1);function iQ(){let e=0,t,n=``;if(!rQ||tQ+16>256){for(rQ=Array(256),e=256;e--;)rQ[e]=256*Math.random()|0;e=0,tQ=0}for(;e<16;e++)t=rQ[tQ+e],n+=e===6?nQ[t&15|64]:e===8?nQ[t&63|128]:nQ[t],e&1&&e>1&&e<11&&(n+=`-`);return tQ++,n}var aQ=PZ(e=>IZ.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function oQ(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=oQ(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,oQ(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(oQ(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=oQ(e[n]));return t}function sQ(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var cQ=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function lQ(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var uQ=(e,t)=>{let n=lQ(e,t);return{form:n,fields:n}},dQ={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:uQ(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:uQ(r.issues,e)}},fQ=e=>!!e&&`~standard`in e,pQ={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function mQ(e){function t(t){let n=e.getFieldMeta(t)??pQ;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>pQ;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function hQ(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var gQ=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{aQ(this)}),t=IZ.on(`request-form-state`,e=>{e.payload.id===this._formId&&IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=IZ.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=IZ.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),IZ.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!ZZ(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!ZZ(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(TZ(()=>{this.baseStore.setState(()=>hQ(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=mQ(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}IZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=zZ(t,e.instance.name,e.instance.options.defaultValue))}),hQ({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return TZ(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return TZ(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=JZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||cQ}),r=!1,i={};return TZ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=_Q(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=vQ(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??pQ,r=a?.[e],{newErrorValue:s,newSource:c}=QZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=pQ)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=vQ(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=vQ(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=YZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||cQ});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=vQ(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=_Q(r);s&&(i=i?{...i,...s}:s);let c=vQ(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??pQ,r=i?.[e],{newErrorValue:a,newSource:o}=QZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=pQ)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),TZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}TZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),TZ(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),IZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>RZ(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:LZ(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=pQ,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;TZ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:zZ(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=BZ(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),mQ(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],eQ(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),mQ(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),eQ(r,{dontValidate:!0})),mQ(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),eQ(n,{dontValidate:!0})),mQ(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return zZ(zZ(e,`${t}`,i),`${n}`,r)},eQ(r,{dontValidate:!0})),mQ(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},eQ(r,{dontValidate:!0})),mQ(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],eQ(t,{dontValidate:!0})),mQ(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=RZ(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:pQ},values:i===void 0?t.values:zZ(t.values,e,i)}})},this.setErrorMap=e=>{TZ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(XZ(t)){let{formError:e,fieldErrors:r}=_Q(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>dQ.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>dQ.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??iQ(),this._devtoolsSubmissionOverride=!1;let t=hQ({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!XZ(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=MZ(t);let n;this.fieldMetaDerived=MZ(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=RZ(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!qZ(u),f=!o.isDirty,p=ZZ(l,this.getFieldInfo(a)?.instance?.options.defaultValue??RZ(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=MZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!sQ(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&sQ(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=MZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&XZ(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&ZZ(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return fQ(e.validate)?dQ[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function _Q(e){return e?XZ(e)?{formError:_Q(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function vQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var yQ=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...pQ,isTouched:e.fieldMetaBase[this.name]?.isTouched??pQ.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??pQ.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??pQ.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(ZZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,eQ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,eQ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,eQ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,eQ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,eQ(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=JZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||cQ}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=JZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;TZ(()=>{let e=(e,n)=>{let r=xQ(n.cause),a=n.validate?bQ(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=$Z({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=xQ(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=YZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||cQ}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=YZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));TZ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=xQ(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=bQ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=$Z({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),TZ(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[xQ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[xQ(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>dQ.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>dQ.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)sQ(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=MZ(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...pQ,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!ZZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return fQ(e.validate)?dQ[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function bQ(e){if(e)return e}function xQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function SQ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function CQ(e){return{...pQ,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var wQ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??SQ({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(ZZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...pQ,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??SQ({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;EQ(t)&&(n=t.group,r=t.fields);let i=TQ(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:SQ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,eQ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof yQ&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&sQ(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=QZ({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=pQ)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=JZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||cQ}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=JZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;TZ(()=>{let t=(t,r)=>{let i=OQ(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&EQ(s)&&(c=s.group,l=s.fields);let u=TQ(c),d=n[i],{newErrorValue:f,newSource:p}=$Z({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=OQ(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=YZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||cQ}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=YZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||cQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=OQ(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&EQ(o)&&(l=o.group,u=o.fields);let d=TQ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=$Z({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return TZ(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[OQ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>sQ(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),TZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}TZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),TZ(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=MZ(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??CQ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!ZZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(fQ(e.validate)){let t=dQ[e.type](e.value,e.validate);return e.type===`validate`?DQ(t):t.then(DQ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function TQ(e){if(e)return e}function EQ(e){return!!e&&typeof e==`object`&&`fields`in e}function DQ(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function OQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function kQ(e,t){if(!t)return;let n=Object.assign({},e,{state:oQ(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return TZ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function AQ(e,t){return e===t}function jQ(e,t=e=>e,n){let r=n?.compare??AQ,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,lV.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var MQ=typeof window<`u`?J.useLayoutEffect:J.useEffect;function NQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new yQ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new yQ({...e}),i(a),n({form:e.form,name:e.name}));let o=jQ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=jQ(a.store,e=>e.meta.isTouched),c=jQ(a.store,e=>e.meta.isBlurred),l=jQ(a.store,e=>e.meta.isDirty),u=jQ(a.store,e=>e.meta.errorMap),d=jQ(a.store,e=>e.meta.errorSourceMap),f=jQ(a.store,e=>e.meta.isValidating),p=(0,J.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return MQ(a.mount,[a]),MQ(()=>{a.update(e)}),p}var PQ=(({children:e,...t})=>{let n=NQ(t),r=(0,J.useMemo)(()=>LZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function FQ(){return(0,J.useState)(()=>iQ())[0]}var IQ=J,LQ=`18.3.1`.split(`.`)[0]===`17`?FQ:IQ.useId;function RQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new wQ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new wQ({...e})),n({form:e.form,name:e.name}));let a=jQ(r.store,e=>e.value),o=jQ(r.store,e=>e.meta.isTouched),s=jQ(r.store,e=>e.meta.isBlurred),c=jQ(r.store,e=>e.meta.isDirty),l=jQ(r.store,e=>e.meta.errorMap),u=jQ(r.store,e=>e.meta.errorSourceMap),d=jQ(r.store,e=>e.meta.isValidating),f=jQ(r.store,e=>e.meta.isSubmitting),p=jQ(r.store,e=>e.meta.isSubmitted),m=jQ(r.store,e=>e.meta.submissionAttempts),h=jQ(r.store,e=>e.meta.isSubmitSuccessful),g=jQ(r.store,e=>e.meta.canSubmit),_=jQ(r.store,e=>e.meta.isValid),v=jQ(r.store,e=>e.meta.isFieldsValid),y=jQ(r.store,e=>e.meta.isFieldsValidating),b=jQ(r.store,e=>e.meta.isGroupValid),x=(0,J.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return MQ(r.mount,[r]),MQ(()=>{r.update(e)}),x}var zQ=(({children:e,...t})=>{let n=RQ(t),r=(0,J.useMemo)(()=>LZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function BQ({form:e,selector:t=e=>e,children:n}){let r=jQ(e.store,t);return(0,X.jsx)(X.Fragment,{children:LZ(n,r)})}function VQ(e){let t=LQ(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new gQ({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new gQ({...e,formId:n})),r(n)}let o=(0,J.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,X.jsx)(PQ,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(zQ,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(BQ,{form:i,selector:e.selector,children:e.children})},e},[i]);MQ(i.mount,[]),MQ(()=>{i.update(e)});let s=(0,J.useRef)(!1);return MQ(()=>{s.current&&e?.transform&&kQ(i,e.transform)},[i,e?.transform]),MQ(()=>{s.current=!0}),o}var HQ=fn(W),UQ=fn(H({message:W}));function WQ(e){for(let t of e.errors){let e=fe(he(Be(UQ(t),e=>e.message),()=>HQ(t)));if(e!==void 0&&e.length>0)return e}}var GQ={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},KQ=(0,J.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,X.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:Q(`progress caps-gooey-motion caps-gooey-progress w-full`,GQ[t],e),ref:r})});(0,J.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Q(`caps-game-meter`,i),children:[(0,X.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,X.jsx)(KQ,{"aria-label":e,value:t,max:n,tone:r})]})});function qQ({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,X.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,X.jsx)(XQ,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function JQ({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(AG,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(rW,{}):(0,X.jsx)(cW,{}),onClick:()=>void n(t),type:`button`}):null}function YQ({item:e}){return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,X.jsx)(`div`,{className:`caps-upload-details`,children:(0,X.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function XQ({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,X.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,X.jsx)($U,{className:`size-4`})}),(0,X.jsx)(YQ,{item:e}),(0,X.jsx)(ZQ,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(KQ,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function ZQ({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,X.jsx)(JQ,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(JQ,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(JQ,{action:e.remove,id:t,onAction:r})]})}var QQ=J.createContext(void 0);function $Q(e){let t=J.useContext(QQ);if(t===void 0&&!e)throw Error(nE(47));return t}var e$={...TV,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!TV.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&TV.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>TV.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},t$=class extends gV{constructor(e,t,n){let r=new XB;super(n$(e,r,t,n),r$(r),e$)}setOpen=(e,t)=>{let n=t.reason===hz,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=WB(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=UB(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),QF.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function n$(e,t,n,r=!1){let i={...yV(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function r$(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new $T,stickIfOpen:!0,triggerElements:e}}var i$=aV(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=o$(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),YB(u,d),KB(u);let{forceUnmount:m}=qB(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),J.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),J.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,fz(bz))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(QQ.Provider,{value:u,children:[s&&(0,X.jsx)(BB,{handle:s,store:u}),h&&(0,X.jsx)(s$,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function a$(e){return $Q(!0)?(0,X.jsx)(i$,{props:e}):(0,X.jsx)(hB,{children:(0,X.jsx)(i$,{props:e})})}function o$(e,t){let n=zB((e,n)=>new t$(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function s$({store:e,modal:t}){let n=kB(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return JB(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function c$(e,t){function n(n,r,i){let a=n.currentTarget;QF.flushSync(()=>{e.setOpen(!1,fz(vz,n.nativeEvent,a))}),Ck(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&wk(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var l$=oV(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=$Q(!0),h=EV(s)??m;if(!h)throw Error(nE(74));let g=qE(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=J.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=GB(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=PV(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:HV(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=EB(v,{stickIfOpen:GT(()=>h.context.stickIfOpen)}),k=SU(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=lz({disabled:a,native:o}),N={open(e){return w?lO.open(e):cO.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=c$(h,x),ee=ME(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[$z]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),I=(0,X.jsx)(J.Fragment,{children:ee},g);return E?(0,X.jsxs)(J.Fragment,{children:[(0,X.jsx)(Lz,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),I,(0,X.jsx)(Lz,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):I}),u$=J.createContext(void 0);function d$(){let e=J.useContext(u$);if(e===void 0)throw Error(nE(45));return e}var f$=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return $Q().useState(`mounted`)||n?(0,X.jsx)(u$.Provider,{value:n,children:(0,X.jsx)(oB,{ref:t,...r})}):null}),p$=J.createContext(void 0);function m$(){let e=J.useContext(p$);if(!e)throw Error(nE(46));return e}function h$(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=J.useState(null),d=J.useRef(null),f=fB(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=BH({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=sD(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=J.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=J.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=J.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return zk(()=>{o&&(d.current=o)},[o]),zk(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),J.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var g$=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=FO(e,t)||{};if(l==null)return{};let d=$O(u),f={x:n,y:r},p=VO(i),m=zO(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=PO(D,k,O),j=!c.arrow&&LO(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),_$=(e,t)=>{let{name:n,fn:r}=g$(e);return{name:n,fn:r,options:[e,t]}},v$={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},y$={sideX:`left`,sideY:`top`},b$=`--available-width`,x$=`--available-height`,S$=`--anchor-width`,C$=`--anchor-height`,w$=`--transform-origin`,T$=b$,E$=x$;function D$(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function O$(e,t,n){let{rects:r,placement:i}=e;return{side:D$(t,IO(i),n),align:LO(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function k$(e){return A$(e,h$)}function A$(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=GT(O),A=O?k:n,j=kz(n),M=kz(g),N=Wk()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let ee=x===`placement`,I=P?IO(P):null,te=P&&ee?LO(P)||`center`:null,ne=I||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],re=te||o,ie=re===`center`?ne:`${ne}-${re}`,L=l;typeof L==`number`?L={top:L,right:L,bottom:L,left:L}:L&&={top:L.top||0,right:L.right||0,bottom:L.bottom||0,left:L.left||0};let ae=+(i===`bottom`),oe=+(i===`top`),R=+(i===`right`),se=+(i===`left`),ce={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},le=J.useRef(null),z=kz(a),ue=kz(s),de=typeof a==`function`?0:a,fe=typeof s==`function`?0:s,pe=[];p&&pe.push(p),pe.push(VH(e=>{let t=O$(e,i,N),n=typeof z.current==`function`?z.current(t):z.current,r=typeof ue.current==`function`?ue.current(t):ue.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[de,fe,N,i]));let me=w===`none`&&C!==`shift`,B=!me&&(u||E||C===`shift`),he=C===`none`?null:WH({...ce,padding:{top:L.top+1+ae,right:L.right+1+se,bottom:L.bottom+1+oe,left:L.left+1+R},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),ge=me?null:HH({...ce,rootBoundary:D,mainAxis:w!==`none`,crossAxis:B,limiter:u||E?void 0:UH(e=>{if(!le.current)return{};let{width:t,height:n}=le.current.getBoundingClientRect(),r=BO(IO(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})},[ce,u,E,D,L,w]);C===`shift`||w===`shift`||re===`center`?pe.push(ge,he):pe.push(he,ge),pe.push(GH({...ce,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(T$,`${t}px`),i.setProperty(E$,`${n}px`);let a=iD(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(S$,`${u}px`),i.setProperty(C$,`${d}px`)}}),_$(e=>({element:le.current||rk(e.elements.floating).createElement(`div`),padding:le.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=IO(r),u=LO(r),d=BO(l)===`y`,f=le.current,p=typeof a==`function`?a(O$(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return B&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(w$,d?`${m} ${h}`:`${h} ${m}`),{}}},v$,b),zk(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let _e=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ve,elements:ye,x:be,y:xe,middlewareData:Se,update:Ce,placement:we,context:Te,isPositioned:Ee,floatingStyles:De}=t({rootContext:h,open:m?g:void 0,placement:ie,middleware:pe,strategy:r,whileElementsMounted:m?void 0:(...e)=>OH(...e,_e),nodeId:y,externalTree:S}),{sideX:Oe,sideY:ke}=Se.adaptiveOrigin||y$,Ae=Ee?r:`fixed`,je=J.useMemo(()=>{let e;return e=Ee?b?{position:Ae,[Oe]:be,[ke]:xe}:{...De,position:Ae}:{position:Ae,top:0,left:0},e[T$]=`100vw`,e[E$]=`100vh`,Ee||(e.opacity=0),e},[b,Ae,Oe,be,ke,xe,De,Ee]),Me=J.useRef(null);zk(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(j$(t)?t.current:t)||null;n!==Me.current&&(ve.setPositionReference(n),Me.current=n)},[g,ve,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&j$(e)&&e.current!==Me.current&&(ve.setPositionReference(e.current),Me.current=e.current)},[g,ve,A,j]),J.useEffect(()=>{if(m&&g&&ye.reference&&ye.floating)return OH(ye.reference,ye.floating,Ce,_e)},[m,g,ye,Ce,_e]);let Ne=IO(we),Pe=D$(i,Ne,N),Fe=LO(we)||`center`,Ie=!!Se.hide?.referenceHidden;zk(()=>{x&&g&&Ee&&(Ne!==ne||ee&&Fe!==re)&&F(we)},[x,ee,g,Ee,we,Ne,Fe,ne,re]);let V=J.useMemo(()=>({position:`absolute`,top:Se.arrow?.y,left:Se.arrow?.x}),[Se.arrow]),Le=Se.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:je,arrowStyles:V,arrowRef:le,arrowUncentered:Le,side:Pe,align:Fe,physicalSide:Ne,anchorHidden:Ie,refs:ve,context:Te,isPositioned:Ee,update:Ce}),[je,V,le,Le,Pe,Fe,Ne,Ie,ve,Te,Ee,Ce])}function j$(e){return e!=null&&`current`in e}function M$(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=PB(r);zk(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),zk(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function N$(e){return e===`starting`?Qz:XT}function P$(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ME(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},N$(r),i],stateAttributesMapping:uO})}var F$=20;function I$(e,t,n,r){let[i,a]=J.useState(!1);zk(()=>{if(!e||!t||n==null){a(!1);return}let r=rk(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-F$)},[e,t,n]),fU(e&&(!t||i),r)}var L$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=eB,..._}=e,v=$Q(),y=d$(),b=pB(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=k$({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});M$({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;I$(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=P$(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,X.jsxs)(p$.Provider,{value:j,children:[S&&M&&(0,X.jsx)(eU,{inert:$H(!C),cutout:T}),(0,X.jsx)(mB,{id:b,children:P})]})}),R$=J.createContext(void 0);function z$(e){let t=J.useContext(R$);if(t===void 0&&!e)throw Error(nE(69));return t}var B$=J.createContext(void 0);function V$(){let[e,t]=J.useState(0),n=GT(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:J.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var H$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=$Q(),l=m$(),u=z$(!0)!=null,{context:d,hasClosePart:f}=V$(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);FB({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),MV(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?RB(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=ME(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...LB,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&JH.has(e.key)&&e.stopPropagation()}},N$(g),s],stateAttributesMapping:dO});return(0,X.jsx)(TB,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:cD(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(B$.Provider,{value:d,children:M})})}),U$=(0,J.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,X.jsxs)(`button`,{...r,ref:i,type:n,className:Q(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(JU,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function W$({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(t),[x,S]=(0,J.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,J.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=$G({getKey:n,isDisabled:o,items:T});(0,J.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(oG(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,J.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function G$(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,J.useId)(),F=O?.props??_,ee=g??F?.id??P,I={id:ee,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:te,onPointerMove:ne,activeItem:re,activeKey:ie,commit:L,groups:ae,inputValue:oe,listboxId:R,onInputChange:se,onInputKeyDown:ce,open:le,optionId:z,selectedKeys:ue,setOpen:de}=W$({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:ee,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});DU(()=>{O&&de(!1)});let fe=EU(`popover`),pe=s===void 0?fe:s,me=ZG(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),B=(0,X.jsx)(qG,{..._,...O?{}:I,"aria-activedescendant":re?z(f(re)):void 0,"aria-autocomplete":`list`,"aria-controls":R,"aria-expanded":!0,className:Q(`input-sm`,_?.className),id:O?_?.id??`${ee}-input`:ee,onChange:e=>{_?.onChange?.(e),se(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||ce(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:oe}),he=(0,X.jsx)(`div`,{id:R,ref:me,className:`caps-combobox-list`,"data-navigation":te?`keyboard`:`pointer`,onPointerMove:ne,role:`listbox`,"aria-multiselectable":C??void 0,children:ae.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):ae.map(e=>(0,X.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,X.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=ie===t,i={active:r,disabled:n,selected:ue.includes(t)};return(0,X.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&te,disabled:n,id:z(t),onClick:()=>{L(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,X.jsx)(qU,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(a$,{modal:!0,onOpenChange:de,open:le,children:[(0,X.jsx)(l$,{...I,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),pe===null?null:(0,X.jsx)(f$,{container:pe,children:(0,X.jsx)(L$,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(H$,{"data-active-tone":o,className:Q(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:B}),he]})})})]})}):(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(`div`,{className:Q(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:B}),he]})})}function K$({icon:e,caption:t}){return(0,X.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,X.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var q$=(0,J.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,X.jsx)(KG,{...a,appearance:r??`default`,"aria-label":e,className:Q(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(K$,{icon:t,caption:n}),ref:o})})});function J$({checked:e}){let t=`caps-radio-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=(0,J.useRef)(null),o=sS(a),{reduced:s}=o;return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=mA(o,{ease:`outCubic`,duration:75}),c=e?pA(o,{bounce:.65,duration:300}):mA(o,{ease:`inCubic`,duration:100}),l=fT(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,X.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,X.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var Y$=(0,J.createContext)(null),X$=(0,J.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,J.useId)(),d=(0,J.useRef)(null);(0,J.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,J.useState)(n),h=s??p;return(0,J.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,X.jsx)(Y$.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,X.jsx)(`fieldset`,{...c,className:Q(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),Z$=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)(Y$);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,X.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,X.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:Q(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,X.jsx)(J$,{checked:c}):t]})}),Q$=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)(Y$),s=(0,J.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,X.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,X.jsx)(Z$,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,X.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,X.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,X.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,X.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),$$=(0,J.forwardRef)(function({label:e,icon:t,caption:n,className:r,...i},a){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,children:(0,X.jsx)(Z$,{...i,"aria-label":e,className:Q(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(K$,{icon:t,caption:n}),ref:a})})}),e1=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,X.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,X.jsx)(JU,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function t1({checked:e}){let t=`caps-switch-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useRef)(e).current,a=(0,J.useRef)(e),o=_S();return(0,J.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=oS(n.current),c=pA(s,{bounce:.25,duration:440}),l=mA(s,{ease:`inOutSine`,duration:100}),u=fT(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=fT(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,X.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_T,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vT,{id:`${t}-shadow`}),(0,X.jsx)(yT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-track`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,X.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,X.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var n1=(0,J.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,J.useRef)(null),[c,l]=(0,J.useState)(n),u=t??c;return(0,J.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,J.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,X.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,X.jsx)(`input`,{...a,checked:u,className:Q(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,X.jsx)(t1,{checked:u})]})}),r1=fn(W),i1=fn(wt),a1=fn(Yt(Ft)),o1=fn(Pt(W)),s1=Pt(zt(File)),c1=fn(s1),l1=Dn([W,Ft,wt,Et,gn,Pt(W),s1]),u1=fn(l1),d1=e=>ce(r1(e.state.value),()=>``),f1=e=>ce(i1(e.state.value),()=>!1),p1=e=>ce(a1(e.state.value),()=>null),m1=e=>ce(o1(e.state.value),()=>[]),h1=e=>ce(c1(e.state.value),()=>[]),g1=e=>ce(u1(e.state.value),()=>null);function _1({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,X.jsxs)(jK,{children:[(0,X.jsx)(qG,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:d1(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,X.jsx)(ZU,{"aria-hidden":`true`}):(0,X.jsx)(QU,{"aria-hidden":`true`})})]})}var v1={text:`text`,email:`email`,url:`url`,tel:`tel`};function y1({spec:e,field:t,locked:n,...r}){let i=h1(t),a=n||e.readOnly===!0,o=(0,J.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(vS,{asChild:!0,children:(0,X.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,X.jsx)(NT,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,X.jsx)(qQ,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function b1({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,X.jsx)(qG,{...a,type:v1[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(RG,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(_1,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)(jK,{children:[(0,X.jsx)(MK,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(qG,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(qG,{...a,type:`date`,readOnly:e.readOnly,value:d1(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(qK,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:p1(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(e1,{...a,value:d1(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,X.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,X.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,X.jsx)(G$,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:d1(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(U$,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===d1(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,X.jsx)(y1,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(KG,{...a,disabled:n||e.readOnly===!0,checked:f1(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(n1,{...a,disabled:n||e.readOnly===!0,checked:f1(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var x1=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function S1({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=m1(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(BK,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,X.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,X.jsx)(q$,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):e.options.map(r=>(0,X.jsx)(HK,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(KG,{name:e.name,value:r.value,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}})},r.value))})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,X.jsx)(BK,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,X.jsx)(X$,{name:e.name,"aria-label":o,value:d1(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,X.jsx)($$,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,X.jsx)(Q$,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(HK,{label:t.label,orientation:`inline`,children:(0,X.jsx)(Z$,{value:t.value,disabled:t.disabled})},t.value))})})}function C1({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:g1(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function w1({form:e,spec:t,locked:n,layout:r}){let i=NQ({form:e,name:t.name}),a=jQ(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?WQ(i.state.meta):void 0;if(t.render===void 0&&x1.has(t.kind))return(0,X.jsx)(S1,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,X.jsx)(HK,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,X.jsx)(b1,{spec:t,field:i,locked:n}):(0,X.jsx)(C1,{spec:t,field:i,locked:n,error:o,render:t.render})})}var T1=fn(Zt(W,l1));function E1({form:e,spec:t,locked:n,layout:r}){let i=t.when;return jQ(e.store,e=>i===void 0||i(ce(T1(e.values),()=>({}))))?(0,X.jsx)(w1,{form:e,spec:t,locked:n,layout:r}):null}function D1({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,X.jsx)(E1,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,X.jsx)(zK,{title:t.title,description:t.description,layout:r,children:i})}function O1({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(D1,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,X.jsx)(E1,{form:i,spec:a,locked:n,layout:r},t)})}var k1=class{annotation;constructor(e){this.annotation=e}},A1=class{sections;constructor(e){this.sections=e}},j1=`caps/form`,M1=0;function N1(e){M1+=1;let t={[`${j1}:${String(M1)}`]:new k1(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}W.annotate(N1({kind:`secret`})).pipe(on(`Secret`));var P1=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function F1(e){return Object.values(e??{}).reduce((e,t)=>t instanceof k1?{...e,...t.annotation}:e,{})}function I1(e){return e.reduce((e,t)=>({...e,...F1(t)}),{})}function L1(e){let t=e?.[j1];return t instanceof A1?t.sections:{}}var R1=fn(W);function z1(e){if(Wn(e))return Ge(R1(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!ut(e))return null;let t=[];for(let n of e.types){if(bn(n))continue;let e=z1(n);if(e===null)return null;t.push(...e)}return t}function B1(e){if(jt(e))return{type:`string`,literals:[]};if(gt(e))return{type:`number`,nullable:!1};if(It(e))return{type:`boolean`};let t=z1(e);if(t!==null)return{type:`string`,literals:t};if(Jn(e)){let[t]=e.rest;if(t===void 0)return null;if(jt(t))return{type:`strings`,literals:[]};let n=z1(t);return n===null?null:{type:`strings`,literals:n}}if(ut(e)){let t=e.types.filter(e=>!bn(e)&&!Rt(e)),n=e.types.some(e=>Rt(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=B1(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function V1(e){let t=e.ast;if(!pt(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Nt(e.type),r=I1([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:B1(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:kt(e.type),description:Ot(e.type)}}),sections:L1(vn(t))}}function H1(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof lt)n=!0,t=t.unwrap();else if(t instanceof y)r=!0,t=t.unwrap();else if(t instanceof O)t=t.unwrap();else if(t instanceof a)t=t.in;else return{node:t,optional:n,nullable:r}}function U1(e){if(e instanceof ne){let t=e.options.map(e=>U1(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof j?e.options:e instanceof d?[...e.values]:null;if(t===null)return null;let n=t.map(e=>R1(e));return n.every(Ce)?n.map(e=>e.value):null}function W1(e){let{node:t,nullable:n}=H1(e);if(t instanceof L)return{type:`string`,literals:[]};if(t instanceof w)return{type:`number`,nullable:n};if(t instanceof E)return{type:`boolean`};let r=U1(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof je){let e=H1(t.element).node;if(e instanceof L)return{type:`strings`,literals:[]};let n=U1(e);return n===null?null:{type:`strings`,literals:n}}return null}function G1(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof lt||e instanceof y||e instanceof O?e.unwrap():e instanceof a?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>k.get(e))}function K1(e){return G1(e).reduce((e,t)=>({...e,...t}),{})}function q1(e){return Object.entries(e.shape)}function J1(e){let t=H1(e).node;if(!(t instanceof P))throw Error(`A schema form needs a z.object.`);return{fields:q1(t).map(([e,t])=>{let n=I1(G1(t)),r=n.kind===`file`?{type:`files`}:W1(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=K1(t);return{name:e,valueType:r,optional:H1(t).optional,annotation:n,title:i.title,description:i.description}}),sections:L1(K1(e))}}function Y1(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??P1(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function X1(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function Z1(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function Q1(e){let t=e instanceof g?J1(e):V1(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=Y1(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??P1(e.name),help:a,kind:n??X1(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=Z1(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function $1(e){let t=e instanceof g?e:Qt(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>e0(e)):e0(n)}}}}function e0(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var t0=`onServer`;function n0(e){let t=e?.querySelector(`[aria-invalid="true"]`);t?.matches(`input, select, textarea, button, [tabindex]`)?t.focus():t?.querySelector(`input, select, textarea, button`)?.focus()}function r0(e){return e.state.meta.errorMap.onServer!==void 0}function i0(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[t0]:void 0}}))}function a0(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[t0]:n}}))}function o0(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(e.defaultValues),[s,c]=(0,J.useState)(null);ZZ(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>Q1(l),[l]),d=(0,J.useMemo)(()=>$1(l),[l]),f=VQ({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),r0(e)&&i0(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await $1(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&a0(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function s0(e){return{dirty:jQ(e.form.store,e=>!e.isDefaultValue),submitting:jQ(e.form.store,e=>e.isSubmitting),canSubmit:jQ(e.form.store,e=>e.canSubmit)}}function c0({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=s0(e),f=(0,J.useRef)(null);return(0,X.jsxs)(LK,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{setTimeout(()=>{n0(f.current)},0)})},children:[c??(0,X.jsx)(O1,{model:e,disabled:l,layout:o}),s===void 0?(0,X.jsx)(d0,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function l0({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=o0({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,X.jsx)(c0,{...a,model:o})}function u0(e){return`model`in e?(0,X.jsx)(c0,{...e}):(0,X.jsx)(l0,{...e})}function d0({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=s0(e),d=u?null:e.saved&&!l?(0,X.jsx)(OG,{tone:`success`,size:`compact`,label:e.saved}):l?(0,X.jsx)(OG,{tone:`neutral`,size:`compact`,label:o}):null;return(0,X.jsxs)(IK,{...c,error:e.error,status:d,children:[r?(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,X.jsx)(NT,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var f0=e=>e,p0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing burger path: ${t}`);return n},m0={apiVersion:1,name:`burger`,palette:{bottomBun:`#e9c46a`,bunSpot:`#d4a373`,cheese:`#f4d03f`,dead:`#636e72`,deadTongue:`#b2bec3`,eye:`#2d3436`,lettuce:`#7cb342`,mouth:`#2d3436`,patty:`#5d4037`,tomato:`#e74c3c`,topBun:`#f4a261`,blush:`#feaae4`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.cylinder({parent:r,name:`bottom-bun`,backface:t(`bottomBun`),color:t(`bottomBun`),diameter:34,frontFace:t(`bunSpot`),length:6,rotate:{x:Math.PI/2},stroke:!1,translate:{y:8}}),e.cylinder({parent:r,name:`patty`,color:t(`patty`),diameter:36,frontFace:t(`patty`),length:4,rotate:{x:Math.PI/2},stroke:!1,translate:{y:3}}),e.cylinder({parent:r,name:`tomato`,color:t(`tomato`),diameter:34,frontFace:t(`tomato`),length:2,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-2}});let i=e.hemisphere({parent:r,name:`top-bun`,backface:t(`bunSpot`),color:t(`topBun`),diameter:38,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-3}});for(let[n,r]of[{x:-8,y:-6,z:14},{x:6,y:-8,z:13},{x:0,y:-10,z:12},{x:10,y:-4,z:13},{x:-5,y:-2,z:15},{x:4,y:-12,z:11}].entries())e.path({parent:i,name:`seed.${String(n+1)}`,path:[{x:0,y:0}],color:t(`bunSpot`),stroke:1.2,translate:r});let a=e.group({parent:r,name:`face`,translate:{y:-5,z:16}}),o=cr(e,t,a,{blushMode:`medium-alias`,hideMouth:!0}),s=e.group({parent:r,name:`burger.mouth`,translate:{y:1,z:10}}),c=f0({angry:[{x:-13,y:2},{x:13,y:2},{x:13,y:5},{bezier:[{x:7,y:4},{x:0,y:5},{x:-7,y:4}]},{x:-13,y:5}],happy:[{x:-12,y:0},{bezier:[{x:-6,y:3},{x:0,y:5},{x:6,y:3}]},{x:12,y:0},{x:13,y:2},{bezier:[{x:7,y:5},{x:0,y:7},{x:-7,y:5}]},{x:-13,y:2}],open:[{x:-10,y:0},{bezier:[{x:-10,y:5},{x:-5,y:8},{x:0,y:8}]},{bezier:[{x:5,y:8},{x:10,y:5},{x:10,y:0}]},{x:10,y:1},{bezier:[{x:5,y:6},{x:-5,y:6},{x:-10,y:1}]}],pout:[{x:-8,y:2},{bezier:[{x:0,y:5},{x:8,y:2},{x:8,y:4}]},{x:0,y:6},{x:-8,y:4}],sad:[{x:-12,y:3},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:3},{x:13,y:5},{bezier:[{x:7,y:2},{x:0,y:1},{x:-7,y:2}]},{x:-13,y:5}],small:[{x:-6,y:1},{x:6,y:1},{x:7,y:3},{x:0,y:2},{x:-7,y:3}],surprised:[],worried:[{x:-11,y:1},{bezier:[{x:-6,y:3},{x:-3,y:1},{x:0,y:2}]},{bezier:[{x:3,y:1},{x:6,y:3},{x:11,y:1}]},{x:12,y:3},{x:0,y:4},{x:-12,y:3}],dead:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}],normal:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}]}),l=f0({angry:[{x:-13,y:0},{x:13,y:0},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:2},{x:-7,y:1}]},{x:-13,y:2}],happy:[{x:-12,y:2},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:2},{x:13,y:3},{bezier:[{x:7,y:1},{x:0,y:0},{x:-7,y:1}]},{x:-13,y:3}],open:[{x:-10,y:2},{bezier:[{x:-10,y:-3},{x:-5,y:-6},{x:0,y:-6}]},{bezier:[{x:5,y:-6},{x:10,y:-3},{x:10,y:2}]},{x:10,y:1},{bezier:[{x:5,y:-4},{x:-5,y:-4},{x:-10,y:1}]}],pout:[{x:-8,y:0},{bezier:[{x:-4,y:-1},{x:0,y:0},{x:4,y:-1}]},{x:8,y:0},{x:9,y:1},{x:0,y:1},{x:-9,y:1}],sad:[{x:-12,y:0},{bezier:[{x:-6,y:2},{x:0,y:3},{x:6,y:2}]},{x:12,y:0},{x:13,y:1},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:1}],small:[{x:-6,y:0},{bezier:[{x:-3,y:1},{x:0,y:0},{x:3,y:1}]},{x:6,y:0},{x:7,y:1},{x:0,y:1},{x:-7,y:1}],surprised:[{x:-13,y:2},{bezier:[{x:-7,y:-2},{x:0,y:-3},{x:7,y:-2}]},{x:13,y:2},{x:14,y:3},{bezier:[{x:8,y:0},{x:0,y:-1},{x:-8,y:0}]},{x:-14,y:3}],worried:[{x:-11,y:1},{bezier:[{x:-6,y:0},{x:-3,y:1},{x:0,y:0}]},{bezier:[{x:3,y:2},{x:6,y:0},{x:11,y:1}]},{x:12,y:2},{bezier:[{x:7,y:1},{x:0,y:1},{x:-7,y:1}]},{x:-12,y:2}],dead:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}],normal:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}]}),u={};for(let n of[`normal`,`happy`,`sad`,`angry`,`surprised`,`dead`,`small`,`worried`,`pout`,`open`]){let r=e.group({parent:s,name:`burger.mouth.${n}`}),i={y:n===`open`?2:n===`small`?.5:1.5,z:+(n===`pout`)};n===`surprised`?e.ellipse({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,height:8,stroke:2,translate:{y:2,z:0},width:6}):e.path({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,path:p0(c,n),stroke:2,translate:i});let a={y:n===`open`?1:n===`surprised`?-1:-.5,z:n===`pout`?2:1};e.path({parent:r,name:`lettuce.${n}`,color:t(`lettuce`),fill:!0,path:p0(l,n),stroke:1.5,translate:a}),u[n]=r}return{root:n,variants:{eyes:o.eyes,mouth:u,blush:o.blush}}},expressions:sr,activities:lr,defaultPresentation:{activity:`idle`,expression:`normal`}},h0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing cat face node: ${t}`);return n},g0=e=>e,_0={apiVersion:1,name:`cat`,palette:{body:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,blush:`#feaae4`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,stripes:`#dea38b`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.path({parent:r,name:`body.sphere`,path:[{x:0,y:0}],color:t(`body`),stroke:32});for(let n of[-1,1])e.path({parent:r,name:`ear.${n<0?`left`:`right`}`,color:t(`body`),fill:!0,path:[{x:-6,y:0},{x:6,y:0},{x:0,y:-10}],rotate:{z:.6*n},stroke:3,translate:{x:9*n,y:-10}});let i=e.group({parent:r,name:`face`,translate:{z:20}}),a=cr(e,t,i,{hideMouth:!0}),o=e.group({parent:i,name:`cat.mouth`,translate:{y:6,z:2}}),s=(n,r,i)=>e.path({parent:o,name:`cat.mouth.${n}`,closed:!1,color:t(`mouth`),path:r,stroke:i}),c=g0({normal:s(`normal`,[{x:-2,y:-1},{x:0,y:0},{x:2,y:-1}],1.5),sad:s(`sad`,[{x:-2.5,y:2},{bezier:[{x:0,y:0},{x:2.5,y:2},{x:2.5,y:2}]}],1.5),angry:s(`angry`,[{x:-3,y:1},{x:3,y:1}],2),small:s(`small`,[{x:-1.5,y:0},{x:1.5,y:0}],1),worried:s(`worried`,[{x:-2,y:1},{bezier:[{x:-.5,y:.5},{x:.5,y:.5},{x:2,y:1}]}],1)}),l=e.group({parent:o,name:`cat.mouth.happy`,translate:{y:1}});e.path({parent:l,closed:!1,color:t(`mouth`),path:[{x:-2.5,y:1},{bezier:[{x:0,y:3},{x:2.5,y:1},{x:2.5,y:1}]}],stroke:1.5}),e.ellipse({parent:l,width:2,height:1.5,stroke:0,fill:!0,color:t(`tongue`),translate:{y:2}}),c.happy=l,c.surprised=e.ellipse({parent:o,name:`cat.mouth.surprised`,width:2.5,height:3,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let u=e.group({parent:o,name:`cat.mouth.dead`,translate:{y:3}});e.ellipse({parent:u,width:2.5,height:1.5,stroke:1.5,fill:!0,color:t(`dead`)}),e.ellipse({parent:u,width:1.2,height:.8,stroke:0,fill:!0,color:t(`deadTongue`),translate:{y:.5}}),c.dead=u,c.pout=e.ellipse({parent:o,name:`cat.mouth.pout`,width:2,height:2.5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}}),c.open=e.ellipse({parent:o,name:`cat.mouth.open`,width:4,height:5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let d=e.group({parent:i,name:`whiskers`,translate:{y:5,z:2}});for(let n of[-1,1]){let r=n*12;for(let[i,a]of[-2,0,2].entries())e.path({parent:d,name:`whisker.${n<0?`left`:`right`}.${String(i)}`,closed:!1,color:t(`eye`),path:[{x:0,y:a},{x:n*8,y:a+(i-1)*1.5}],stroke:.8,translate:{x:r,y:a*.5}})}let f={normal:h0(c,`normal`),happy:c.happy,sad:h0(c,`sad`),angry:h0(c,`angry`),surprised:c.surprised,dead:c.dead,small:h0(c,`small`),worried:h0(c,`worried`),pout:c.pout,open:c.open};return{root:n,variants:{eyes:a.eyes,mouth:f,blush:a.blush}}},expressions:sr,activities:{...lr,listening:{motion:{target:`root`,rotate:{x:-.2},durationMs:300,repeat:`yoyo`},mouseInfluence:.3},thinking:{motion:{target:`root`,rotate:{z:.1},durationMs:800,repeat:`yoyo`},mouseInfluence:0}},defaultPresentation:{activity:`idle`,expression:`normal`}},v0={apiVersion:1,name:`mushroom`,palette:{body:`#fff7e4`,cap:`#f98284`,capSpot:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.hemisphere({parent:r,name:`body.hemisphere`,backface:t(`cap`),color:t(`body`),diameter:32,rotate:{x:3*Math.PI/2},stroke:!1,translate:{y:2}});let i=e.hemisphere({parent:r,name:`cap.hemisphere`,backface:t(`capSpot`),color:t(`cap`),diameter:42,rotate:{x:Math.PI/2},stroke:!1,translate:{y:2}});e.path({parent:i,name:`cap.spot.front`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:12,translate:{x:-8,y:8,z:12}}),e.path({parent:i,name:`cap.spot.top`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:18,translate:{x:8,y:-4,z:13}});let a=e.group({parent:r,name:`face`,translate:{y:7,z:8}}),o=cr(e,t,a,{blushMode:`none`});return{root:n,variants:{eyes:o.eyes,mouth:o.mouth,blush:o.blush}}},expressions:sr,activities:{...lr,error:{geometry:{eyes:`dead`,mouth:`dead`},motion:{target:`root`,rotate:{x:.9},durationMs:600,repeat:`none`},mouseInfluence:.1}},defaultPresentation:{activity:`idle`,expression:`sleepy`}},y0={mushroom:[`cap`,`capSpot`],cat:[`body`,`stripes`],burger:[`topBun`,`bottomBun`]},b0={mushroom:v0,cat:_0,burger:m0};function x0(e){let t=ar(or(b0[e])),n=rr.parse(t.data);return{controls:t.controls,expressions:Object.keys(n.expressions),identitySlots:y0[e]}}var S0=new Map;function C0(e){let t=S0.get(e);return t||(t=x0(e),S0.set(e,t)),t}var w0=Object.freeze({get mushroom(){return C0(`mushroom`)},get cat(){return C0(`cat`)},get burger(){return C0(`burger`)}}),T0={mushroom:`Shiitake`,cat:`Cat`,burger:`Burger`},E0=[[`Rose`,`#f98284`,`#ffe6c6`],[`Peach`,`#f6a55c`,`#ffe9c9`],[`Gold`,`#f2d06b`,`#fff6d1`],[`Leaf`,`#9bd47a`,`#e6f8d8`],[`Mint`,`#5fc7b4`,`#d9f6ef`],[`Sky`,`#6aaee8`,`#dcefff`],[`Lilac`,`#9b8cf0`,`#ebe6ff`],[`Plum`,`#e58bd6`,`#fbe2f6`]];function D0(e,t){if(t===e.character)return e;let n=w0[e.character].identitySlots,r=w0[t].identitySlots,i=Object.fromEntries(r.flatMap((t,r)=>{let i=n[r];return Object.hasOwn(e.appearance,i)?[[t,e.appearance[i]]]:[]}));return{...e,character:t,appearance:i,expression:`normal`}}function O0({value:e,disabled:t=!1,onChange:n}){let r=(0,J.useId)(),i=w0[e.character].identitySlots,a=E0.find(([,t,n])=>i.every((r,i)=>e.appearance[r]===(i===0?t:n)))?.[0]??``;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(X$,{"aria-label":`Character`,className:`grid grid-cols-3 gap-sm`,disabled:t,orientation:`horizontal`,value:e.character,onValueChange:t=>{n(D0(e,Lh.shape.character.parse(t)))},children:Nh.map(t=>(0,X.jsx)(Q$,{id:`${r}-${t}`,value:t,title:T0[t],description:(0,X.jsx)(EX,{avatar:D0(e,t),name:T0[t],size:40})},t))}),(0,X.jsx)(X$,{"aria-label":`Colour`,className:`flex flex-wrap gap-xs`,disabled:t,orientation:`horizontal`,value:a,onValueChange:t=>{let r=E0.find(([e])=>e===t);r&&n({...e,appearance:{...e.appearance,...Object.fromEntries(i.map((e,t)=>[e,r[t===0?1:2]]))}})},children:E0.map(([e,t])=>(0,X.jsx)(`label`,{title:e,className:`grid size-9 cursor-pointer place-items-center rounded-full border border-base-300`,style:{backgroundColor:t},children:(0,X.jsx)(Z$,{value:e,"aria-label":e})},e))})]})}var k0=Ln.check(In(1,{message:`Give your Agent a name.`}),G(256,{message:`Use at most 256 characters.`})),A0=fn(k0),j0=Gh.annotate(N1({label:`Computer`,kind:`select`,options:{new:`New Computer`,none:`No Computer`}})),M0=dt({family:`grove-agent-create-request`,version:1,kinds:{request:{prefix:`request`}}});function N0({create:e,canChooseComputer:t,inputRef:n,error:r,onCancel:i}){let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(()=>Vh(M0.request.generate())),c=o0({schema:(0,J.useMemo)(()=>H({name:k0.annotate(N1({label:`Name`,render:e=>(0,X.jsx)(qG,{ref:n,id:e.id,name:e.name,"aria-label":`New Agent name`,"aria-required":`true`,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],placeholder:`Name your Agent`,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})})),computer:j0}),[n]),defaultValues:{name:``,computer:Gh.make(`new`)},onSubmit:async({name:n,computer:r})=>{let i=t?r:void 0,s=a.current;if(s?.name!==n||s.computer!==i||s.avatar!==o){let e={name:n,requestId:M0.request.generate(),avatar:o};s=i===void 0?e:{...e,computer:i}}return a.current=s,await e(s)?(a.current=null,{kind:`saved`,values:{name:``,computer:Gh.make(`new`)}}):{kind:`refused`}}}),{submitting:l,canSubmit:u,dirty:d}=s0(c);return(0,X.jsxs)(u0,{model:c,"aria-label":`Create Agent`,footer:(0,X.jsxs)(IK,{divider:!1,error:r,children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:l,onClick:i,children:`Cancel`}),(0,X.jsx)(NT,{type:`submit`,className:`shrink-0 disabled:-outline-offset-1`,variant:`primary`,loading:l,disabled:l||!u||!d,children:`Create Agent`})]}),onSubmitCapture:e=>{M(A0(c.form.state.values.name))&&e.currentTarget.querySelector(`input[name="name"]`)?.focus()},onChange:()=>{let e=c.form.state.values;(e.name.trim()!==a.current?.name||t&&e.computer!==a.current.computer)&&(a.current=null)},children:[(0,X.jsx)(O1,{model:c,names:t?[`name`,`computer`]:[`name`]}),(0,X.jsxs)(`fieldset`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(`legend`,{className:`caps-label mb-xs text-sm font-semibold text-base-content`,children:`Avatar`}),(0,X.jsx)(O0,{value:o,disabled:l,onChange:e=>{s(e),a.current=null}})]})]})}function P0({open:e,pending:t,error:n,canChooseComputer:r,create:i,onClose:a,returnFocus:o}){let s=(0,J.useRef)(null);return(0,X.jsx)(kU,{open:e,onOpenChange:e=>{!e&&!t&&a()},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,initialFocus:s,finalFocus:o,keepMounted:!1,children:[(0,X.jsxs)(IU,{children:[(0,X.jsx)(LU,{children:`New Agent`}),(0,X.jsx)(RU,{children:`Agents chat, write and make little games with you.`})]}),(0,X.jsx)(N0,{create:i,canChooseComputer:r,inputRef:s,error:n,onCancel:a})]})})}function F0({open:e,agents:t,defaultAgentId:n,start:r,pending:i,onClose:a,onNewAgent:o,returnFocus:s}){let c=o0({schema:(0,J.useMemo)(()=>H({agentId:W.check(an(e=>t.some(t=>t.agentId===e)||`Choose an Agent.`)).annotate(N1({label:`Agent`,kind:`select`,options:Object.fromEntries(t.map(e=>[e.agentId,HX(e)]))}))}),[t]),defaultValues:{agentId:n??``},onSubmit:async({agentId:e})=>{let t=await r(e);if(t)return{kind:`refused`,error:t}}}),{submitting:l,canSubmit:u}=s0(c);return(0,X.jsx)(kU,{open:e,onOpenChange:e=>{!e&&!i&&!c.form.state.isSubmitting&&a()},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,keepMounted:!1,finalFocus:s,children:[(0,X.jsxs)(IU,{children:[(0,X.jsx)(LU,{children:`New conversation`}),(0,X.jsx)(RU,{children:`Choose who to talk with.`})]}),t.length===0?(0,X.jsxs)(`div`,{className:`grid gap-sm`,children:[(0,X.jsx)(`p`,{children:`No Agent has conversation access yet.`}),o?(0,X.jsx)(NT,{onClick:o,children:`New Agent`}):null,(0,X.jsx)(NT,{variant:`ghost`,onClick:a,children:`Cancel`})]}):(0,X.jsx)(u0,{model:c,"aria-label":`New conversation`,footer:(0,X.jsxs)(IK,{divider:!1,error:c.error,children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:l||i,onClick:a,children:`Cancel`}),(0,X.jsx)(NT,{type:`submit`,loading:l||i,disabled:!u||l||i,children:`Start`})]})})]})})}var I0=J.useLayoutEffect;function L0(e,t,n){J.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function R0(e){let t=J.useRef(null);return J.useImperativeHandle(e,()=>t.current,[]),t}function z0(e){return e[e.length-1]}function B0(e){return typeof e==`function`}function V0(e,t){return B0(e)?e(t):e}var H0=Object.prototype.hasOwnProperty,U0=Object.prototype.propertyIsEnumerable;function W0(e){for(let t in e)if(H0.call(e,t))return!0;return!1}var G0=()=>Object.create(null),K0=(e,t)=>q0(e,t,G0);function q0(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Z0(e)&&Z0(i);if(!a&&!(Y0(e)&&Y0(i)))return i;let o=a?e:J0(e);if(!o)return i;let s=a?i:J0(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:H0.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=q0(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function J0(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!U0.call(e,r))return!1;t.push(r)}return t}function Y0(e){if(!X0(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!X0(n)||!n.hasOwnProperty(`isPrototypeOf`))}function X0(e){return Object.prototype.toString.call(e)===`[object Object]`}function Z0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Q0(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Q0(e[r],t[r],n))return!1;return!0}if(Y0(e)&&Y0(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Q0(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Q0(e[o],t[o],n)))return!1;return i===a}return!1}var $0=/[\x00-\x1f\x7f"<>`{}]/g;function e2(e){return e.replace($0,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function t2(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return e2(t)}var n2=[`http:`,`https:`,`mailto:`,`tel:`];function r2(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function i2(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=t2(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=t2(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function a2(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function o2(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function s2(){throw Error(`Invariant failed`)}function c2(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var l2=4,u2=5;function d2(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function f2(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=d2(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function p2(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=f2(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=h2(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=g2(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=h2(r);e.kind=u2,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=h2(r);e.kind=l2,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)p2(e,t,r,c,i,a,o,s)}function m2(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function h2(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function g2(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function _2(e,t){let n=h2(`/`),r=new Uint16Array(6),i=[];for(let t of e)p2(!1,r,t,1,n,0,i);for(let e of i)e.sort(m2);t.masksTree=n,t.flatCache=c2(1e3)}function v2(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=C2(e,t.masksTree);return t.flatCache.set(e,r),r}function y2(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=h2(`/`),p2(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),C2(r,o,n)}function b2(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=C2(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=T2(a.route)),t.matchCache.set(r,a),a}function x2(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function S2(e,t=!1,n){let r=h2(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;p2(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&s2(),o[e.id]=e,c!==0&&e.path){let t=x2(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(m2);return{processedTree:{segmentTree:r,singleCache:c2(1e3),matchCache:c2(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function C2(e,t,n=!1){let r=e.split(`/`),i=D2(e,r,t,n);if(!i)return null;let[a]=w2(e,r,i);return{route:i.node.route,rawParams:a}}function w2(e,t,n){let r=E2(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===l2)break;if(u.kind===u2){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function T2(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function E2(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function D2(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!z0(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!j2(l,n))continue;if(i.parse){if(!A2(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==l2&&j2(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===l2||i.kind===2)&&j2(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(A2(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&k2(f,o))return n;j2(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+O2(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+O2(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+O2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+O2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function O2(e,t){return 2**(e-t-1)}function k2(e,t){return e===2**(t-1)-1}function A2(e,t,n){let r,i;try{[r,i]=w2(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function j2(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===l2)>(e.node.kind===l2)||t.node.kind===l2==(e.node.kind===l2)&&t.node.depth>e.node.depth)))}function M2(e){return N2(e.filter(e=>e!==void 0).join(`/`))}function N2(e){return e.replace(/\/{2,}/g,`/`)}function P2(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function F2(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function I2(e){return F2(P2(e))}function L2(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function R2(e,t,n){return L2(e,n)===L2(t,n)}function z2({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t===`.`,a=t.startsWith(`/`),o;if(r){o=a?t:i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else if(a)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&z0(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(z0(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=N2(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function B2(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function V2(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>U2(e,n)).join(`/`):U2(r,n):r}function H2({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=f2(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=V2(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=V2(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=V2(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function U2(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function W2(e){return e?.isNotFound===!0}function G2(){try{return sessionStorage}catch{return}}var K2=`tsr-scroll-restoration-v1_3`,q2=G2();function J2(){try{return JSON.parse(q2?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Y2(){try{q2?.setItem(K2,JSON.stringify(X2))}catch{}}var X2=J2(),Z2=`data-scroll-restoration-id`,Q2=e=>e.state.__TSR_key||e.href;function $2(e){let t=e.getAttribute(Z2);if(t)return`[${Z2}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var e4=!1,t4=`window`;function n4(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function r4(e){let t=new Set;for(let n of e){if(n===t4)continue;let e=n4(n);e&&t.add(e)}return t}function i4(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Q2,a=new Set,o=e=>{let t=X2[e]||={};for(let e of a)e===document?t[t4]={scrollX,scrollY}:e.isConnected&&(t[$2(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,e4=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{e4||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Y2()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=X2[d];if(e){let t=X2[u];for(let n in e){if(n===t4){if(s)continue}else{let e=n4(n);if(!e||s&&o&&(l??=r4(o),l.has(e)))continue}t||=X2[u]={},t[n]??=e[n]}}}e4=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=r4(o));let t=e&&i&&c,s=r.restoring?X2[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===t4){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=n4(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{e4=!1}}))}function a4(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function o4(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function s4(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=o4(r):Array.isArray(t)?t.push(o4(r)):n[e]=[t,o4(r)]}return n}var c4=/^(?:\s|["[{\d-]|fa|nu|tr)/,l4=d4(JSON.parse),u4=f4(JSON.stringify,JSON.parse);function d4(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=s4(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function f4(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!c4.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=a4(e,r);return t?`?${t}`:``}}var p4=`__root__`;function m4(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function h4(e){return e instanceof Response&&!!e.options}function g4(e){return{input:({url:t})=>{for(let n of e)t=v4(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=y4(e[n],t);return t}}}function _4(e){let t=I2(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=M2([`/`,t,e.pathname]),e)}}function v4(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function y4(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function b4(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{o2(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var x4=`__TSR_index`,S4=`popstate`,C4=`beforeunload`;function w4(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=k4(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[x4];i=T4(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[x4];i=T4(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[x4]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function T4(e,t){t||={};let n=A4();return{...t,key:n,__TSR_key:n,[x4]:e}}function E4(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>k4(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=A4();t.history.replaceState({[x4]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=k4(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[x4]-l.state[x4],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=w4({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(C4,x,{capture:!0}),t.removeEventListener(S4,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(C4,x,{capture:!0}),t.addEventListener(S4,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function D4(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,r=t.map((e,t)=>T4(t,void 0)),i=()=>k4(t[n],r[n]),a=[];return w4({getLocation:i,getLength:()=>t.length,pushState:(e,i)=>{n<t.length-1&&(t.splice(n+1),r.splice(n+1)),r.push(i),t.push(e),n=Math.max(t.length-1,0)},replaceState:(e,i)=>{r[n]=i,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:e=>e,getBlockers:()=>a,setBlockers:e=>a=e})}function O4(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function k4(e,t){let n=O4(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=A4();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[x4]:0,key:a,__TSR_key:a}}}function A4(){return(Math.random()+1).toString(36).substring(7)}function j4(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function M4(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function N4({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function P4(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var F4=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=B2(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:E4()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=c2(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=b4(this.latestLocation,e),i4(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=I2(a);t&&t!==`/`&&e.push(_4({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:g4(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=S2(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&_2(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:i2(e).path,external:!1,searchStr:o,search:K0(t?.search,i),hash:i2(r.slice(1)).path,state:q0(t?.state,a)}}let o=new URL(i,this.origin),s=v4(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:i2(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:K0(t?.search,c),hash:i2(s.hash.slice(1)).path,state:q0(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>z2({base:e,to:t.includes(`//`)?N2(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=b2(F2(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=t.to?`${t.to}`:void 0,o=r[2],s=Object.assign(Object.create(null),r[3]),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=V4(t.params,s),d=this.routesByPath[F2(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let[e,t,n]=this.getMatchedRoutes(l);f=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&W0(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:i2(H2({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,R4(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=z4(m,t,f,e._includeValidateSearch),m=K0(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?V0(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?V0(t.state,n.state):{};v=q0(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=y4(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=a2(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=v2(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=V4(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=F2(this.latestLocation.href)===F2(n.href)&&Q0(N4(n.state),N4(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=k4(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=v4(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(r2(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await N3(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(M4(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&j4(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=(e.options._builtLocation??this.buildLocation(e.options)).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&r2(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=G4,this.preloadRoute=e=>P3(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=y2(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Q0(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Q0(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??u4,parseSearch:e.parseSearch??l4,protocolAllowlist:e.protocolAllowlist??n2}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=T2(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:F2(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?B4(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=R4(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof I4||(r=new I4(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=H2({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),v=i.id+g+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(_,d);let x;if(!b)try{H4(i,d)}catch(e){if(x=W2(e)||h4(e)?e:new L4(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:K0(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=j4(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:g,updatedAt:Date.now(),search:y?K0(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?q0(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?K0(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=z0(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=z0(a),c={...e.search};for(let e of a)try{Object.assign(c,R4(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{H4(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},I4=class extends Error{},L4=class extends Error{};function R4(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new I4(`Async validation not supported`);if(n.issues)throw new I4(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function z4(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=R4(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=V0(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function B4(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return p4}function V4(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,V0(e,t))}function H4(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function U4(e,t){return e.options[t]?.preload?.()}function W4(e,t){let n=U4(e,`component`),r=U4(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function G4(e,t,n){let r=()=>t===!1?void 0:t?U4(e,t):W4(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function K4(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var q4=0,J4=1,Y4=2,X4=3,Z4=4;function Q4(e){return typeof e[0]==`number`}function $4(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function e3(e,t){return e.routesById[t.routeId]}function t3(e,t,n){return h4(e)?[X4,e]:W2(e)?(e.routeId||=n,[Y4,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[J4,e]:[q4,e])}function n3(e,t){let n=t3(t,!0,e.id);if(n[0]!==J4)return n;try{e.options.onError?.(n[1])}catch(t){n=t3(t,!0,e.id)}return n}function r3(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[Z4]):n3(e,t)}function i3(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function a3(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[4];for(let t=n[7]??0;t<r;t++){let r=s[t],i=e3(e,r);r.abortController=n[0];let u=s[t-1]?.context??e.options.context??{},d={params:r.params,location:o,navigate:i3(e,o),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:i.id},f=u;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...d,deps:r.loaderDeps,context:u})||{}),f={...u,...e},r.context=f}catch(a){return s3(e,r),[t,r3(i,a,n)]}if(c.aborted||!n[2]())return n[0].abort(),[t,[Z4]];let p=r.paramsError??r.searchError;if(p!==void 0)return s3(e,r),[t,r3(i,p,n)];let m=i.options.beforeLoad;if(!m)continue;let h={...d,search:r.search,context:f,...e.options.additionalContext},g=r.status;g===`success`&&t>=a&&(r.status=`pending`),n[8]?.();try{u3(e,r,`beforeLoad`,n[0]);let a=await $4(m(h),c);if(!n[2]())return n[0].abort(),[t,[Z4]];let o=t3(a,!1,i.id);if(o[0]!==q4)return s3(e,r),[t,o];r.context={...f,...a}}catch(a){return s3(e,r),[t,r3(i,a,n)]}finally{g===`success`&&r.status===`pending`&&(r.status=`success`),u3(e,r,!1,n[0])}}i()}function o3(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function s3(e,t){let n=t._flight;t._flight=void 0,o3(e,t,n)?.abort()}function c3(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=o3(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function l3(e){for(let t of e){let e=t._flight;e&&e[2]++}}function u3(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function d3(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:i3(e,s),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function f3(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[Z4];if(!i)return[q4,void 0];let l=n._flight;u3(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(d3(e,t,n,r,s,a,o))).then(e=>t3(e,!1,r.id),e=>t3(e,!0,r.id)).then(t=>(t[0]!==q4&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===J4&&l[2]?n3(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await $4(l[0],c)}catch(t){if(t!==c)throw t;return s3(e,n),[Z4]}finally{u3(e,n,!1,s)}}function p3(e,t,n){t[0]===q4?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==X4&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function m3(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&s3(e,r)}function h3(e,t){return t[0]===J4||t[0]===Y4?{...e,status:t[0]===J4?`error`:`notFound`,error:t[1],_flight:void 0}:e}function g3(e,t,n,r,i,a,o){let s=t[1][n],c=e3(e,s),l=!!a[4],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(d3(e,t,s,c,a[0],i,l))),a[2]()||(a[0].abort(),p=[Z4])),!p){if(s.status!==`success`)f=!0;else{let t=a[4]||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[6]||s.cause===`enter`||a[3].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(t){s.invalid=!0,s3(e,s),p=r3(c,t,a)}let m=c.options.loader,h=typeof m==`function`?m:m?.handler,g=(!l||c.options.preload!==!1)&&m?e._flights?.get(s.id):void 0;g===s._flight||p?g=void 0:g&&!f&&!l&&d===void 0?f=!0:f||(g=void 0);let _=!!(m&&f&&s.status===`success`&&!l&&!a[5]&&((typeof m==`function`?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),v=f&&(!l||c.options.preload!==!1),y=v&&!_&&(s.status!==`success`||!!m),b=c.lazyFn&&c._lazy!==!0?a[8]:void 0;if(v&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),g&&g[2]++,y){let t=s._flight;s._flight=g,o3(e,s,t)?.abort(),s.status===`success`&&n>=o&&(s.status=`pending`),a[8]?.()}v||(s.isFetching=!1);let x=(p?Promise.resolve(p):y?f3(e,t,s,c,h,i,l,a[0]):Promise.resolve([q4,s.loaderData])).then(t=>(y&&(p3(s,t,l),t[0]===q4&&(m&&!a[0].signal.aborted&&m3(e,s,u),s.status=`pending`)),t)),S=$4(Promise.resolve().then(()=>G4(c,void 0,b)),a[0].signal).then(()=>void 0,e=>[n,r3(c,e,a)]).then(e=>x.then(t=>(y&&!e&&t[0]===q4&&s.status===`pending`&&a[2]()&&(s.status=`success`,a[8]?.()),e)));if(r.push([n,x,S]),!_)return x.then(e=>h3(s,e));let C={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let w=f3(e,t,C,c,h,i,!1,a[0]).then(e=>(s.isFetching=!1,p3(C,e,!1),e));return(t[2]??=[]).push([n,w,S,C]),w.then(e=>h3(C,e))}async function _3(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=e3(e,t[n]),a=G4(i,!1);if(a)try{await $4(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function v3(e,t){t[2]&&=(c3(e,t[2].map(e=>e[3])),void 0)}async function y3(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=X4)throw[a,t];!i&&t[0]!==q4&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===X4)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function b3(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Y4?_3(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=X4)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==q4&&t[0]<X4&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=X4){let n=c[1];if(n[0]!==X4||n[1].options.reloadDocument||i<20)return v3(e,t),n;l=!0,c=[0,[J4,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===J4?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};f();let m=e3(e,u);try{await $4(i?Promise.resolve().then(()=>G4(m,a===J4?`errorComponent`:`notFoundComponent`)):Promise.all([G4(m),G4(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return v3(e,t),[Z4]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),v3(e,t),c3(e,s),f()):(u.status=`success`,o?.())}return t}async function x3(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=e3(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await $4(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function S3(e,t,n,r){let i=[t,n],a=e.stores.matches.get(),o=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&o>=0){let t=await _3(e,i[1],void 0,r[0].signal,o);t!==o&&(n[o]._notFound=void 0,n[t]._notFound=!0),o=t}let s=o<0?n.length:o+1,c=0;for(;c<s&&c!==o;){let e=n[c],t=r[3][c],i=a[c];if(t?.id!==e.id||t.status!==`success`||t._notFound||e.preload||i?.id!==e.id||i.status!==`success`||i._notFound)break;c++}let l=[],u=r[7]??0,d=u?Promise.resolve(i[1][u-1]):void 0,f=()=>{for(let t=u;t<s&&!r[0].signal.aborted;t++)d=g3(e,i,t,l,d,r,c)},p=await a3(e,i,r,s,f,c);if(p&&(r[5]=!0,s=p[0],p[1][0]===Y4?(p[2]=await _3(e,i[1],p,r[0].signal),s=Math.min(s,p[2]+1)):p[1][0]>=X4&&(s=0),f()),r[2]()&&!r[4]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let m;try{let t=b3(e,i,l,r[0],r[1],y3(l,p,i[2]),r[8]);i[2]?.length&&(i[3]=y3(i[2],void 0,void 0,t.then(e=>Q4(e)?0:K4(e[1]).length,()=>0))),m=await t}catch(t){throw v3(e,i),t}return Q4(m)?m:x3(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function C3(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=t[3],o=e.stores.matches.get(),s=-1,c,l,u,d=!1;for(let t=0;t<a.length;t++){let n=a[t],r=n.status===`success`;if(d=o[t]?.id===n.id&&o[t]?.status===`pending`,r&&!d)continue;let i=e3(e,n);if(c=r&&d||n.invalid?0:i.options.pendingMs??e.options.defaultPendingMs,u=i.options.pendingComponent??e.options.defaultPendingComponent,!u||typeof c!=`number`||c===1/0)return;s=t,l=i.options.pendingMinMs??e.options.defaultPendingMinMs??0;break}if(s<0)return;let f=a[s].id;if((!n||n[1]!==s||i!==f)&&(clearTimeout(n?.[3]),e._pending=n=[t,s,d?Date.now()+l:t[4]+c,void 0,d?Promise.resolve(!0):void 0,u]),n[4]&&!r&&n[5]===u)return;if(n[5]=u,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>C3(e,t),r);return}n[2]=0}let p=a.map(e=>({...e,_flight:void 0}));p[s].status=`pending`;let m=e.startTransition(()=>e.stores.setMatches(p),p).then(t=>(t&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+l),t));n[4]=m}function w3(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function T3(e,t){e._committed=t,e.stores.setMatches(t)}function E3(e,t){c3(e,t[1]),v3(e,t)}function D3(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=K4(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=e3(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,T3(e,n),c3(e,[...a.values(),...i],[...n,...s.values()]),P4(e,i,n,()=>e._tx===t)}async function O3(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function k3(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function A3(e,t){w3(e,t),t[0].abort(),c3(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function j3(e,t,n,r,i){let a=n.map(e=>({...e}));l3(a);for(let t of r)s3(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await b3(e,o,r,t[0],t[1],i)}catch(t){throw c3(e,a),t}if(Q4(s)){c3(e,a),s[0]===X4&&e._tx===t&&e._committed===n&&await k3(e,t,s[1]);return}let c=await x3(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){c3(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),s3(e,n))}T3(e,c[1]),c3(e,n,c[1])}async function M3(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await S3(e,t[2],t[3],o);if(Q4(s)){s[0]===X4&&e._tx===t?(w3(e,t),c3(e,t[3]),t[3]=[],e._tx===t&&await k3(e,t,s[1])):A3(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await $4(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await $4(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){w3(e,t),E3(e,s);return}let l=t[2],u=M4(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){E3(e,s);return}let n=await e.startTransition(()=>{w3(e,t),D3(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){v3(e,s);return}d?.length&&j3(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function N3(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await O3(e,n);return}let f=M4(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await O3(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),l3(m)}catch(t){if(u.abort(),!h4(t)){await O3(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await O3(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){c3(e,m),await O3(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>M3(e,_,p,()=>C3(e,_),t?.sync,g)).catch(()=>{e._tx===_&&A3(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&u3(e,t,!1)}n[0].abort(),c3(e,n[3],_[3],!0)}if(e._tx!==_){c3(e,_[3]),_[3]=[],await O3(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),!r&&!m.some(e=>e._notFound)&&C3(e,_);try{await _[5]}finally{await O3(e,_)}}async function P3(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),l3(o)}catch(e){a.abort(),W2(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await S3(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),c3(e,o),a.abort()}if(!Q4(t))return t[1];if(s&&t[0]===X4&&!t[1].options.reloadDocument)return P3(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){W2(e)||console.error(e)}}var F3=`Error preloading route! ☝️`,I3=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=p4:this.parentRoute||s2();let r=n?p4:t?.path;r&&r!==`/`&&(r=P2(r));let i=t?.id||r,a=n?p4:M2([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=M2([`/`,a]));let o=a===`__root__`?`/`:M2([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=F2(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>m4({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},L3=class extends I3{constructor(e){super(e)}};function R3(e){return(0,X.jsx)(z3,{...e})}var z3=class extends J.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?J.createElement(this.props.errorComponent??B3,{error:e,reset:this.reset}):this.props.children}};function B3({error:e}){let[t,n]=J.useState(!1);return(0,X.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,X.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,X.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,X.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,X.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,X.jsx)(`div`,{children:(0,X.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,X.jsx)(`code`,{children:e.message}):null})}):null]})}function V3({children:e,fallback:t=null}){return(0,X.jsx)(J.Fragment,{children:H3()?e:t})}function H3(){return J.useSyncExternalStore(U3,()=>!0,()=>!1)}function U3(){return()=>{}}var W3=J.createContext(null);function G3(e){return J.useContext(W3)}var K3=J.createContext(void 0),q3=J.createContext(void 0),J3=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(J3||{});function Y3({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function X3(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Z3=[],Q3=0,{link:$3,unlink:e6,propagate:t6,checkDirty:n6,shallowPropagate:r6}=Y3({update(e){return e._update()},notify(e){Z3[a6++]=e,e.flags&=~J3.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=J3.Mutable|J3.Dirty,l6(e))}}),i6=0,a6=0,o6,s6=0;function c6(e){try{++s6,e()}finally{--s6||u6()}}function l6(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=e6(n,e)}function u6(){if(!(s6>0)){for(;i6<a6;){let e=Z3[i6];Z3[i6++]=void 0,e.notify()}i6=0,a6=0}}function d6(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?J3.None:J3.Mutable,get(){return o6!==void 0&&$3(i,o6,Q3),i._snapshot},subscribe(e){let t=X3(e),n={current:!1},r=f6(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=o6,o=t?.compare??Object.is;if(n)o6=i,++Q3,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=J3.Mutable|J3.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{o6=a,n&&(i.flags&=~J3.RecursedCheck),l6(i)}}};return n?(i.flags=J3.Mutable|J3.Dirty,i.get=function(){let e=i.flags;if(e&J3.Dirty||e&J3.Pending&&n6(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&r6(e)}}else e&J3.Pending&&(i.flags=e&~J3.Pending);return o6!==void 0&&$3(i,o6,Q3),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(t6(e),r6(e),u6())}},i}function f6(e){let t=()=>{let t=o6;o6=n,++Q3,n.depsTail=void 0,n.flags=J3.Watching|J3.RecursedCheck;try{return e()}finally{o6=t,n.flags&=~J3.RecursedCheck,l6(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:J3.Watching|J3.RecursedCheck,notify(){let e=this.flags;e&J3.Dirty||e&J3.Pending&&n6(this.deps,this)?t():this.flags=J3.Watching},stop(){this.flags=J3.None,this.depsTail=void 0,l6(this)}};return t(),n}var p6=t((e=>{var t=dr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),m6=t(((e,t)=>{t.exports=p6()})),h6=t((e=>{var t=dr(),n=m6();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),g6=t(((e,t)=>{t.exports=h6()}))();function _6(e,t){return e===t}function v6(e,t,n=_6){let r=(0,J.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,J.useCallback)(()=>e?.get(),[e]);return(0,g6.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var y6={};function b6(e,t){let n=J.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=q0(n.current,i):i}}function x6(e){let t=G3(),n=J.useContext(e.from?q3:K3),r=e.from??n,i=t.stores.getMatchStore(r),a=b6(e,t),o=v6(i,e=>e?a(e):y6);if(o!==y6)return o;(e.shouldThrow??!0)&&s2()}function S6(e){return x6({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function C6(e){let{select:t,...n}=e;return x6({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function w6(e){return x6({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function T6(e){return x6({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function E6(e){let t=G3();return J.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function D6(e){return x6({...e,select:t=>e.select?e.select(t.context):t.context})}function O6(e){let t=J.useRef(e);return Q0(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function k6(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function A6(e,t,n){if(e?.external)return r2(e.href,n)?void 0:e.href;if(!V6(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),r2(t,n)?void 0:t}catch{}}function j6(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!R2(e.pathname,t.pathname,r))return!1}else{let n=L2(e.pathname,r),i=L2(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!Q0(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function M6(e,t){let n=G3(),r=R0(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:ee,...I}=e,te=H3(),ne=O6(e.search),re=O6(e.params),ie=O6(o),L=J.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ne,re,e.state,e.mask,e.unsafeRelative]),ae=J.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...L}),r=B6(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=A6(r,s,n.protocolAllowlist);return[r?.href,i,j6(e,t,ie,n.basepath,te,i!==void 0)]},[ie,v,te,L,n,s]),[oe,R,se]=v6(n.stores.location,ae,k6),ce=se?V0(i,{})??P6:N6,le=se?N6:V0(a,{})??N6,z=[b,ce.className,le.className].filter(Boolean).join(` `),ue=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},de=J.useRef(!1),fe=e.reloadDocument||R||v?!1:c??n.options.defaultPreload,pe=l??n.options.defaultPreloadDelay??0,me=J.useCallback(()=>{n.preloadRoute(L).catch(e=>{console.warn(e),console.warn(F3)})},[n,L]),B=J.useCallback(e=>{if(!e){R6(r);return}if(!(e.isIntersecting??fe===`intent`)){e.isIntersecting===!1&&R6(r);return}if(!pe){me();return}L6.has(r)||L6.set(r,setTimeout(()=>{L6.delete(r),me()},pe))},[me,r,fe,pe]);L0(r,B,fe!==`viewport`),J.useEffect(()=>{de.current||fe===`render`&&(me(),de.current=!0)},[me,fe]);let he=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!U6(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...L,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(R)return{...I,ref:r,href:R,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ge=()=>{fe===`intent`&&me()},_e=()=>{fe===`intent`&&R6(r)};return{...I,...ce,...le,href:oe,ref:r,onClick:z6([x,he]),onBlur:z6([S,_e]),onFocus:z6([C,B]),onMouseEnter:z6([w,B]),onMouseLeave:z6([T,_e]),onTouchStart:z6([E,ge]),disabled:!!v,target:_,...ue&&{style:ue},...z&&{className:z},...v&&F6,...se&&I6}}var N6={},P6={className:`active`},F6={role:`link`,"aria-disabled":!0},I6={"data-status":`active`,"aria-current":`page`},L6=new WeakMap,R6=e=>{clearTimeout(L6.get(e)),L6.delete(e)},z6=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function B6(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function V6(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var H6=J.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=M6(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return J.createElement(`a`,t,o)}return J.createElement(n,a,o)});function U6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var W6=class extends I3{constructor(e){super(e),this.useMatch=e=>x6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>D6({...e,from:this.id}),this.useSearch=e=>T6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>w6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>C6({...e,from:this.id}),this.useLoaderData=e=>S6({...e,from:this.id}),this.useNavigate=()=>E6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(H6,{ref:t,from:this.fullPath,...e}))}};function G6(e){return new W6(e)}var K6=class extends L3{constructor(e){super(e),this.useMatch=e=>x6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>D6({...e,from:this.id}),this.useSearch=e=>T6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>w6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>C6({...e,from:this.id}),this.useLoaderData=e=>S6({...e,from:this.id}),this.useNavigate=()=>E6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(H6,{ref:t,from:this.fullPath,...e}))}};function q6(e){return new K6(e)}function J6(e){let t=G3(),n=`not-found-${v6(t.stores.location,e=>e.pathname)}-${v6(t.stores.status,e=>e)}`;return(0,X.jsx)(R3,{getResetKey:()=>n,onCatch:(t,n)=>{if(W2(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(W2(t))return e.fallback?.(t);throw t},children:e.children})}function Y6(){return(0,X.jsx)(`p`,{children:`Not Found`})}function X6(e){return(0,X.jsx)(X.Fragment,{children:e.children})}function Z6(e,t,n){return t.options.notFoundComponent?(0,X.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,X.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,X.jsx)(Y6,{})}function Q6(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,X.jsx)(n,{}):null}var $6=(e,t)=>e[0]===t[0]&&e[1]===t[1],e8=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,t8=J.memo(function({routeId:e}){let t=G3();return(0,X.jsx)(n8,{router:t,match:v6(t.stores.getMatchStore(e),e=>e)})});function n8({router:e,match:t}){let n=e.routesById[t.routeId],r=Q6(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=e8(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?J.Suspense:X6,l=i?R3:X6,u=o?J6:X6;return(0,X.jsxs)(n.isRoot?n.options.shellComponent??X6:X6,{children:[(0,X.jsx)(K3.Provider,{value:t.routeId,children:(0,X.jsx)(c,{fallback:r,children:(0,X.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(W2(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,X.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return J.createElement(o,e)},children:s?(0,X.jsx)(V3,{fallback:r,children:(0,X.jsx)(r8,{match:t})}):(0,X.jsx)(r8,{match:t})})})})}),null]})}var r8=J.memo(function({match:e}){let t=G3(),n=e.routeId,r=t.routesById[n],i=J.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=J.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,X.jsx)(e,{},i):(0,X.jsx)(i8,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!e8(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Q6(t,r)}if(e.status===`notFound`)return Z6(t,r,e.error);if(e.status===`error`)throw e.error;return a}),i8=J.memo(function(){let e=G3(),t=J.useContext(K3),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=v6(a,e=>[!!e._notFound,e.error],$6),i=v6(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Z6(e,e.routesById[t],r);if(!i)return null;let a=(0,X.jsx)(t8,{routeId:i});return t===`__root__`?(0,X.jsx)(J.Suspense,{fallback:Q6(e),children:a}):a});function a8(e,t){let n=e[1];e.length=0,n?.(t)}function o8({t:e}){let t=G3(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{a8(n,!1),n.push(i,a),e(t),J.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),I0(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(F2(r.publicHref)!==F2(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...M4(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function s8(){let e=G3(),t=e.routesById[p4],n=Q6(e,t),r=e.ssr?X6:J.Suspense,i=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o8,{t:J.useState()[1]}),(0,X.jsx)(r,{fallback:n,children:(0,X.jsx)(c8,{})})]});return e.options.InnerWrap?(0,X.jsx)(e.options.InnerWrap,{children:i}):i}function c8(){let e=G3(),t=e._rendered,n=v6(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;I0(()=>{t[0]===n&&a8(t,!0)},[t,n]);let a=i?(0,X.jsx)(t8,{routeId:i}):null;return(0,X.jsx)(K3.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,X.jsx)(R3,{getResetKey:()=>r,onCatch:void 0,children:a})})}var l8=e=>({createMutableStore:d6,createReadonlyStore:d6,batch:c6}),u8=e=>new d8(e),d8=class extends F4{constructor(e){super(e,l8)}};function f8({router:e,children:t,...n}){W0(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,X.jsx)(W3.Provider,{value:e,children:t});return e.options.Wrap?(0,X.jsx)(e.options.Wrap,{children:r}):r}function p8({router:e,...t}){return(0,X.jsx)(f8,{router:e,...t,children:(0,X.jsx)(s8,{})})}function m8(e){let t=G3({warn:e?.router===void 0}),n=e?.router||t;return v6(n.stores.__store,b6(e,n))}function h8(){return v6(G3().stores.location,e=>e.state.__TSR_index!==0)}var g8=(0,J.createContext)(null),_8=g8.Provider,v8=q6({validateSearch:Ze({agent:V().min(1).optional()}),component:()=>null}),y8=G6({getParentRoute:()=>v8,path:`/`}),b8=G6({getParentRoute:()=>v8,path:`/sessions/$agentId/$sessionId`,params:{parse:e=>Ze({agentId:V().min(1),sessionId:V().min(1)}).parse(e)}});function x8(){return u8({routeTree:v8.addChildren([y8,b8]),history:D4(),InnerWrap:({children:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,J.useContext)(g8),e]}),defaultPendingMs:0,defaultPendingMinMs:0})}function S8(e,t){let n=m8({router:e,select:e=>e.location.search}),r=x6({from:b8.id,shouldThrow:!1});Rm(t,{canGoBack:h8(),onBack:()=>e.history.canGoBack()?(e.history.back(),!0):!1});let i=(0,J.useCallback)(t=>{e.navigate({to:`.`,search:{agent:t??void 0},replace:!0})},[e]),a=(0,J.useCallback)((t,n)=>{e.navigate({to:`/sessions/$agentId/$sessionId`,params:{agentId:t,sessionId:n},search:!0})},[e]);return{agentFilterId:n.agent??null,setFilter:i,selection:r?.params,open:a}}var C8=Ln.check(In(1,{message:`Give your Agent a name.`}),G(256,{message:`Use at most 256 characters.`}));function w8({agentId:e,name:t,rename:n}){let[r,i]=(0,J.useState)(!1),a=o0({schema:(0,J.useMemo)(()=>H({name:C8.annotate(N1({label:`Agent name`,render:e=>(0,X.jsx)(qG,{id:e.id,name:e.name,"aria-label":`Agent name`,"aria-invalid":e[`aria-invalid`],"aria-describedby":e[`aria-describedby`],autoFocus:!0,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})}))}),[]),defaultValues:{name:t},onSubmit:async({name:r})=>r===t||await n(e,r)?(i(!1),{kind:`saved`,values:{name:r}}):{kind:`refused`}}),{submitting:o,canSubmit:s}=s0(a);return r?(0,X.jsxs)(u0,{model:a,"aria-label":`Rename Agent`,footer:null,className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(O1,{model:a,names:[`name`]})}),(0,X.jsx)(NT,{type:`submit`,size:`sm`,loading:o,disabled:o||!s,children:`Save`}),(0,X.jsx)(AG,{"aria-label":`Cancel rename`,type:`button`,icon:(0,X.jsx)(cW,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!1)}})]}):(0,X.jsx)(AG,{"aria-label":`Rename Agent`,icon:(0,X.jsx)(tW,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!0)}})}function T8({status:e,approving:t,onApprove:n}){return e?.status===`pending`?(0,X.jsx)(NT,{variant:`outline`,size:`sm`,className:`flex-none`,loading:t,disabled:t,onClick:n,children:`Allow App tools`}):null}var E8=H({text:W}),D8=_r(structuredClone(pn(E8,{onExcessProperty:`error`}).schema));function O8(e){return[{id:`new-conversation`,title:`New conversation`,category:`Conversation`,description:`Start a new conversation with this Agent`,projections:{slash:{aliases:[`new`],order:20},palette:{}},handler:()=>{e().newConversation()}},{id:`permissions`,title:`App permissions`,category:`Conversation`,description:`Review what Grove may access`,projections:{slash:{aliases:[`permissions`],order:21},palette:{}},handler:()=>{e().openPermissions()}},{id:`set-draft`,title:`Set draft`,category:`Conversation`,description:`Replace the open writable Grove conversation's draft without sending it`,projections:{agent:{}},action:{inputSchema:D8,presentation:{type:`action`}},handler:({arguments:t})=>{let{text:n}=Hn(E8,{onExcessProperty:`error`})(t);return{accepted:e().setDraft(n)}}}]}function k8(e,t){let n=(0,J.useRef)(e);n.current=e;let r=(0,J.useMemo)(()=>O8(()=>n.current),[]),i=(0,J.useMemo)(()=>Jr(),[]);return(0,J.useEffect)(()=>{let e=i.contribute({sourceId:`grove`,namespace:`grove`,commands:r});return()=>{e.dispose()}},[r,i]),(0,J.useEffect)(()=>t?Ui(t,r):void 0,[r,t]),i}function A8(e){let t=$i(),n=e?.capabilities.has(cg)===!0||e?.capabilities.has(lg)===!0,r=Zy(n?e:null),i=e&&!n?{...r,status:`live`}:r,a=qy.of(e,`agents`),o=Oo({...Xy(e,Zh,a,e=>e.list()),enabled:e?.capabilities.has(Zh)===!0}),s=new Set(o.data?.map(e=>e.agentId)),c=o.isSuccess?JSON.stringify([...new Set(i.items.filter(e=>!(`kind`in e)).map(e=>e.agentId))].filter(e=>!s.has(e)).sort()):`[]`,{refetch:l}=o;return(0,J.useEffect)(()=>{c!==`[]`&&i.items.length>0&&l()},[c,i.items,l]),{directory:o,inbox:i,createAgent:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return ug(e.capabilities,t)},onMutate:()=>({directoryKey:a}),onSuccess:(e,n,r)=>{t.setQueryData(r.directoryKey,(t=[])=>t.some(t=>t.agentId===e.agentId)?t:[...t,e])}}),renameAgent:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return tg(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}}),setAgentAvatar:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return ig(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}})}}function j8(e,t){let n=$i(),r=e?.capabilities.has(sg)===!0,i=qy.of(e,`agent-tool-policy`,t??`none`);return{canRead:r,status:Oo({...Xy(e,sg,i,e=>t===null?Promise.resolve(null):e.status({agentId:t})),enabled:r&&t!==null}),approve:jo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return e.capabilities.require(sg).approve({agentId:t.agentId,level:`write`,expectedRevision:t.expectedRevision})},onSuccess:e=>{`error`in e||n.setQueryData(i,e)}})}}function M8({agentId:e,name:t,avatar:n,setAvatar:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),c=(0,X.jsx)(EX,{avatar:n,name:t,size:24});return r===void 0?(0,X.jsx)(`span`,{className:`flex-none`,children:c}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,"aria-label":`Change avatar`,className:`flex-none p-0`,onClick:()=>{a(n)},children:c}),(0,X.jsx)(kU,{open:i!==null,onOpenChange:e=>{!e&&!o&&a(null)},children:(0,X.jsxs)(PU,{className:`flex flex-col gap-lg`,keepMounted:!1,children:[(0,X.jsxs)(IU,{children:[(0,X.jsxs)(LU,{children:[t,`'s avatar`]}),(0,X.jsxs)(RU,{children:[`Every conversation with `,t,` shows this look.`]})]}),i===null?null:(0,X.jsx)(O0,{value:i,disabled:o,onChange:a}),(0,X.jsxs)(FU,{children:[(0,X.jsx)(NT,{type:`button`,variant:`ghost`,disabled:o,onClick:()=>{a(null)},children:`Cancel`}),(0,X.jsx)(NT,{type:`button`,variant:`primary`,loading:o,disabled:o||i===null,onClick:()=>{i!==null&&(s(!0),r(e,i).then(e=>{s(!1),e&&a(null)}))},children:`Save`})]})]})})]})}var N8=(0,J.forwardRef)(function({className:e,orientation:t,variant:n=`grip`,value:r,min:i,max:a,onValueChange:o,onKeyDown:s,...c},l){return(0,X.jsx)(`div`,{...c,ref:l,className:Q(`caps-resize-handle`,e),"data-resize-variant":n,role:`separator`,"aria-orientation":t,"aria-valuemin":Math.round(i),"aria-valuemax":Math.round(a),"aria-valuenow":Math.round(r),tabIndex:c.tabIndex??0,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;if(e.key===`Home`||e.key===`End`){e.preventDefault(),o(e.key===`Home`?i:a);return}let n=t===`horizontal`?e.key===`ArrowUp`?-32:e.key===`ArrowDown`?32:null:e.key===`ArrowLeft`?-32:e.key===`ArrowRight`?32:null;n!==null&&(e.preventDefault(),o(Math.min(a,Math.max(i,r+n))))},children:(0,X.jsx)(`span`,{className:`caps-resize-grip`,"aria-hidden":`true`})})});$({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map});function P8(e,t=!0,n){let r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(null);return(0,J.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,J.useEffect)(()=>{let e=()=>{i.current?.release(!0)};return n?.addEventListener(`abort`,e),()=>{n?.removeEventListener(`abort`,e)}},[n]),{onPointerDown:e=>{if(!t||n?.aborted||i.current||e.pointerType===`mouse`&&e.button!==0)return;let{currentTarget:a,pointerId:o}=e;if(a.setPointerCapture(o),!r.current.begin(e)){a.releasePointerCapture(o);return}let s=r.current.end,c=()=>{l(!0)},l=e=>{a.removeEventListener(`lostpointercapture`,c),i.current=null,s(e),a.hasPointerCapture(o)&&a.releasePointerCapture(o)};i.current={id:o,element:a,x:e.clientX,y:e.clientY,release:l},a.addEventListener(`lostpointercapture`,c)},onPointerMove:e=>{let t=i.current;t?.id===e.pointerId&&(r.current.move(e.clientX-t.x,e.clientY-t.y,e),t.x=e.clientX,t.y=e.clientY)},onPointerUp:e=>{i.current?.id===e.pointerId&&i.current.release(!1)},onPointerCancel:e=>{i.current?.id===e.pointerId&&i.current.release(!0)}}}(0,J.createContext)(null);var F8=(0,J.createContext)(null);(0,J.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,J.useContext)(F8),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(!s)return;let e=()=>{l(Array.from(s.querySelectorAll(`*`)).some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}))};e();let t=new MutationObserver(e);return t.observe(s,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[s]);let u=(0,J.useRef)(null);(0,J.useImperativeHandle)(i,()=>u.current);let d=(0,J.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,J.createElement)(`div`,{...r,ref:d,onFocusCapture:t=>{e===`windows`&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&a?.dismiss?.(),r.onFocusCapture?.(t)},"data-maosaico-layer":e,inert:e===`windows`&&c?``:void 0,style:{position:`relative`,...t,isolation:`isolate`,zIndex:`var(--stipe-layer-${e})`}},n)});var I8={min:224,max:480,initial:320},L8={agentRailOpen:!0,listRailOpen:!0,listWidth:I8.initial},R8=`fungi.grove.layout.v1`,z8=fn(Gn(H({agentRailOpen:wt,listRailOpen:wt,listWidth:Jt.pipe(q(yt()))})));function B8(e){return Math.round(Math.min(I8.max,Math.max(I8.min,e)))}function V8(e){try{let t=e?.getItem(R8);if(t==null)return L8;let n=z8(t);return Ce(n)?{...n.value,listWidth:B8(n.value.listWidth)}:L8}catch(e){return console.warn(`Grove could not read its saved rail layout`,e),L8}}function H8(e,t){try{e?.setItem(R8,JSON.stringify(t))}catch(e){console.warn(`Grove could not save its rail layout`,e)}}function U8(){try{return globalThis.localStorage}catch(e){console.warn(`Grove rail layout storage is unavailable`,e);return}}function W8(){let[e,t]=(0,J.useState)(()=>V8(U8()));return(0,J.useEffect)(()=>{H8(U8(),e)},[e]),[e,t]}var G8={2:`h2`,3:`h3`,4:`h4`};function K8(e,t){let{reduced:n}=t,r=e&&!n,i=cS(t,600),[a,o]=(0,J.useState)(r);return(0,J.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var q8=(0,J.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,J.useId)(),p=(0,J.useRef)(null),m=sS(p),h=K8(l===`speech`,m)&&!a,g=G8[r],_=c?c({speaking:h,thinking:a}):s,v=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,X.jsx)(`p`,{children:n}),i&&i.length>0?(0,X.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(NT,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,X.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,X.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:Q(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,X.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})});function J8({description:e,icon:t,label:n,density:r=`regular`,appearance:i=`plain`,iconSize:a=`default`,size:o,trailing:s,...c}){return(0,X.jsxs)(NT,{...c,className:Q(`caps-action-row`,i===`card`&&`caps-action-row-card`,r===`compact`?`h-auto min-h-10 w-full justify-start gap-xs px-xs py-2xs text-left`:`h-auto min-h-14 w-full justify-start gap-sm px-sm py-xs text-left`,c.className),size:o??(r===`compact`?`default`:`lg`),variant:c.variant??`ghost`,children:[t?(0,X.jsx)(`span`,{className:r===`compact`?`grid ${a===`lg`?`size-8`:`size-7`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-5`:`grid ${a===`lg`?`size-12`:`size-10`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-7`,children:t}):null,(0,X.jsxs)(`span`,{className:`caps-action-row-copy`,children:[(0,X.jsx)(`span`,{className:`caps-action-row-label max-w-full truncate`,children:n}),e?(0,X.jsx)(`span`,{className:`caps-action-row-description max-w-full truncate`,children:e}):null]}),s?(0,X.jsx)(`span`,{className:`caps-action-row-trailing`,children:s}):null]})}function Y8(e,t,n,r,i){let a=[];r&&a.push({kind:`hint`,key:`loading`,loading:!0});let o=0,s=[...e.active,...e.settled],c=new Map(s.map(e=>[VX(e.agentId,e.sessionId),e]));for(let e of[`Needs you`,`Working`,`Ready`,`Finished`]){let n=t.filter(t=>t.shelf===e).flatMap(e=>{let t=c.get(e.key);return t===void 0?[]:[t]});if(n.length!==0){a.push({kind:`heading`,key:e,title:e,gap:o++>0});for(let t of n)a.push({kind:`session`,key:VX(t.agentId,t.sessionId),shelf:e,session:t})}}if(e.unavailable.length>0){a.push({kind:`heading`,key:`Unavailable`,title:`Unavailable`,gap:o>0});for(let t of e.unavailable)a.push({kind:`unavailable`,key:VX(t.agentId,t.sessionId),session:t})}if(n.length>0){a.push({kind:`heading`,key:`Websites`,title:`Websites`,gap:a.length>0});for(let e of n)a.push({kind:`website`,key:`website:${e.bindingId}:${e.conversation.sessionId}`,website:e})}return a.length===0&&!i&&a.push({kind:`hint`,key:`empty`,loading:!1}),a}function X8({viewport:e,view:t,agents:n,loading:r,failed:i,pendingSelection:a,selectedAgentId:o,selectedSessionId:s,onSelect:c,onDelete:l,deleting:u,websites:d,selectedWebsite:f,onSelectWebsite:p}){let m=o!==null&&s!==null?VX(o,s):null,[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),y=h||_,[b,x]=(0,J.useState)(0),[S,C]=(0,J.useState)({placements:null,openKey:m,reopened:b}),w=(0,J.useMemo)(()=>LX(S.placements,[...t.active,...t.settled],{openKey:S.openKey===m?m:null,held:y,reorder:S.openKey!==m||S.reopened!==b}),[S,t,m,y,b]);(0,J.useEffect)(()=>{!y&&(S.placements!==w||S.openKey!==m||S.reopened!==b)&&C({placements:w,openKey:m,reopened:b})},[y,S,w,m,b]),(0,J.useEffect)(()=>{let t=e.current;if(t===null)return;let n=t.clientWidth>0&&t.clientHeight>0,r=`ResizeObserver`in globalThis?new ResizeObserver(([e])=>{let t=e.contentRect.width>0&&e.contentRect.height>0;t&&!n&&x(e=>e+1),n=t}):void 0;r?.observe(t);let i=()=>{document.visibilityState===`visible`&&x(e=>e+1)};return document.addEventListener(`visibilitychange`,i),()=>{r?.disconnect(),document.removeEventListener(`visibilitychange`,i)}},[e]);let T=(0,J.useMemo)(()=>Y8(t,w,d,r,i),[t,w,d,r,i]),E=(0,J.useCallback)(e=>T[e]?.key??e,[T]),D=RW({count:T.length,getScrollElement:()=>e.current,getItemKey:E,estimateSize:e=>T[e]?.kind===`heading`?24:44,measureElement:(e,t,n)=>{let r=AW(e,t,n);return r>0?r:AW(e,void 0,n)||n.options.estimateSize(n.indexFromElement(e))},initialRect:{width:320,height:800},overscan:5,useFlushSync:!1});return(0,X.jsx)(`div`,{className:`inbox-list px-1 py-1`,onPointerEnter:()=>{g(!0)},onPointerLeave:()=>{g(!1)},onFocusCapture:()=>{v(!0)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},children:(0,X.jsx)(`div`,{style:{height:D.getTotalSize(),position:`relative`,width:`100%`},children:D.getVirtualItems().map(e=>{let t=T[e.index],r=t.kind===`session`||t.kind===`unavailable`?t.session:null,i=r?n.get(r.agentId):void 0;return(0,X.jsx)(`div`,{"data-index":e.index,ref:D.measureElement,"data-inbox-shelf":t.kind===`session`?t.shelf:t.kind===`unavailable`?`Unavailable`:void 0,className:t.kind===`heading`?`inbox-shelf`:void 0,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${String(e.start)}px)`,paddingTop:t.kind===`heading`&&t.gap?4:0},children:t.kind===`heading`?(0,X.jsx)(Fx,{style:{paddingBottom:0},children:t.title}):t.kind===`hint`?(0,X.jsx)(`p`,{className:t.loading?`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`:`m-0 px-2 py-3 text-xs text-(--stipe-fg-muted)`,role:t.loading?`status`:void 0,children:t.loading?`Loading conversations…`:`No conversations yet.`}):t.kind===`website`?(0,X.jsx)(J8,{appearance:`plain`,density:`compact`,className:`inbox-row${f?.bindingId===t.website.bindingId&&f.conversation.sessionId===t.website.conversation.sessionId?` is-selected bg-base-300`:``}`,"data-testid":`inbox-website-row`,label:t.website.conversation.label||`Website visitor`,description:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(Uq,{name:`internet`,size:14}),t.website.siteLabel]}),trailing:t.website.conversation.held?(0,X.jsx)(`span`,{className:`text-xs`,children:t.website.conversation.heldByYou?`You're replying`:`With a teammate`}):t.website.conversation.needsYou?(0,X.jsx)(OG,{size:`compact`,tone:`accent`,title:t.website.conversation.needsYou.reason}):null,onClick:()=>{p(t.website)},variant:`ghost`}):t.kind===`unavailable`?i?(0,X.jsx)(Q8,{agent:i,row:t.session}):null:i?(0,X.jsx)(Z8,{agent:i,session:t.session,attention:t.session.unseen,pending:a?.agentId===t.session.agentId&&a.sessionId===t.session.sessionId,selected:o===t.session.agentId&&s===t.session.sessionId,onDelete:l&&i.sessionOperations.includes(`agent.manage`)?()=>{l(t.session.agentId,t.session.sessionId)}:void 0,deleting:u?.agentId===t.session.agentId&&u.sessionId===t.session.sessionId,onSelect:()=>{c(t.session.agentId,t.session.sessionId)}}):null},e.key)})})})}function Z8({agent:e,session:t,attention:n,pending:r,selected:i,onSelect:a,onDelete:o,deleting:s}){let c=AX(t.state),l=t.state===`errored`,u=(0,X.jsxs)(`span`,{className:`inbox-row-activity inline-grid shrink-0 grid-cols-[1rem_7ch] items-center gap-1.5 text-[0.6875rem]`,children:[(0,X.jsxs)(`span`,{className:`inbox-row-status flex items-center justify-center`,children:[r||c||l?(0,X.jsx)(`span`,{className:`sr-only`,children:r?`Opening`:OX[t.state]}):null,r||c?(0,X.jsx)(OG,{size:`compact`,title:r?`Opening`:OX[t.state],motion:t.state===`running`||r?`pulse`:`none`,tone:r?`neutral`:t.state===`needs_you`?`accent`:`info`}):l?(0,X.jsx)(OG,{size:`compact`,title:OX.errored,tone:`error`}):n?(0,X.jsx)(OG,{size:`compact`,title:`Finished since your last visit`,tone:`neutral`}):null]}),(0,X.jsx)(`time`,{className:`inbox-row-age min-w-0 truncate text-right tabular-nums text-(--stipe-fg-muted)`,dateTime:new Date(t.lastActivityAt).toISOString(),children:$8(t.lastActivityAt)})]});return(0,X.jsxs)(`div`,{className:`relative group`,children:[(0,X.jsx)(J8,{"aria-current":i?`page`:void 0,"aria-label":`${t.title||`Untitled session`} — ${HX(e)}${n?` — Finished since your last visit`:``}${t.ready?` — Ready`:c||l?` — ${OX[t.state]}`:``}`,"aria-busy":r||void 0,appearance:`plain`,className:`inbox-row pr-9${i?` is-selected bg-base-300`:``}`,"data-attention":n?`true`:`false`,"data-pending":r?`true`:`false`,"data-session-id":t.sessionId,"data-status":t.state,"data-testid":`inbox-session-row`,density:`compact`,description:HX(e),label:t.title||`Untitled session`,onClick:a,trailing:u,variant:`ghost`}),o?(0,X.jsx)(AG,{"aria-label":`Delete conversation ${t.title||`Untitled session`}`,title:`Delete conversation`,icon:(0,X.jsx)(sW,{}),iconSize:`sm`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 max-[899px]:opacity-100`,disabled:c||s,onClick:o}):null]})}function Q8({agent:e,row:t}){return(0,X.jsxs)(`div`,{className:`inbox-row is-unavailable flex min-h-11 w-full items-center gap-2 rounded-field border-(length:--border) border-transparent px-2 py-1 pr-9 text-left text-base-content`,"data-session-id":t.sessionId,"data-testid":`inbox-unavailable-row`,role:`group`,children:[(0,X.jsxs)(`span`,{className:`inbox-row-copy flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:`Conversation unavailable`}),(0,X.jsxs)(`small`,{className:`truncate text-xs text-(--stipe-fg-muted)`,children:[HX(e),` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` This saved conversation could not be read.`]})]}),(0,X.jsx)(`span`,{className:`inbox-row-activity inline-grid shrink-0 grid-cols-[1rem_7ch] items-center gap-1.5 text-[0.6875rem]`,children:(0,X.jsx)(`span`,{className:`inbox-row-status flex items-center justify-center`,children:(0,X.jsx)(OG,{size:`compact`,tone:`error`,title:`This saved conversation could not be read`})})})]})}function $8(e){let t=Math.max(0,Date.now()-e);return t<6e4?`now`:t<36e5?`${String(Math.floor(t/6e4))}m`:t<864e5?`${String(Math.floor(t/36e5))}h`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var e5=V().min(1).max(256),t5=Pe().int().nonnegative();Xe(`state`,[He({state:Ve(`agent`),version:t5}),He({state:Ve(`requested`),version:t5,reason:V().max(4e3),at:Pe().int().nonnegative()}),He({state:Ve(`person`),version:t5,memberId:e5,memberName:V().min(1).max(128),since:Pe().int().nonnegative()})]);var n5=He({bindingId:e5,agentId:e5,origins:se(V().min(1).max(2048)).min(1).max(16),lifecycle:oe([`active`,`suspended`])}),r5=He({sessionId:e5,label:V().max(4096),lastEventAt:Pe().int().nonnegative(),needsYou:He({at:Pe().int().nonnegative(),reason:V().max(4e3)}).nullable(),held:n(),heldByYou:n(),heldByName:V().min(1).max(128).nullable(),holdVersion:Pe().int().nonnegative()}),i5=He({bindingId:e5}).extend({sessionId:e5});i5.extend({requestId:V().min(1).max(128),text:V().trim().min(1).max(4e3)});var a5=He({expectedVersion:t5,confirm:n()});i5.extend(a5.shape),i5.extend({expectedVersion:t5});var o5=He({websites:se(n5).max(1e3)}),s5=He({conversations:se(r5).max(100)});He({conversation:r5});var c5=He({status:Ve(`sent`)}),l5=Vm(`channels.read`,1,B(()=>Hm({list:Wm(Um(o5)),conversations:Wm(Um(s5))}))),u5=Vm(`channels.personal.manage`,1,B(()=>Hm({hold:Wm(Um(r5)),release:Wm(Um(r5)),dismiss:Wm(Um(r5)),reply:Wm(Um(c5))})));function d5(e,t){let n=!1,r=async()=>{try{return await t.read()}catch(e){if(!(e instanceof kn)||e.boundary!==`runtime`||e.cause!==`unavailable`)throw e;if(await new Promise(e=>setTimeout(e,150)),n)throw Error(`Conversation opening cancelled`,{cause:e});return t.read()}},i,a=new Promise((e,t)=>{i=()=>{t(Error(`Conversation opening cancelled`))}});return{ready:Promise.race([r(),a]).then(r=>{if(n)throw Error(`Conversation opening cancelled`);ZP(e,t,r)}),close:()=>{n=!0,i()}}}function f5(e){return class{#e;constructor(t){this.#e=new jg(t,{fetch:(t,n)=>e(t,n)})}get readyState(){return this.#e.readyState}addEventListener(e,t,n){this.#e.addEventListener(e,t,n)}close(){this.#e.close()}}}function p5(e){let{connection:t,queryClient:n,services:r}=e,i=null,a=null,o=null,s=!1,c=(e,t)=>e?.agentId===t.agentId&&e.sessionId===t.sessionId,l=e=>!s&&i===e,u=(u,d,f=!1)=>{if(s)return;let p={agentId:u,sessionId:d};if(c(i,p)||(i?.close(),i=null,e.onPending(null),e.onError(null),c(a,p)))return;let m=null,h=!1,g={...p,close:()=>{h||(h=!0,m?.())}};i=g,e.onPending(p),(async()=>{try{let s=await r.openAgent(t.capabilities,{agentId:u});if(!l(g)){await s.close();return}let c=r.createClient({baseUrl:s.baseUrl,eventSource:f5(s.fetch),fetch:s.fetch}),f=c.session(d),p=d5(n,f);if(m=()=>{p.close(),Promise.allSettled([c.close(),s.close()])},await p.ready,e.reportsSelection!==!1&&await t.ui.reportAgentSessionSelection({agentId:u,sessionId:d}),!l(g))return;let h={agentId:u,sessionId:d,session:f},_=o;i=null,a=h,o=g.close,e.onConversation(h),e.onPending(null),_?.()}catch(t){console.error(`Chat Session opening failed`,t),g.close(),l(g)&&(i=null,e.onPending(null),e.onError(f?`That Session could not be opened. ${a?`The current conversation remains open.`:`Choose another Session from the list.`}`:`Could not open this Session${t instanceof Error?`: ${t.message}`:``}. ${a?`The previous conversation remains open.`:`Try opening it again.`}`))}})()},d=()=>{if(s)return;let n=i!==null||a!==null;i?.close(),i=null,o?.(),o=null,a=null,e.onPending(null),e.onConversation(null),e.onError(null),!(!n||e.reportsSelection===!1)&&t.ui.reportAgentSessionSelection(null).catch(e=>{console.error(`Chat Session selection could not be reported`,e)})};return{select:u,clear:d,close:()=>{d(),s=!0}}}function m5(e,t){async function n(e){if(e.type!==`prompt`||(e.images?.length??0)>0)throw new Y(`Website conversations support text replies only`,{code:`COMMAND_NOT_DECLARED`,retryable:!1});if(!t.canReply())throw new Y(`Use Take over to reply to this visitor`,{code:`CAPABILITY_DENIED`,retryable:!1});return await t.reply({bindingId:t.bindingId,sessionId:t.sessionId,requestId:e.requestId,text:e.text}),{status:`recorded`}}return{latestPending:()=>Promise.resolve(null),withdraw:t=>e.withdraw(t),address:e.address,read:t=>e.read(t),watch:t=>e.watch(t),extension:()=>({call:()=>Promise.reject(new Y(`Website Session controls are unavailable`,{code:`COMMAND_NOT_DECLARED`,retryable:!1}))}),command:n}}function h5(e,t){(0,J.useSyncExternalStore)(t=>e?.capabilities.subscribe(t)??(()=>void 0),()=>e?.capabilities.version??0);let n=$i(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=e?.capabilities.has(l5)===!0,u=e?.capabilities.has(u5)===!0,d=Oo({...Xy(e,l5,qy.of(e,`websites`),e=>e.list()),enabled:l}),f=l?d.data?.websites??[]:[],p=Eo({queries:f.map(t=>({...Xy(e,l5,qy.of(e,`website-conversations`,t.bindingId),e=>e.conversations({bindingId:t.bindingId})),enabled:l}))}),m=f.flatMap((e,t)=>(p[t]?.data?.conversations??[]).map(t=>({bindingId:e.bindingId,agentId:e.agentId,siteLabel:e.origins.map(e=>new URL(e).host).join(`, `),conversation:t}))).sort((e,t)=>t.conversation.lastEventAt-e.conversation.lastEventAt),h=m.find(e=>e.bindingId===r?.bindingId&&e.conversation.sessionId===r.sessionId),g=(0,J.useMemo)(()=>e===null?null:p5({connection:e,queryClient:n,services:t,onPending:()=>void 0,onConversation:o,onError:c}),[e,n,t]);(0,J.useEffect)(()=>()=>{g?.close()},[g]),(0,J.useEffect)(()=>{l||g?.clear()},[l,g]);let _=jo({mutationFn:t=>{if(e===null)throw Error(`No App connection`);let n=e.capabilities.require(u5);return t.kind===`hold`?n.hold({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm}):n.release({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm})},onSuccess:(t,r)=>{n.setQueryData(qy.of(e,`website-conversations`,r.bindingId),e=>e===void 0?void 0:{conversations:e.conversations.map(e=>e.sessionId===t.sessionId?t:e)})}}),v=h?.bindingId,y=h?.conversation.sessionId,b=h?.conversation.heldByYou===!0,x=(0,J.useMemo)(()=>a===null||v===void 0||y===void 0||e===null?null:m5(a.session,{bindingId:v,sessionId:y,canReply:()=>b&&e.capabilities.has(u5),reply:t=>e.capabilities.require(u5).reply(t)}),[e,a,v,y,b]),S=(0,J.useCallback)(()=>{g?.clear(),i(null),o(null),_.reset()},[g,_.reset]);return{canRead:l,canManage:u,rows:m,selected:h,session:x,action:_,openingError:s,loading:l&&(d.isPending||p.some(e=>e.isPending)),failed:l&&(d.isError||p.some(e=>e.isError)),clear:S,select:e=>{l&&(h?.bindingId!==e.bindingId||h.conversation.sessionId!==e.conversation.sessionId||a===null)&&(i({bindingId:e.bindingId,sessionId:e.conversation.sessionId}),o(null),_.reset(),g?.select(e.agentId,e.conversation.sessionId))}}}function g5({inbox:e}){let{selected:t,session:n,action:r,canManage:i,openingError:a}=e,[o,s]=(0,J.useState)(null);if((0,J.useEffect)(()=>{s(null)},[t?.bindingId,t?.conversation.sessionId,i]),t===void 0)return null;let c=t.conversation;return(0,X.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:c.heldByYou?`You're replying. The Agent is paused.`:c.held?`${c.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),i?(0,X.jsx)(NT,{size:`sm`,disabled:r.isPending,onClick:()=>{let e={bindingId:t.bindingId,sessionId:c.sessionId};c.heldByYou?r.mutate({kind:`release`,...e,expectedVersion:c.holdVersion,confirm:!1}):c.held?s({...e,version:c.holdVersion,name:c.heldByName??`A teammate`}):r.mutate({kind:`hold`,...e,expectedVersion:c.holdVersion,confirm:!1})},children:c.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,X.jsx)(kU,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(PU,{children:[(0,X.jsxs)(IU,{children:[(0,X.jsxs)(LU,{children:[o?.name,` is replying — take over?`]}),(0,X.jsx)(RU,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,X.jsxs)(FU,{children:[(0,X.jsx)(zU,{render:(0,X.jsx)(NT,{variant:`outline`}),children:`Cancel`}),(0,X.jsx)(NT,{disabled:r.isPending||!i,onClick:()=>{o!==null&&(r.mutate({kind:`hold`,bindingId:o.bindingId,sessionId:o.sessionId,expectedVersion:o.version,confirm:!0}),s(null))},children:`Take over`})]})]})}),i?null:(0,X.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:`This conversation changed or website access was removed. Refresh and try again.`}):null,a?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:a}):null,n?(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(uX,{authorOf:At,disambiguateAuthors:!0,session:n,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${t.bindingId}:${c.sessionId}`)}):null]})}var _5=(0,J.lazy)(async()=>({default:(await ir(()=>import(`./parakeet-conversation-CsLT5hy_.js`),__vite__mapDeps([12,1,2,3,4,5,13]))).ParakeetConversation})),v5={openAgent:pg,createClient:sn},y5=[`agent.list`,`agent.manage`,`agent.read`,`agent.send`],b5=[`agent.read`,`agent.send`,`agent.manage`],x5=dt({family:`grove-session-create-request`,version:1,kinds:{request:{prefix:`request`}}});async function S5(e,t,n,r){let i=await n.openAgent(e.capabilities,{agentId:t}),a=n.createClient({baseUrl:i.baseUrl,eventSource:f5(i.fetch),fetch:i.fetch});try{return await r(a)}finally{Promise.allSettled([a.close(),i.close()])}}function C5({open:e,renderConversation:t,connection:n,commands:r,composeDraft:i,onPrefilled:a,onForked:o,onOpen:s,label:c=`Conversation`}){let l=e.session;return(0,J.useEffect)(()=>{let e=NL(r,l,{sourceId:`grove-session`,namespace:`session`,sessionResumeAvailable:!1,forkAvailable:!0,onForked:o});return()=>{e.dispose()}},[r,l,o]),(0,X.jsx)(`section`,{className:`inbox-conversation min-h-0 min-w-0 flex-1`,"data-inbox-conversation":!0,"aria-label":c,children:t?t(e,i,s):(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(`p`,{className:`p-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Opening conversation…`}),children:(0,X.jsx)(_5,{session:l,draftIdentity:{agentId:e.agentId,sessionId:e.sessionId},connection:n,commands:r,prefill:i,onPrefilled:a,onOpen:s})})})}function w5(e){return Im(e.connection),(0,X.jsx)(T5,{...e},JSON.stringify(qy.of(e.connection)))}function T5(e){let t=(0,J.useMemo)(x8,[e.connection]);return(0,X.jsx)(_8,{value:(0,X.jsx)(E5,{...e,router:t}),children:(0,X.jsx)(p8,{router:t})})}function E5({router:e,connection:t,services:n=v5}){let{agentFilterId:r,setFilter:i,selection:a,open:o}=S8(e,t?.window.navigation),s=$i(),c=h5(t,n),{directory:l,inbox:u,createAgent:d,renameAgent:f,setAgentAvatar:p}=A8(t),m=l.data??[],h=l.isPending&&(t?.capabilities.has(Zh)??!0),g=l.error?.message??null,_=d.isPending,v=jo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return S5(t,e.agentId,n,t=>t.createSession(e.requestId))}}),y=jo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return S5(t,e.agentId,n,t=>t.deleteSession(e.sessionId))},onSuccess:(t,n)=>{a?.agentId===n.agentId&&a.sessionId===n.sessionId&&(he?.clear(),e.navigate({to:`/`,search:!0,replace:!0})),u.refresh()}}),b=v.isPending?v.variables.agentId:null,[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(!1),D=C?.agentId??null,O=C?.sessionId??null,[k,A]=(0,J.useState)(null),j=(0,J.useRef)(null),[M,N]=W8(),{agentRailOpen:P,listRailOpen:F,listWidth:ee}=M,I=e=>{N(t=>({...t,agentRailOpen:e(t.agentRailOpen)}))},te=e=>{N(t=>({...t,listRailOpen:e(t.listRailOpen)}))},ne=e=>{N(t=>({...t,listWidth:B8(e(t.listWidth))}))},re=P8({begin:()=>!0,move:e=>{ne(t=>t+e)},end:()=>void 0}),[ie,L]=(0,J.useState)(!1),ae=YX(),oe=(0,J.useRef)(null),[R,se]=(0,J.useState)(null),ce=d.error?.message??null,le=d.data,z=(0,J.useRef)(null),[ue,de]=(0,J.useState)(null),[fe,pe]=(0,J.useState)(null),me=Im(t)?.openRequest??null,B=(0,J.useRef)(null),he=(0,J.useMemo)(()=>t===null?null:p5({connection:t,queryClient:s,services:n,onPending:S,onConversation:w,onError:de}),[t,s,n]);(0,J.useEffect)(()=>{if(he!==null)return()=>{z.current=null,he.close()}},[he]);let[ge,_e]=(0,J.useState)(null),ve=(0,J.useMemo)(()=>Jr(),[]),ye=(0,J.useMemo)(()=>t===null?null:p5({connection:t,queryClient:s,services:n,onPending:()=>void 0,onConversation:_e,onError:de,reportsSelection:!1}),[t,s,n]);(0,J.useEffect)(()=>ye===null?void 0:()=>{ye.close()},[ye]);let be=(0,J.useCallback)(e=>{let t=t=>e.params.find(e=>e.key===t)?.value,n=t(`agent`),r=t(`session`);n!==void 0&&r!==void 0&&ye?.select(n,r)},[ye]),xe=(0,J.useRef)(null),Se=(0,J.useCallback)((e,t,n=!1)=>{he!==null&&(v.isError&&v.reset(),c.clear(),E(!1),xe.current={agentId:e,sessionId:t},he.select(e,t,n),o(e,t))},[he,o,c.clear,v.isError,v.reset]),Ce=a?.agentId,we=a?.sessionId;(0,J.useEffect)(()=>{let e=xe.current;xe.current=null,Ce===void 0||we===void 0?he?.clear():(e?.agentId!==Ce||e.sessionId!==we)&&he?.select(Ce,we)},[he,Ce,we]);let Te=(0,J.useCallback)(e=>{C&&(Se(C.agentId,e),u.refresh())},[C,Se,u.refresh]);(0,J.useEffect)(()=>{if(!t||me===null){me===null&&(B.current=null);return}if(me.kind!==`navigate`||B.current===me.requestId)return;let e=me.params.find(e=>e.key===`agent`)?.value,n=me.params.find(e=>e.key===`session`)?.value;!e||!n||(B.current=me.requestId,i(e),Se(e,n,!0))},[t,me,Se,i]);let Ee=(0,J.useCallback)(async e=>{if(!t||_||!t.capabilities.has(Qh))return!1;try{let t=await d.mutateAsync(e);return i(t.agentId),se(t.agentId),A(null),!0}catch{return!1}},[t,_,d.mutateAsync,i]),De=(0,J.useCallback)(async e=>{if(!t||b!==null)return`Conversation creation is unavailable.`;de(null);let n=z.current?.agentId===e?z.current:{agentId:e,requestId:x5.request.generate()};z.current=n;try{let t=await v.mutateAsync(n);Se(e,t),u.refresh(),A(null),L(!1),z.current===n&&(z.current=null);return}catch(e){return console.error(`Grove conversation creation failed`,e),e instanceof Error?e.message:`Couldn't start the conversation.`}},[t,Se,b,v.mutateAsync,u.refresh]);(0,J.useEffect)(()=>{if(!(!t||me?.kind!==`compose`)&&B.current!==me.requestId&&!(!C&&h)&&(B.current=me.requestId,pe({requestId:me.requestId,text:me.text}),!C)){let e=t.capabilities.has(lg)?m.find(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)):void 0;e?De(e.agentId):A(`agent`)}},[m,t,h,C,me,De]);let Oe=k8({setDraft:e=>x!==null||!C||!t?.capabilities.has(lg)||!m.some(e=>e.agentId===C.agentId&&e.sessionOperations.includes(`agent.send`))?!1:(pe({requestId:ih(),text:e}),!0),newConversation:()=>{C&&De(C.agentId)},openPermissions:()=>{t?.ui.requestAppPermissions({}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})}},t?.commands),ke=new Set(c.rows.map(e=>`${e.agentId}:${e.conversation.sessionId}`)),Ae=u.items.filter(e=>!(`kind`in e)).filter(e=>!ke.has(`${e.agentId}:${e.sessionId}`)),je=Eo({queries:(C?[C.session]:[]).map(e=>({...XP(e),enabled:!1}))}).at(0)?.data?.snapshot,Me=(0,J.useMemo)(()=>C&&je?{agentId:C.agentId,sessionId:C.sessionId,state:sM(je)}:void 0,[C,je]),Ne=(0,J.useMemo)(()=>zX(m,T&&c.canRead?[]:Ae,r,Me),[r,m,Ae,T,c.canRead,Me]),Pe=(0,J.useMemo)(()=>{let e=new Map;for(let t of Ae)`state`in t&&(t.state===`needs_you`?e.set(t.agentId,`speaking`):t.state===`running`&&!e.has(t.agentId)&&e.set(t.agentId,`thinking`));return e},[Ae]),Fe=(0,J.useMemo)(()=>new Map(m.map(e=>[e.agentId,e])),[m]),Ie=(0,J.useRef)(null),V=Ae.find(e=>e.agentId===D&&e.sessionId===O),Le=V!==void 0&&V.state!==`unavailable`,Re=V!==void 0&&V.state!==`unavailable`?V.settledAt:void 0;(0,J.useEffect)(()=>{!Le||D===null||O===null||u.visit(D,O).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},[Le,Re,D,O,u.visit]);let ze=u.status===`loading`,Be=u.status===`error`,Ve=t?.capabilities.has(Qh)??!1,He=t?.capabilities.has(lg)??!1,Ue=m.filter(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)),We=Ue.find(e=>e.agentId===(R??r))??Ue.at(0),Ge=He&&We!==void 0,Ke=()=>{t?.ui.requestAppPermissions({agents:y5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},qe=le&&(!le.sessionOperations.includes(`agent.read`)||!le.sessionOperations.includes(`agent.send`)||!le.sessionOperations.includes(`agent.manage`))?`Agent created. Allow Grove to read, send messages and manage its sessions to start a conversation.`:fe&&!C&&!Ge&&d.isIdle?`Choose an Agent to compose your game idea.`:null,Je=(0,J.useMemo)(()=>zX(m,Ae,null,Me),[m,Ae,Me]),Ye=(e,t)=>{L(!1),Se(e,t)},Xe=()=>{oe.current=document.activeElement instanceof HTMLElement?document.activeElement:null,L(!0)};Lm(t,[...ae?[{kind:`button`,id:`agents`,text:`Agents`,expanded:P,title:P?`Hide Agents`:`Show Agents`},{kind:`button`,id:`conversations`,text:`Conversations`,expanded:F,title:F?`Hide conversations`:`Show conversations`}]:[{kind:`button`,id:`agents`,text:`Agents and conversations`,opens:`dialog`,expanded:ie}],...ge===null?[]:[{kind:`button`,id:`close-beside`,text:`Close beside`,title:`Close beside conversation`}]],e=>{if(k!==null)return!1;if(e.itemId===`close-beside`&&ge!==null)ye?.clear();else if(ae&&e.itemId===`agents`)I(e=>!e);else if(ae&&e.itemId===`conversations`)te(e=>!e);else if(!ae&&e.itemId===`agents`)ie?L(!1):Xe();else return!1;return!0});let Ze=e=>{i(e),se(e);let t=[...Je.active,...Je.settled].filter(t=>t.agentId===e).sort((e,t)=>t.lastActivityAt-e.lastActivityAt).at(0);t&&Ye(e,t.sessionId)},Qe={"--grove-list-width":`${String(ee)}px`},$e=C?Fe.get(C.agentId):void 0,et=r===null?void 0:Fe.get(r),tt=t?.capabilities.has(eg)??!1,nt=t?.capabilities.has(rg)??!1,rt=j8(t,et?.agentId??null),it=Ne.active.length+Ne.settled.length,at=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await f.mutateAsync({agentId:e,name:n}),!0}catch{return!1}},[t,f.mutateAsync]),ot=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await p.mutateAsync({agentId:e,avatar:n}),!0}catch{return!1}},[t,p.mutateAsync]),st=(0,J.useCallback)(()=>{let e=rt.status.data;!et||e==null||rt.approve.mutate({agentId:et.agentId,expectedRevision:e.revision})},[et,rt.status.data,rt.approve]),ct=(0,J.useCallback)(e=>{!t||_||b!==null||e===`agent`&&!Ve||(k===null&&(j.current=ie?oe.current:document.activeElement instanceof HTMLElement?document.activeElement:null),L(!1),e===`session`&&se($e?.agentId??r??Ue.at(0)?.agentId??null),A(e))},[t,_,b,Ve,k,ie,$e?.agentId,r,Ue]);(0,J.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||!e.ctrlKey||e.altKey||e.metaKey||e.key.toLowerCase()!==`n`||!t||e.shiftKey&&!Ve||(e.preventDefault(),ct(e.shiftKey?`agent`:`session`))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[t,Ve,ct]);let lt=v.isError?v.variables:null,H=lt&&k!==`session`?(0,X.jsx)(Mx,{className:C||c.selected?`inbox-error m-2`:`inbox-empty m-auto max-w-[28rem]`,tone:`error`,title:`Couldn't start the conversation.`,description:v.error?.message,action:(0,X.jsx)(NT,{variant:`outline`,onClick:()=>void De(lt.agentId),children:`Retry`})}):null;return(0,X.jsxs)(`main`,{className:`inbox-app grove-shell relative flex h-dvh min-h-0 bg-base-200 font-sans text-base-content`,"data-inbox-app":!0,"data-conversation":!!C||c.selected!==void 0,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P0,{open:k===`agent`,pending:_,error:ce,canChooseComputer:t.capabilities.has(QX),create:Ee,onClose:()=>{A(null)},returnFocus:j}),k===`session`?(0,X.jsx)(F0,{open:!0,agents:He?Ue:[],defaultAgentId:We?.agentId??null,start:De,pending:b!==null,onClose:()=>{A(null)},onNewAgent:Ve?()=>{A(`agent`)}:void 0,returnFocus:j}):null]}):null,(0,X.jsxs)(XX,{open:ie,onOpenChange:L,returnFocus:oe,children:[(0,X.jsx)(WX,{open:P,agents:m,agentActivity:Pe,agentFilterId:r,websitesSelected:T,websitesVisible:c.canRead,canCreate:t!==null&&Ve,createOpen:k===`agent`,onAll:()=>{i(null),E(!1)},onWebsites:()=>{i(null),E(!0)},onAgent:e=>{E(!1),Ze(e)},onCreate:()=>{ct(`agent`)}}),(0,X.jsxs)(`aside`,{id:`grove-list-rail`,className:`inbox-sidebar group relative min-h-0 min-w-0 flex-1 flex-col border-r border-base-300 min-[900px]:w-[var(--grove-list-width)] min-[900px]:flex-none ${F?`flex`:`flex min-[900px]:hidden`}`,style:Qe,"aria-label":`Conversations`,children:[ae?(0,X.jsx)(N8,{"aria-label":`Conversation list width`,"aria-controls":`grove-list-rail`,className:`absolute right-0 top-1/2 z-10 translate-x-1/2 -translate-y-1/2`,orientation:`vertical`,value:ee,min:I8.min,max:I8.max,onValueChange:e=>{ne(()=>e)},onDoubleClick:()=>{ne(()=>I8.initial)},...re}):null,(0,X.jsxs)(`header`,{className:`inbox-header flex h-10 flex-none items-center gap-1 border-b border-base-300 pl-3 pr-1`,children:[et?(0,X.jsx)(M8,{agentId:et.agentId,name:HX(et),avatar:et.avatar,...nt?{setAvatar:ot}:{}},et.agentId):null,(0,X.jsx)(Fx,{className:`min-w-0 flex-1 truncate`,children:T&&c.canRead?`Websites`:et?HX(et):`All Agents`}),et&&tt?(0,X.jsx)(w8,{agentId:et.agentId,name:et.name,rename:at},et.agentId):null,t&&(Ge||Ve)?(0,X.jsx)(AG,{"aria-label":`New conversation`,"aria-haspopup":`dialog`,icon:(0,X.jsx)(aW,{}),iconSize:`sm`,size:`sm`,onClick:()=>{ct(`session`)}}):null]}),et&&rt.canRead?(0,X.jsx)(T8,{status:rt.status.data,approving:rt.approve.isPending,onApprove:st}):null,qe?(0,X.jsx)(Mx,{tone:`info`,title:qe,action:(0,X.jsx)(NT,{variant:`ghost`,onClick:()=>{t?.ui.requestAppPermissions({agents:b5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},children:`Allow conversation access`})}):null,t&&m.length>0&&!Ge&&!Ve?(0,X.jsxs)(`section`,{className:`inbox-create inbox-access flex flex-col items-start gap-3 border-b border-base-300 py-2`,"aria-labelledby":`inbox-agent-access-title`,children:[(0,X.jsx)(zx,{level:2,id:`inbox-agent-access-title`,className:`inbox-access-title m-0`,children:`Let Grove manage your Agents`}),(0,X.jsx)(`p`,{children:`Grove creates Agents and carries their conversations. Your Team decides what it may do.`}),(0,X.jsx)(NT,{size:`sm`,onClick:Ke,children:`Allow Agent access`})]}):null,y.error?(0,X.jsx)(Mx,{tone:`error`,title:y.error.message}):null,g?(0,X.jsx)(Mx,{className:`inbox-error`,tone:`error`,title:g,action:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{l.refetch()},children:`Try again`})}):null,Be?(0,X.jsx)(Mx,{className:`inbox-error`,tone:`error`,title:`Conversations are unavailable.`,action:(0,X.jsx)(NT,{variant:`ghost`,size:`sm`,onClick:()=>{u.refresh()},children:`Retry conversations`})}):null,(0,X.jsx)(bA,{ref:Ie,className:`inbox-surface min-h-0 flex-1`,"aria-label":`Conversations`,children:t?h?(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Loading Agents…`}):(0,X.jsx)(X8,{viewport:Ie,view:Ne,agents:Fe,loading:ze||c.loading,failed:!!g||Be||c.failed,pendingSelection:x,selectedAgentId:D,selectedSessionId:O,onSelect:Ye,onDelete:He?(e,t)=>{y.mutate({agentId:e,sessionId:t})}:void 0,deleting:y.isPending?y.variables:null,websites:c.rows.filter(e=>r===null||e.agentId===r),selectedWebsite:c.selected,onSelectWebsite:e=>{he?.clear(),L(!1),c.select(e)}}):(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,children:`Connect to the host to browse Agents.`})},r)]})]}),(0,X.jsxs)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Conversation`,children:[(0,X.jsx)(GX,{app:t}),ue?(0,X.jsx)(Mx,{className:`inbox-error m-2`,tone:`error`,title:ue}):null,C||c.selected?H:null,c.selected?(0,X.jsx)(g5,{inbox:c}):C?(0,X.jsx)(C5,{open:C,connection:t,commands:Oe,renderConversation:n.renderConversation,composeDraft:fe,onPrefilled:()=>{pe(null)},onForked:Te,onOpen:be}):!t||h?null:m.length===0&&!g?(0,X.jsx)(q8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`speech`,thinking:_,renderVisual:({speaking:e,thinking:t})=>(0,X.jsx)(DX,{className:`h-full w-full`,state:{activity:t?`thinking`:e?`speaking`:`idle`,expression:`normal`}}),title:Ve?`No one's here yet.`:`Welcome to Grove`,description:Ve?`Agents chat, write and make little games with you. Name someone?`:`Let Grove find your Agents, create new ones, and open conversations. Your Team controls this access.`,actions:Ve?(0,X.jsx)(NT,{onClick:()=>{ct(`agent`)},children:`Name your first Agent`}):(0,X.jsx)(NT,{onClick:Ke,children:`Allow Agent access`})}):H??(0,X.jsx)(q8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`panel`,title:it>0?`Pick up a conversation`:We?`Say hello to ${HX(We)}`:`No conversations yet`,description:it>0?`Choose one from the list, or ask for something new. A tiny game is a good start.`:`Ask for anything. Try: “Make me a tiny game where a mushroom catches raindrops.”`,actions:(0,X.jsxs)(X.Fragment,{children:[ae||it===0?null:(0,X.jsx)(NT,{variant:`outline`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":ie,onClick:Xe,children:`Agents and conversations`}),Ge?(0,X.jsx)(NT,{variant:`outline`,loading:b===We.agentId,disabled:b!==null,onClick:()=>void De(We.agentId),children:it>0?`Ask ${HX(We)} something`:`Start a conversation`}):null]})})]}),ge===null?null:(0,X.jsx)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col border-l border-base-300`,"aria-label":`Beside conversation`,"data-inbox-beside":!0,children:(0,X.jsx)(C5,{open:ge,connection:t,commands:ve,renderConversation:n.renderConversation,composeDraft:null,onPrefilled:()=>void 0,onForked:e=>{ye?.select(ge.agentId,e)},onOpen:be,label:`Beside conversation`})})]})}var D5=document.getElementById(`inbox-root`);if(!D5)throw Error(`Inbox root is missing`);Nm(D5,{name:`Grove`,queryClient:Yy()},({app:e})=>(0,J.createElement)(w5,{connection:e}));export{$S as $,NT as A,YC as B,GF as C,lj as D,BM as E,Pw as F,uC as G,NC as H,Ow as I,sC as J,oC as K,dw as L,Zw as M,Iw as N,$A as O,Nw as P,nC as Q,cw as R,UF as S,WF as T,LC as U,zC as V,cC as W,IC as X,lC as Y,PC as Z,XU as _,Oo as _t,jK as a,Lx as at,GI as b,dr as bt,nG as c,Rx as ct,ZW as d,qy as dt,TS as et,XW as f,Um as ft,KW as g,Vm as gt,qW as h,Gm as ht,HY as i,vS as it,dT as j,qA as k,eG as l,zx as lt,GW as m,Wm as mt,m0 as n,YS as nt,AK as o,Bx as ot,JW as p,Hm as pt,aC as q,rX as r,wS as rt,qG as s,Vx as st,_0 as t,jS as tt,$W as u,Q as ut,qU as v,Zi as vt,ZF as w,$F as x,tL as y,gr as yt,tw as z};