@fungi.computer/grove 0.0.1 → 0.2.0

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 (72) hide show
  1. package/README.md +18 -9
  2. package/dist/assets/Effect-BY0T-p9d.js +76 -0
  3. package/dist/assets/abort-signals-joV34wzR.js +1 -0
  4. package/dist/assets/anthropic-messages-BPUe3sjP.js +19 -0
  5. package/dist/assets/azure-openai-responses-qVCjcy57.js +1 -0
  6. package/dist/assets/base-face-Dc6wvM5e.js +1 -0
  7. package/dist/assets/burger-CJ8nsj7v.js +1 -0
  8. package/dist/assets/cat-DCYVOD6V.js +1 -0
  9. package/dist/assets/classifier-shared-DtTbFkSF.js +1 -0
  10. package/dist/assets/cloudflare-workers-ai-system-one-C4GWBDtR.js +1 -0
  11. package/dist/assets/compat-Dluy1HPa.js +2 -0
  12. package/dist/assets/{diagnostics-CmW2yJSB.js → diagnostics-CxvqSC4Q.js} +1 -1
  13. package/dist/assets/document-DjWTbvB5.js +1 -0
  14. package/dist/assets/error-BTdmRKoB.js +1 -0
  15. package/dist/assets/extension-hook-Ce1QNicQ.js +721 -0
  16. package/dist/assets/extensions-D55BOb_a.js +1 -0
  17. package/dist/assets/{google-generative-ai-DP-8xZvz.js → google-generative-ai-D4EEWKtU.js} +1 -1
  18. package/dist/assets/{google-shared-Cs5udoZV.js → google-shared-CvUYw8Za.js} +3 -3
  19. package/dist/assets/{google-vertex-BJiAIGUd.js → google-vertex-MtdrRNuD.js} +1 -1
  20. package/dist/assets/index--Y1OC0IE.js +171 -0
  21. package/dist/assets/index-BmdZJzrt.css +1 -0
  22. package/dist/assets/{json-parse-nqKewMRF.js → json-parse-M7s0500m.js} +2 -2
  23. package/dist/assets/mistral-conversations-CI9T5Sz9.js +4 -0
  24. package/dist/assets/models-BM_0GHMS.js +1 -0
  25. package/dist/assets/mushroom-CstiBfYI.js +1 -0
  26. package/dist/assets/{node.browser-CwSOSQcL.js → node.browser-DL9pz-ZD.js} +1 -1
  27. package/dist/assets/node.browser-HQ5SKBOf.js +1 -0
  28. package/dist/assets/openai-codex-responses-C1JF2nxc.js +9 -0
  29. package/dist/assets/openai-completions-DJRWblh-.js +5 -0
  30. package/dist/assets/openai-decisions-CRn788gD.js +2 -0
  31. package/dist/assets/openai-responses-DT9fG-Eg.js +1 -0
  32. package/dist/assets/openai-responses-shared-BDR0j8d9.js +10 -0
  33. package/dist/assets/{openrouter-images-DwousKhc.js → openrouter-images-BqwSYNGm.js} +1 -1
  34. package/dist/assets/parakeet-conversation-DFuwoFfN.js +4 -0
  35. package/dist/assets/{pi-messages-CfXPQ4jp.js → pi-messages-0BariYjJ.js} +1 -1
  36. package/dist/assets/preload-helper-DY31Aviq.js +8 -0
  37. package/dist/assets/{provider-retry-CSlu6hjs.js → provider-retry-RVfYd5Vz.js} +1 -1
  38. package/dist/assets/renderer-l9sYXW5N.js +1 -0
  39. package/dist/assets/runtime-core-BHRx5Fxu.js +2 -0
  40. package/dist/assets/system-one-shared-DywxmMny.js +1 -0
  41. package/dist/assets/transform-messages-ByuM-ZZe.js +1 -0
  42. package/dist/assets/typesafe-system-one-D7tQu98S.js +1 -0
  43. package/dist/index.html +7 -5
  44. package/package.json +40 -17
  45. package/dist/assets/Effect-BEduymlz.js +0 -76
  46. package/dist/assets/anthropic-messages-Bnv5qjAJ.js +0 -41
  47. package/dist/assets/azure-openai-responses-QZaJy-8U.js +0 -1
  48. package/dist/assets/base-face-CJPKiwfc.js +0 -1
  49. package/dist/assets/burger-DMbWZ2jd.js +0 -1
  50. package/dist/assets/cat-UfLh6DHG.js +0 -1
  51. package/dist/assets/cloudflare-workers-ai-system-one-Bq-3_D9p.js +0 -1
  52. package/dist/assets/compat-CvJ9Wfru.js +0 -2
  53. package/dist/assets/error-CJ3RHG07.js +0 -1
  54. package/dist/assets/extension-hook-DvcdepgP.js +0 -560
  55. package/dist/assets/extensions-1Fd4Wd8r.js +0 -1
  56. package/dist/assets/index-DBHVAvuX.css +0 -1
  57. package/dist/assets/index-hJphFjkO.js +0 -171
  58. package/dist/assets/mistral-conversations-mRYg3mWw.js +0 -4
  59. package/dist/assets/models-CcNnosqL.js +0 -1
  60. package/dist/assets/mushroom-BBaCYNmw.js +0 -1
  61. package/dist/assets/node.browser-DFtqp6Hr.js +0 -1
  62. package/dist/assets/openai-codex-responses-BMz-j1hp.js +0 -9
  63. package/dist/assets/openai-completions-BxBCgHHI.js +0 -5
  64. package/dist/assets/openai-responses-cvwOEFWg.js +0 -1
  65. package/dist/assets/openai-responses-shared-DzD8B6NI.js +0 -10
  66. package/dist/assets/parakeet-conversation-C3pQoKx-.js +0 -3
  67. package/dist/assets/preload-helper-mbhLTglw.js +0 -8
  68. package/dist/assets/renderer-BdjuCi44.js +0 -1
  69. package/dist/assets/runtime-core-CvcjUkf6.js +0 -2
  70. package/dist/assets/system-one-shared-CGF8IYMZ.js +0 -1
  71. package/dist/assets/transform-messages-CrQEqmfx.js +0 -1
  72. package/dist/assets/typesafe-system-one-CWcJw-Ys.js +0 -1
@@ -0,0 +1,171 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/runtime-core-BHRx5Fxu.js","assets/rolldown-runtime-hePW80VL.js","assets/Effect-BY0T-p9d.js","assets/extension-hook-Ce1QNicQ.js","assets/preload-helper-DY31Aviq.js","assets/extensions-D55BOb_a.js","assets/mushroom-CstiBfYI.js","assets/document-DjWTbvB5.js","assets/renderer-l9sYXW5N.js","assets/cat-DCYVOD6V.js","assets/base-face-Dc6wvM5e.js","assets/burger-CJ8nsj7v.js","assets/parakeet-conversation-DFuwoFfN.js","assets/parakeet-conversation-COndlivb.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{$ as r,$a as i,$i as a,Aa as o,Ai as s,Ba as c,Bi as l,Ca as u,Da as d,E as f,Ea as p,Fa as m,Fi as h,Ga as g,Gi as _,Gn as v,Ha as y,Hi as b,I as x,Ia as S,Ii as C,Ja as w,Ka as T,Ki as E,La as D,Li as O,Ma as k,Mi as A,Na as j,Ni as M,Oa as N,Pa as P,Pi as ee,Qa as te,Qn as F,R as ne,Ra as re,Ri as ie,Sa as ae,St as I,T as oe,Ta as se,Ti as L,Ua as ce,Ui as le,V as R,Va as ue,Vi as de,Vn as fe,Wa as pe,Wi as me,X as he,Xa as ge,Xi as _e,Xn as ve,Y as ye,Ya as be,Yi as xe,Za as Se,Zi as Ce,Zn as we,_ as Te,_a as Ee,a as De,aa as Oe,ao as ke,ar as Ae,at as je,ba as Me,bo as Ne,bt as Pe,ca as Fe,co as Ie,d as Le,da as Re,do as ze,dt as Be,ea as Ve,eo as He,er as Ue,et as We,fa as Ge,fo as Ke,ft as qe,g as Je,go as Ye,h as Xe,ho as Ze,ia as Qe,io as $e,ir as et,j as tt,ja as nt,ji as rt,ka as it,l as at,la as ot,li as st,lo as ct,m as lt,ma as z,mi as ut,mo as dt,mt as ft,no as pt,nr as mt,oa as ht,oo as gt,or as _t,ot as vt,pa as yt,po as bt,pt as xt,qa as St,qi as Ct,ra as wt,ro as Tt,rr as Et,rt as Dt,s as Ot,so as kt,t as At,ta as jt,to as Mt,ua as Nt,uo as Pt,va as Ft,vo as It,vt as Lt,w as Rt,wa as zt,wi as Bt,xa as Vt,xo as Ht,xt as Ut,y as Wt,ya as Gt,yi as Kt,yo as qt,yt as Jt,za as Yt,zi as Xt}from"./Effect-BY0T-p9d.js";import{$i as Zt,$r as Qt,Aa as $t,Ar as B,Ba as en,Bn as tn,Br as V,Ca as nn,Ci as rn,Cn as an,Da as on,Di as sn,Dr as cn,Er as ln,Fa as un,Fi as dn,Fr as fn,G as pn,Ga as mn,Gn as hn,Gr as gn,Ia as _n,Ir as vn,Ja as yn,Jn as bn,Jr as xn,Kr as Sn,La as Cn,Lr as wn,Na as Tn,Nr as En,Oa as Dn,Or as On,Pa as kn,Qi as An,Qn as jn,Qr as Mn,Rn as Nn,Rr as Pn,Sa as Fn,Sn as In,Sr as H,Ua as Ln,Ui as Rn,Un as zn,Ur as Bn,Va as Vn,Vn as Hn,Vr as U,Wn as Un,Wr as Wn,Xi as Gn,Xn as Kn,Xr as qn,Ya as Jn,Yr as Yn,Za as Xn,Zi as W,Zr as G,_a as Zn,_n as Qn,_r as $n,aa as er,ai as tr,ar as nr,ba as rr,bn as ir,br as ar,ca as or,cr as sr,dr as cr,er as lr,fa as ur,fi as dr,fr,ga as pr,gr as mr,ha as hr,hi as gr,i as _r,ii as vr,ir as yr,ja as br,ji as xr,jr as Sr,kr as Cr,la as wr,lr as Tr,ma as Er,mi as Dr,mr as Or,n as kr,ni as Ar,nn as jr,nr as Mr,oa as Nr,oi as Pr,or as Fr,pa as Ir,pi as Lr,pr as Rr,qi as zr,qn as Br,qr as Vr,ra as Hr,ri as Ur,sa as Wr,tr as Gr,ua as Kr,ui as qr,ur as Jr,va as Yr,vn as Xr,vr as Zr,wi as Qr,wr as $r,xa as ei,xr as ti,ya as ni,yr as ri,za as ii,zi as K,zr as ai}from"./extension-hook-Ce1QNicQ.js";import{a as oi,o as si,s as ci,t as li}from"./document-DjWTbvB5.js";import{t as ui}from"./preload-helper-DY31Aviq.js";import{a as di,i as fi,n as pi,r as mi,t as hi}from"./base-face-Dc6wvM5e.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 gi=n((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},ee={transition:null},te={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:ee,ReactCurrentOwner:C};function F(){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=te,e.act=F,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=ee.transition;ee.transition={};try{e()}finally{ee.transition=t}},e.unstable_act=F,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`})),_i=n(((e,t)=>{t.exports=gi()})),q=t(_i(),1),vi=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},yi=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function bi(){let e=!1,t=Qi,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=Qi,s(),o.clear())},contribute:t=>{if(Oi(t),e)throw new yi;ki(t,n),Ai(t,n);let r=Symbol(`whistle-contribution`);Di(t)||(n=[...n,{contribution:ji(t),generation:r}],i=!0,s());let a=!0;return Xi(o=>{if(!a||e)return;let c={...t,commands:o};Oi(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);ki(c,u),Ai(c,u);let d=ji(c);if(Di(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.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=Ei(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=ea(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&xi.has(r.origin)&&(o=n({commandId:t,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=na(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 Qi;let a=n.flatMap(e=>e.contribution.commands.map(ea));return(i||a.some((e,t)=>!ta(e,r[t])))&&(t=ra(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var xi=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Si=16,Ci=32,wi=64,Ti=256;function Ei(e,t){for(let n of t)for(let t of n.contribution.commands)if(`${n.contribution.namespace}:${t.id}`===e)return t}function Di(e){return e.commands.length===0}function Oi(e){Ji(e.sourceId,`source ID`),Ji(e.namespace,`namespace`,!0),e.scope!==void 0&&Ji(e.scope,`scope`);for(let t of e.commands)Ui(t)}function ki(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Zi(`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(`${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=`${e.namespace}:${t.id}`;n.has(i)&&Zi(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Zi(`Slash alias is already registered`),r.add(e)}}function Ai(e,t){t.length>=wi&&Zi(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Ti&&Zi(`Live command capacity exceeded`)}function ji(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Mi)};return e.scope===void 0?t:{...t,scope:e.scope}}function Mi(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=Ni(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Li(e.projections)),t}function Ni(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=Pi(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=Pi(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Ii(e.presentation)),Object.freeze(t)}function Pi(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Fi(t)])))}function Fi(e){return Array.isArray(e)?Object.freeze(e.map(Fi)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Fi(t)]))):e}function Ii(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:Pi(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Fi(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Li(e){let t={};return e.bindings!==void 0&&(t.bindings=Ri(e.bindings)),e.agent!==void 0&&(t.agent=zi(e.agent)),e.help!==void 0&&(t.help=Bi(e.help.order)),e.menu!==void 0&&(t.menu=Bi(e.menu.order)),e.palette!==void 0&&(t.palette=Bi(e.palette.order)),e.slash!==void 0&&(t.slash=Vi(e.slash)),t}function Ri(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function zi(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Bi(e){let t={};return e!==void 0&&(t.order=e),t}function Vi(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=Hi(e.arguments)),t}function Hi(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:Pi(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:Pi(e.text.arguments)})),Object.freeze(t)}function Ui(e){Ji(e.id,`command ID`,!0),Ji(e.title,`title`),Ji(e.category,`category`),Wi(e.action),Gi(e.projections)}function Wi(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Ji(t.label,`choice label`),t.description!==void 0&&Ji(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Ji(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Ji(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Ji(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Ji(e.presentation.cancelLabel,`cancellation label`)}}function Gi(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Yi(t.order);if(e.bindings!==void 0&&qi(e.bindings.values,`binding`),e.slash!==void 0){qi(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Zi(`slash alias must not contain whitespace`);Ki(e.slash.arguments)}e.agent?.keybind!==void 0&&Ji(e.agent.keybind,`agent keybind`)}}function Ki(e){if(e===void 0)return;Ji(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Zi(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Ji(n.word,`argument word`),/\s/u.test(n.word)&&Zi(`argument word must not contain whitespace`),t.has(n.word)&&Zi(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Ji(n.description,`argument word description`);t.size>Ci&&Zi(`argument word count exceeds 32`),e.text!==void 0&&(Ji(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Ji(e.text.requestIdField,`request id field`))}function qi(e,t){e.length>Si&&Zi(`${t} count exceeds 16`);for(let n of e)Ji(n,t)}function Ji(e,t,n=!1){e.trim().length===0&&Zi(`${t} must not be blank`),n&&e.includes(`:`)&&Zi(`${t} must not contain a colon`)}function Yi(e){e!==void 0&&!Number.isSafeInteger(e)&&Zi(`order must be a safe integer`)}function Xi(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Zi(e){throw Error(e)}var Qi=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),$i=Object.freeze({status:`available`});function ea(e){let t=e.availability?.()??$i;return t.status===`available`?$i:Object.freeze({status:`unavailable`,reason:t.reason})}function ta(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function na(e){if(e instanceof vi){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Fi(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function ra(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++]??$i;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...ua(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...ua(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...ua(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({...ua(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...ua(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(fa(e,l,u.agent,d))}}return sa(n),ca(i),oa(r),oa(a),oa(o),oa(s),Object.freeze({bindings:la(n),palette:la(r),slash:la(i),help:la(a),menu:la(o),agent:la(s)})}var ia=new TextEncoder;function aa(e,t){let n=ia.encode(e),r=ia.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 oa(e){e.sort((e,t)=>e.order-t.order||aa(e.commandId,t.commandId))}function sa(e){e.sort((e,t)=>e.order-t.order||aa(e.commandId,t.commandId)||aa(e.binding,t.binding))}function ca(e){e.sort((e,t)=>e.order-t.order||aa(e.commandId,t.commandId)||aa(e.alias,t.alias))}function la(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function ua(e,t,n,r){let i=da(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function da(e,t,n,r){let i={commandId:`${e.namespace}:${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 fa(e,t,n,r){let i=ua(e,t,n.order,r),a=i.action===void 0?i:{...i,action:pa(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function pa(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var ma=e({endsWith:()=>u,gt:()=>zt,gte:()=>se,includes:()=>p,length:()=>d,lowercase:()=>N,lt:()=>it,lte:()=>o,maxLength:()=>nt,maxSize:()=>k,mime:()=>j,minLength:()=>P,minSize:()=>m,multipleOf:()=>S,negative:()=>D,nonnegative:()=>Yt,nonpositive:()=>c,normalize:()=>ue,overwrite:()=>y,positive:()=>ce,property:()=>pe,regex:()=>T,size:()=>St,slugify:()=>w,startsWith:()=>be,toLowerCase:()=>Se,toUpperCase:()=>te,trim:()=>i,uppercase:()=>He}),J={...Ge,...ma,iso:Vt},ha=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function ga(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function _a(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function va(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return J.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return J.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=ya(_a(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return J.null();if(n.length===0)return J.never();if(n.length===1)return J.literal(n[0]);if(n.every(e=>typeof e==`string`))return J.enum(n);let r=n.map(e=>J.literal(e));return r.length<2?r[0]:J.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return J.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>va({...e,type:n},t));return r.length===0?J.never():r.length===1?r[0]:J.union(r)}if(!n)return J.any();let r;switch(n){case`string`:{let t=J.string();if(e.format){let n=e.format;n===`email`?t=t.check(J.email()):n===`uri`||n===`uri-reference`?t=t.check(J.url()):n===`uuid`||n===`guid`?t=t.check(J.uuid()):n===`date-time`?t=t.check(J.iso.datetime()):n===`date`?t=t.check(J.iso.date()):n===`time`?t=t.check(J.iso.time()):n===`duration`?t=t.check(J.iso.duration()):n===`ipv4`?t=t.check(J.ipv4()):n===`ipv6`?t=t.check(J.ipv6()):n===`mac`?t=t.check(J.mac()):n===`cidr`?t=t.check(J.cidrv4()):n===`cidr-v6`?t=t.check(J.cidrv6()):n===`base64`?t=t.check(J.base64()):n===`base64url`?t=t.check(J.base64url()):n===`e164`?t=t.check(J.e164()):n===`jwt`?t=t.check(J.jwt()):n===`emoji`?t=t.check(J.emoji()):n===`nanoid`?t=t.check(J.nanoid()):n===`cuid`?t=t.check(J.cuid()):n===`cuid2`?t=t.check(J.cuid2()):n===`ulid`?t=t.check(J.ulid()):n===`xid`?t=t.check(J.xid()):n===`ksuid`&&(t=t.check(J.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?J.number().int():J.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=J.boolean();break;case`null`:r=J.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=ya(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=ya(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?ya(e.additionalProperties,t):J.any();if(Object.keys(n).length===0){r=J.record(i,a);break}let o=J.object(n).passthrough(),s=J.looseRecord(i,a);r=J.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=ya(i[e],t),r=J.string().regex(new RegExp(e));o.push(J.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(J.object(n).passthrough()),s.push(...o),s.length===0)r=J.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=J.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=J.intersection(e,s[t]);r=e}break}let o=J.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(ya(e.additionalProperties,t)):o.passthrough();break}case`array`:{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(e=>ya(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?ya(i,t):void 0;r=o?J.tuple(a).rest(o):J.tuple(a),typeof e.minItems==`number`&&(r=r.check(J.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(J.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>ya(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?ya(e.additionalItems,t):void 0;r=a?J.tuple(n).rest(a):J.tuple(n),typeof e.minItems==`number`&&(r=r.check(J.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(J.maxLength(e.maxItems)))}else if(i!==void 0){let n=ya(i,t),a=J.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=J.array(J.any());break}default:throw Error(`Unsupported type: ${n}`)}return r}function ya(e,t){if(typeof e==`boolean`)return e?J.any():J.never();let n=va(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>ya(e,t)),a=J.union(i);n=r?J.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>ya(e,t)),a=J.xor(i);n=r?J.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf)){if(e.allOf.length===0)n=r?n:J.any();else{let i=r?n:ya(e.allOf[0],t),a=+!r;for(let n=a;n<e.allOf.length;n++)i=J.intersection(i,ya(e.allOf[n],t));n=i}}e.nullable===!0&&t.version===`openapi-3.0`&&(n=J.nullable(n)),e.readOnly===!0&&(n=J.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))ha.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),e.description&&(n=n.describe(e.description)),n}function ba(e,t){if(typeof e==`boolean`)return e?J.any():J.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw Error(`fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas`)}let r={version:ga(n,t?.defaultTarget),defs:n.$defs||n.definitions||{},refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Mt};return ya(n,r)}var xa=wt(),Sa=Qe(()=>jt(`status`,[ot({status:Oe(`available`)}).strict(),ot({status:Oe(`unavailable`),reason:z()}).strict()])),Ca=xa,wa=Qe(()=>Re(z(),Ca)),Ta=e=>Ca.parse(e),Ea=e=>wa.parse(e),Da=Qe(()=>ot({code:z().min(1).max(160),message:z().min(1).max(512),details:Ca.optional()}).strict()),Oa=e=>Da.parse(e),ka=wa,Aa=Qe(()=>z().refine(e=>e.trim().length>0)),ja=Sa,Ma=Qe(()=>Ee([ot({type:Oe(`action`)}).strict(),ot({type:Oe(`custom`),data:wa}).strict(),ot({type:Oe(`choice`),options:_e(ot({value:Ca,label:Aa,description:Aa.optional()}))}).strict(),ot({type:Oe(`form`),submitLabel:Aa.optional()}).strict(),ot({type:Oe(`confirmation`),message:Aa,confirmLabel:Aa.optional(),cancelLabel:Aa.optional()}).strict()])),Na=Qe(()=>ot({inputSchema:ka.optional(),outputSchema:ka.optional(),presentation:Ma.optional()}).strict()),Pa=Qe(()=>Fe().int().refine(e=>Number.isSafeInteger(e))),Fa=Qe(()=>ot({hint:Aa.pipe(z().max(120)),words:_e(ot({word:z().regex(/^\S{1,64}$/u),description:Aa.pipe(z().max(512)).optional(),arguments:wa}).strict()).max(32).optional(),text:ot({field:Aa.pipe(z().max(120)),arguments:wa,requestIdField:Aa.pipe(z().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Ia=Qe(()=>ot({order:Pa.optional()}).strict()),La=Qe(()=>ot({bindings:ot({order:Pa.optional(),values:_e(Aa).max(16)}).strict().optional(),agent:ot({keybind:Aa.optional(),order:Pa.optional()}).strict().optional(),help:Ia.optional(),menu:Ia.optional(),palette:Ia.optional(),slash:ot({aliases:_e(Aa).max(16),consumesDraft:a().optional(),order:Pa.optional(),arguments:Fa.optional()}).strict().optional()}).strict()),Ra=Qe(()=>ot({id:Aa.refine(e=>!e.includes(`:`)),title:Aa,category:Aa,description:Aa.optional(),projections:La.optional(),action:Na.optional(),availability:ja.optional()}).strict()),za=e=>Ra.parse(e),Ba=Qe(()=>ot({inputSchema:ka.optional(),outputSchema:ka.optional()}).strict()),Va=Qe(()=>ot({commandId:z(),sourceId:z(),scope:z().optional(),title:z(),category:z(),description:z().optional(),order:Fe(),availability:Sa,action:Ba.optional(),keybind:z().optional()}).strict());_e(Va);var Ha=8192,Ua=Aa.pipe(z().max(Ha)),Wa=Gt({protocol:/^https?$/u}),Ga=jt(`type`,[ot({type:Oe(`choice`),message:Ua,collapsedGroup:Ua.optional(),options:_e(ot({value:Ua,label:Ua,description:Ua.optional(),group:Ua.optional()}).strict()).min(1).max(256)}).strict(),ot({type:Oe(`text`),message:Ua,placeholder:Ua.optional(),secret:a().optional()}).strict(),ot({type:Oe(`confirmation`),message:Ua,confirmLabel:Ua.optional(),cancelLabel:Ua.optional()}).strict()]),Ka=Qe(()=>jt(`type`,[ot({type:Oe(`info`),message:Ua,links:_e(ot({url:Wa,label:Ua.optional()}).strict()).max(16).optional()}).strict(),ot({type:Oe(`progress`),message:Ua}).strict(),ot({type:Oe(`handoff`),url:Wa,code:Ua.optional(),message:Ua.optional()}).strict(),ot({type:Oe(`success`),message:Ua}).strict()])),qa=e=>Ga.parse(e),Ja=e=>Ka.parse(e),Ya={confirmation:e=>(Ga.options[2].parse(e),a()),text:e=>(Ga.options[1].parse(e),z().max(Ha)),choice:e=>{let t=Ga.options[0].parse(e);return z().refine(e=>t.options.some(t=>t.value===e))}};function Xa(e){let t=Ya[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}function Za(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:Ta(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 Qa=Sr([`InferenceUpstreamError`,`AiInternalError`,`TypeError`,`AbortError`,`TimeoutError`,`Error`]),$a=xn([U({category:Qa,code:wn(cn.check(gr({minimum:0,maximum:99999})))}),U({category:B(`result_download`),status:cn.check(gr({minimum:0,maximum:599}))})]);function eo(e){return Pr($a,{onExcessProperty:`error`})(e)}ba(Hr($a,{onExcessProperty:`error`}).schema).transform(eo);var to=[`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`DELIVERY_PENDING`,`DISCONNECTED`,`FILE_TOO_LARGE`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SELECTION_CHANGED`,`TIMEOUT`];U({name:B(`AppError`),code:Sr(to),retryable:$r});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}};me(`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 no=`data-theme`;function ro(e){return e||(globalThis.document?.documentElement??null)}function io(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function ao(e,t){let n=io(e),r=ro(t);r&&r.setAttribute(no,n)}function oo(e){return ro(e)?.getAttribute(no)??null}var so=n((e=>{var t=_i(),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})),co=n(((e,t)=>{t.exports=so()})),X=co(),lo=q.createContext(void 0),uo=e=>{let t=q.useContext(lo);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},fo=({client:e,children:t})=>(q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(lo.Provider,{value:e,children:t})),po={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},mo=new class{#e=po;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 ho(e){setTimeout(e,0)}var go=typeof window>`u`||`Deno`in globalThis;function _o(){}function vo(e,t){return typeof e==`function`?e(t):e}function yo(e){return typeof e==`number`&&e>=0&&e!==1/0}function bo(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xo(e,t){return typeof e==`function`?e(t):e}function So(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==wo(o,t.options))return!1}else if(!Eo(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 Co(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(To(t.options.mutationKey)!==To(a))return!1}else if(!Eo(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function wo(e,t){return(t?.queryKeyHashFn||To)(e)}function To(e){return JSON.stringify(e,(e,t)=>jo(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Eo(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(!Eo(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Eo(e[r],t[r]))return!1;return!0}return!1}var Do=Object.prototype.hasOwnProperty;function Oo(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ao(e)&&Ao(t);if(!r&&!(jo(e)&&jo(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:Do.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Oo(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ko(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 Ao(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function jo(e){if(!Mo(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Mo(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Mo(e){return Object.prototype.toString.call(e)===`[object Object]`}function No(e){return new Promise(t=>{mo.setTimeout(t,e)})}function Po(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Oo(e,t)}function Fo(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Io(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Lo=Symbol();function Ro(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Lo?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function zo(e,t){return typeof e==`function`?e(...t):!!e}function Bo(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 Vo=()=>go,Ho=()=>Vo(),Uo=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(){}},Wo=new class extends Uo{#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`}},Go=ho;function Ko(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Go,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 qo=Ko(),Jo=new class extends Uo{#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 Yo(e){return Math.min(1e3*2**e,3e4)}function Xo(e){return(e??`online`)!==`online`||Jo.isOnline()}var Zo=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Qo(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(_o);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Zo(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Wo.isFocused()&&(e.networkMode===`always`||Jo.isOnline())&&e.canRun(),p=()=>Xo(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??(Ho()?0:3),a=e.retryDelay??Yo,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),No(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 $o=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yo(this.gcTime)&&(this.#e=mo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ho()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(mo.clearTimeout(this.#e),this.#e=void 0)}};function es(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=>{Bo(e,()=>t.signal,()=>n=!0)},u=Ro(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?Io:Fo;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ns:ts,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:ts(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 ts(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 ns(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function rs(e,t){return t?ts(e,t)!=null:!1}function is(e,t){return!t||!e.getPreviousPageParam?!1:ns(e,t)!=null}var as=class extends $o{#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=cs(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=cs(this.options);e.data!==void 0&&(this.setState(ss(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Po(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(_o).catch(_o):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=>xo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Lo||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>xo(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:!bo(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=Ro(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`?es(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=Qo({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Zo&&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 Zo){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,...os(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ss(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),qo.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function os(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xo(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ss(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function cs(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 ls=class extends Uo{#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),ds(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fs(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fs(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 xo(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&&!ko(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ps(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||xo(this.options.enabled,this.#t)!==xo(t.enabled,this.#t)||xo(this.options.staleTime,this.#t)!==xo(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||xo(this.options.enabled,this.#t)!==xo(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 ko(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(_o)),t}#h(e){return!Ho()&&xo(this.options.enabled,this.#t)!==!1&&yo(e)}#g(){this.#b();let e=xo(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=bo(this.#r.dataUpdatedAt,e)+1;this.#u=mo.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=mo.setInterval(()=>{(this.options.refetchIntervalInBackground||Wo.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(mo.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(mo.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&&ds(e,t),o=i&&ps(e,n,t,r);(a||o)&&(l={...l,...os(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=Po(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=Po(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:ms(e,t),refetch:this.refetch,isEnabled:xo(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),ko(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)})})();qo.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 us(e,t){return xo(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||xo(t.retryOnMount,e)!==!1)}function ds(e,t){return us(e,t)||e.state.data!==void 0&&fs(e,t,t.refetchOnMount)}function fs(e,t,n){if(xo(t.enabled,e)!==!1&&xo(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ms(e,t)}return!1}function ps(e,t,n,r){return(e!==t||xo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ms(e,n)}function ms(e,t){return xo(t.enabled,e)!==!1&&e.isStaleByTime(xo(t.staleTime,e))}var hs=class extends ls{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:rs(t,n.data),hasPreviousPage:is(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},gs=class extends $o{#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||_s(),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=Qo({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),qo.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function _s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var vs=class extends Uo{#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 gs({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=ys(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=ys(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=ys(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=ys(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){qo.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=>Co(t,e))}findAll(e={}){return this.getAll().filter(t=>Co(e,t))}notify(e){qo.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return qo.batch(()=>Promise.all(e.map(e=>e.continue().catch(_o))))}};function ys(e){return e.options.scope?.id}var bs=class extends Uo{#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),ko(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&To(t.mutationKey)!==To(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??_s();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){qo.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 xs(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Ss=class extends Uo{#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,qo.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||!ko(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(xs(e,n).forEach(e=>{e.destroy()}),xs(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=Oo(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 ls(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)&&qo.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Cs=class extends Uo{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??wo(r,t),a=this.get(i);return a||(a=new as({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(){qo.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=>So(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>So(e,t)):t}notify(e){qo.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){qo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){qo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ws=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Cs,this.#t=e.mutationCache||new vs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Wo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Jo.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(xo(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=vo(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return qo.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;qo.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return qo.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=qo.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_o).catch(_o)}invalidateQueries(e,t={}){return qo.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=qo.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(_o)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_o)}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(xo(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(xo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_o).catch(_o)}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(_o).catch(_o)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Jo.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(To(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Eo(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(To(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Eo(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||=wo(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===Lo&&(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 Ts({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Fo(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(Bo({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 Es=q.createContext(!1),Ds=()=>q.useContext(Es);Es.Provider;function Os(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ks=q.createContext(Os()),As=()=>q.useContext(ks),js=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?zo(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ms=e=>{q.useEffect(()=>{e.clearReset()},[e])},Ns=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||zo(n,[e.error,r])),Ps=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))}},Fs=(e,t)=>e?.suspense&&t.isPending,Is=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ls({queries:e,...t},n){let r=uo(n),i=Ds(),a=As(),o=t.subscribed!==!1,s=q.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=>{Ps(e);let t=r.getQueryCache().get(e.queryHash);js(e,a,t)}),Ms(a);let[c]=q.useState(()=>new Ss(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;q.useSyncExternalStore(q.useCallback(e=>f?c.subscribe(qo.batchCalls(e)):_o,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),q.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>Fs(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Fs(n,e)?Is(n,new ls(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Ns({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 Rs(e,t,n){let r=Ds(),i=As(),a=uo(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ps(o),js(o,i,s),Ms(i);let[l]=q.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(q.useSyncExternalStore(q.useCallback(e=>{let t=d?l.subscribe(qo.batchCalls(e)):_o;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),q.useEffect(()=>{l.setOptions(o)},[o,l]),Fs(o,u))throw Is(o,l,i);if(Ns({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function zs(e,t){return Rs(e,ls,t)}function Bs(e){return e}function Vs(e){return e}function Hs(e,t){let n=uo(t),[r]=q.useState(()=>new bs(n,e));q.useEffect(()=>{r.setOptions(e)},[r,e]);let i=q.useSyncExternalStore(q.useCallback(e=>r.subscribe(qo.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(_o)},[r]);if(i.error&&zo(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Us=n((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}}}})),Ws=n(((e,t)=>{t.exports=Us()})),Gs=n((e=>{var t=_i(),n=Ws();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`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Object.assign,ne;function re(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``}return`
3
+ `+ne+e}var ie=!1;function ae(e,t){if(!e||ie)return``;ie=!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
+ `),a=r.stack.split(`
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=`
6
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ie=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?re(e):``}function I(e){switch(e.tag){case 5:return re(e.type);case 16:return re(`Lazy`);case 13:return re(`Suspense`);case 19:return re(`SuspenseList`);case 0:case 2:case 15:return e=ae(e.type,!1),e;case 11:return e=ae(e.type.render,!1),e;case 1:return e=ae(e.type,!0),e;default:return``}}function oe(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case w:return`Fragment`;case C:return`Portal`;case E:return`Profiler`;case T:return`StrictMode`;case A:return`Suspense`;case j:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case O:return(e.displayName||`Context`)+`.Consumer`;case D:return(e._context.displayName||`Context`)+`.Provider`;case k:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function se(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return oe(t);case 8:return t===T?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function L(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ce(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function le(e){var t=ce(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function R(e){e._valueTracker||=le(e)}function ue(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ce(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function de(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function fe(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pe(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=L(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function me(e,t){t=t.checked,t!=null&&b(e,`checked`,t,!1)}function he(e,t){me(e,t);var n=L(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?_e(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&_e(e,t.type,L(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ge(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function _e(e,t,n){(t!==`number`||de(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ve=Array.isArray;function ye(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+L(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function be(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function xe(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ve(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:L(n)}}function Se(e,t){var n=L(t.value),r=L(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Ce(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function we(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Te(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?we(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ee,De=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ee||=document.createElement(`div`),Ee.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ee.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ke={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(ke).forEach(function(e){Ae.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ke[t]=ke[e]})});function je(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||ke.hasOwnProperty(e)&&ke[e]?(``+t).trim():t+`px`}function Me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=je(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ne=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(Ne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,ze=null,Be=null;function Ve(e){if(e=Pi(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ii(t),Re(e.stateNode,e.type,t))}}function He(e){ze?Be?Be.push(e):Be=[e]:ze=e}function Ue(){if(ze){var e=ze,t=Be;if(Be=ze=null,Ve(e),t)for(e=0;e<t.length;e++)Ve(t[e])}}function We(e,t){return e(t)}function Ge(){}var Ke=!1;function qe(e,t,n){if(Ke)return e(t,n);Ke=!0;try{return We(e,t,n)}finally{Ke=!1,(ze!==null||Be!==null)&&(Ge(),Ue())}}function Je(e,t){var n=e.stateNode;if(n===null)return null;var i=Ii(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ye=!1;if(c)try{var Xe={};Object.defineProperty(Xe,"passive",{get:function(){Ye=!0}}),window.addEventListener(`test`,Xe,Xe),window.removeEventListener(`test`,Xe,Xe)}catch{Ye=!1}function Ze(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Qe=!1,$e=null,et=!1,tt=null,nt={onError:function(e){Qe=!0,$e=e}};function rt(e,t,n,r,i,a,o,s,c){Qe=!1,$e=null,Ze.apply(nt,arguments)}function it(e,t,n,i,a,o,s,c,l){if(rt.apply(this,arguments),Qe){if(Qe){var u=$e;Qe=!1,$e=null}else throw Error(r(198));et||(et=!0,tt=u)}}function at(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ot(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function st(e){if(at(e)!==e)throw Error(r(188))}function ct(e){var t=e.alternate;if(!t){if(t=at(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return st(a),e;if(o===i)return st(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function lt(e){return e=ct(e),e===null?null:z(e)}function z(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=z(e);if(t!==null)return t;e=e.sibling}return null}var ut=n.unstable_scheduleCallback,dt=n.unstable_cancelCallback,ft=n.unstable_shouldYield,pt=n.unstable_requestPaint,mt=n.unstable_now,ht=n.unstable_getCurrentPriorityLevel,gt=n.unstable_ImmediatePriority,_t=n.unstable_UserBlockingPriority,vt=n.unstable_NormalPriority,yt=n.unstable_LowPriority,bt=n.unstable_IdlePriority,xt=null,St=null;function Ct(e){if(St&&typeof St.onCommitFiberRoot==`function`)try{St.onCommitFiberRoot(xt,e,void 0,(e.current.flags&128)==128)}catch{}}var wt=Math.clz32?Math.clz32:Dt,Tt=Math.log,Et=Math.LN2;function Dt(e){return e>>>=0,e===0?32:31-(Tt(e)/Et|0)|0}var Ot=64,kt=4194304;function At(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function jt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=At(a))):r=At(s)}else o=n&~i,o===0?a!==0&&(r=At(a)):r=At(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-wt(t),i=1<<n,r|=e[n],t&=~i;return r}function Mt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-wt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Mt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Pt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Ft(){var e=Ot;return Ot<<=1,!(Ot&4194240)&&(Ot=64),e}function It(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Lt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-wt(t),e[t]=n}function Rt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-wt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function zt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-wt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Bt=0;function Vt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ht,Ut,Wt,Gt,Kt,qt=!1,Jt=[],Yt=null,Xt=null,Zt=null,Qt=new Map,$t=new Map,B=[],en=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function tn(e,t){switch(e){case`focusin`:case`focusout`:Yt=null;break;case`dragenter`:case`dragleave`:Xt=null;break;case`mouseover`:case`mouseout`:Zt=null;break;case`pointerover`:case`pointerout`:Qt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:$t.delete(t.pointerId)}}function V(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Pi(t),t!==null&&Ut(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function nn(e,t,n,r,i){switch(t){case`focusin`:return Yt=V(Yt,e,t,n,r,i),!0;case`dragenter`:return Xt=V(Xt,e,t,n,r,i),!0;case`mouseover`:return Zt=V(Zt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Qt.set(a,V(Qt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,$t.set(a,V($t.get(a)||null,e,t,n,r,i)),!0}return!1}function rn(e){var t=Ni(e.target);if(t!==null){var n=at(t);if(n!==null){if(t=n.tag,t===13){if(t=ot(n),t!==null){e.blockedOn=t,Kt(e.priority,function(){Wt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function an(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ie=r,n.target.dispatchEvent(r),Ie=null}else return t=Pi(n),t!==null&&Ut(t),e.blockedOn=n,!1;t.shift()}return!0}function on(e,t,n){an(e)&&n.delete(t)}function sn(){qt=!1,Yt!==null&&an(Yt)&&(Yt=null),Xt!==null&&an(Xt)&&(Xt=null),Zt!==null&&an(Zt)&&(Zt=null),Qt.forEach(on),$t.forEach(on)}function cn(e,t){e.blockedOn===t&&(e.blockedOn=null,qt||(qt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,sn)))}function ln(e){function t(t){return cn(t,e)}if(0<Jt.length){cn(Jt[0],e);for(var n=1;n<Jt.length;n++){var r=Jt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yt!==null&&cn(Yt,e),Xt!==null&&cn(Xt,e),Zt!==null&&cn(Zt,e),Qt.forEach(t),$t.forEach(t),n=0;n<B.length;n++)r=B[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<B.length&&(n=B[0],n.blockedOn===null);)rn(n),n.blockedOn===null&&B.shift()}var un=x.ReactCurrentBatchConfig,dn=!0;function fn(e,t,n,r){var i=Bt,a=un.transition;un.transition=null;try{Bt=1,mn(e,t,n,r)}finally{Bt=i,un.transition=a}}function pn(e,t,n,r){var i=Bt,a=un.transition;un.transition=null;try{Bt=4,mn(e,t,n,r)}finally{Bt=i,un.transition=a}}function mn(e,t,n,r){if(dn){var i=gn(e,t,n,r);if(i===null)ai(e,t,r,hn,n),tn(e,r);else if(nn(i,e,t,n,r))r.stopPropagation();else if(tn(e,r),t&4&&-1<en.indexOf(e)){for(;i!==null;){var a=Pi(i);if(a!==null&&Ht(a),a=gn(e,t,n,r),a===null&&ai(e,t,r,hn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ai(e,t,r,null,n)}}var hn=null;function gn(e,t,n,r){if(hn=null,e=Le(r),e=Ni(e),e!==null){if(t=at(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ot(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return hn=e,null}function _n(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(ht()){case gt:return 1;case _t:return 4;case vt:case yt:return 16;case bt:return 536870912;default:return 16}default:return 16}}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return F(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=F({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=F({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:U,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(F({},Nn,{dataTransfer:0})),In=Tn(F({},On,{relatedTarget:0})),H=Tn(F({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=Tn(F({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=Tn(F({},En,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function U(){return Hn}var Un=Tn(F({},On,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:U,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Wn=Tn(F({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Gn=Tn(F({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:U})),Kn=Tn(F({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),qn=Tn(F({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Jn=[9,13,27,32],Yn=c&&`CompositionEvent`in window,Xn=null;c&&`documentMode`in document&&(Xn=document.documentMode);var W=c&&`TextEvent`in window&&!Xn,G=c&&(!Yn||Xn&&8<Xn&&11>=Xn),Zn=` `,Qn=!1;function $n(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function er(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var tr=!1;function nr(e,t){switch(e){case`compositionend`:return er(t);case`keypress`:return t.which===32?(Qn=!0,Zn):null;case`textInput`:return e=t.data,e===Zn&&Qn?null:e;default:return null}}function rr(e,t){if(tr)return e===`compositionend`||!Yn&&$n(e,t)?(e=xn(),bn=yn=vn=null,tr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return G&&t.locale!==`ko`?null:t.data;default:return null}}var ir={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ir[e.type]:t===`textarea`}function or(e,t,n,r){He(r),t=si(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var sr=null,cr=null;function lr(e){ei(e,0)}function ur(e){if(ue(Fi(e)))return e}function dr(e,t){if(e===`change`)return t}var fr=!1;if(c){var pr;if(c){var mr=`oninput`in document;if(!mr){var hr=document.createElement(`div`);hr.setAttribute(`oninput`,`return;`),mr=typeof hr.oninput==`function`}pr=mr}else pr=!1;fr=pr&&(!document.documentMode||9<document.documentMode)}function gr(){sr&&(sr.detachEvent(`onpropertychange`,_r),cr=sr=null)}function _r(e){if(e.propertyName===`value`&&ur(cr)){var t=[];or(t,cr,e,Le(e)),qe(lr,t)}}function vr(e,t,n){e===`focusin`?(gr(),sr=t,cr=n,sr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&gr()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ur(cr)}function br(e,t){if(e===`click`)return ur(t)}function xr(e,t){if(e===`input`||e===`change`)return ur(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(){for(var e=window,t=de();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=de(e.document)}return t}function kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Ar(e){var t=Or(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Dr(n.ownerDocument.documentElement,n)){if(r!==null&&kr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Er(n,a);var o=Er(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var jr=c&&`documentMode`in document&&11>=document.documentMode,Mr=null,Nr=null,Pr=null,Fr=!1;function Ir(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fr||Mr==null||Mr!==de(r)||(r=Mr,`selectionStart`in r&&kr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pr&&wr(Pr,r)||(Pr=r,r=si(Nr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Mr)))}function Lr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Rr={animationend:Lr(`Animation`,`AnimationEnd`),animationiteration:Lr(`Animation`,`AnimationIteration`),animationstart:Lr(`Animation`,`AnimationStart`),transitionend:Lr(`Transition`,`TransitionEnd`)},zr={},Br={};c&&(Br=document.createElement(`div`).style,`AnimationEvent`in window||(delete Rr.animationend.animation,delete Rr.animationiteration.animation,delete Rr.animationstart.animation),`TransitionEvent`in window||delete Rr.transitionend.transition);function Vr(e){if(zr[e])return zr[e];if(!Rr[e])return e;var t=Rr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Br)return zr[e]=t[n];return e}var Hr=Vr(`animationend`),Ur=Vr(`animationiteration`),Wr=Vr(`animationstart`),Gr=Vr(`transitionend`),Kr=new Map,qr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Jr(e,t){Kr.set(e,t),o(t,[e])}for(var Yr=0;Yr<qr.length;Yr++){var Xr=qr[Yr];Jr(Xr.toLowerCase(),`on`+(Xr[0].toUpperCase()+Xr.slice(1)))}Jr(Hr,`onAnimationEnd`),Jr(Ur,`onAnimationIteration`),Jr(Wr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Gr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Zr=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Qr=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Zr));function $r(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,it(r,t,void 0,e),e.currentTarget=null}function ei(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;$r(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;$r(i,s,l),a=c}}}if(et)throw e=tt,et=!1,tt=null,e}function ti(e,t){var n=t[Ai];n===void 0&&(n=t[Ai]=new Set);var r=e+`__bubble`;n.has(r)||(K(t,e,2,!1),n.add(r))}function ni(e,t,n){var r=0;t&&(r|=4),K(n,e,r,t)}var ri=`_reactListening`+Math.random().toString(36).slice(2);function ii(e){if(!e[ri]){e[ri]=!0,i.forEach(function(t){t!==`selectionchange`&&(Qr.has(t)||ni(t,!1,e),ni(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ri]||(t[ri]=!0,ni(`selectionchange`,!1,t))}}function K(e,t,n,r){switch(_n(t)){case 1:var i=fn;break;case 4:i=pn;break;default:i=mn}n=i.bind(null,t,n,e),i=void 0,!Ye||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ai(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ni(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}qe(function(){var r=a,i=Le(n),o=[];a:{var s=Kr.get(e);if(s!==void 0){var c=Dn,l=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:c=Un;break;case`focusin`:l=`focus`,c=In;break;case`focusout`:l=`blur`,c=In;break;case`beforeblur`:case`afterblur`:c=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Gn;break;case Hr:case Ur:case Wr:c=H;break;case Gr:c=Kn;break;case`scroll`:c=kn;break;case`wheel`:c=qn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Wn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Je(p,f),h!=null&&u.push(oi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ie&&(l=n.relatedTarget||n.fromElement)&&(Ni(l)||l[ki]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ni(l):null,l!==null&&(d=at(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Pn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Wn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Fi(c),m=l==null?s:Fi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ni(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ci(m))p++;for(m=0,h=f;h;h=ci(h))m++;for(;0<p-m;)u=ci(u),p--;for(;0<m-p;)f=ci(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ci(u),f=ci(f)}u=null}else u=null;c!==null&&li(o,s,c,u,!1),l!==null&&d!==null&&li(o,d,l,u,!0)}}a:{if(s=r?Fi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=dr;else if(ar(s)){if(fr)g=xr;else{g=yr;var _=vr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=br);if(g&&=g(e,r)){or(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&_e(s,`number`,s.value)}switch(_=r?Fi(r):window,e){case`focusin`:(ar(_)||_.contentEditable===`true`)&&(Mr=_,Nr=r,Pr=null);break;case`focusout`:Pr=Nr=Mr=null;break;case`mousedown`:Fr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Fr=!1,Ir(o,n,i);break;case`selectionchange`:if(jr)break;case`keydown`:case`keyup`:Ir(o,n,i)}var v;if(Yn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else tr?$n(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(G&&n.locale!==`ko`&&(tr||y!==`onCompositionStart`?y===`onCompositionEnd`&&tr&&(v=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,tr=!0)),_=si(r,y),0<_.length&&(y=new Rn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=er(n),v!==null&&(y.data=v)))),(v=W?nr(e,n):rr(e,n))&&(r=si(r,`onBeforeInput`),0<r.length&&(i=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ei(o,t)})}function oi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function si(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Je(e,n),a!=null&&r.unshift(oi(e,a,i)),a=Je(e,t),a!=null&&r.push(oi(e,a,i))),e=e.return}return r}function ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function li(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Je(n,a),c!=null&&o.unshift(oi(n,c,s))):i||(c=Je(n,a),c!=null&&o.push(oi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ui=/\r\n?/g,di=/\u0000|\uFFFD/g;function fi(e){return(typeof e==`string`?e:``+e).replace(ui,`
7
+ `).replace(di,``)}function pi(e,t,n){if(t=fi(t),fi(e)!==t&&n)throw Error(r(425))}function mi(){}var hi=null,gi=null;function q(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vi=typeof setTimeout==`function`?setTimeout:void 0,yi=typeof clearTimeout==`function`?clearTimeout:void 0,bi=typeof Promise==`function`?Promise:void 0,xi=typeof queueMicrotask==`function`?queueMicrotask:bi===void 0?vi:function(e){return bi.resolve(null).then(e).catch(Si)};function Si(e){setTimeout(function(){throw e})}function Ci(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),ln(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);ln(t)}function wi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Ti(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ei=Math.random().toString(36).slice(2),Di=`__reactFiber$`+Ei,Oi=`__reactProps$`+Ei,ki=`__reactContainer$`+Ei,Ai=`__reactEvents$`+Ei,ji=`__reactListeners$`+Ei,Mi=`__reactHandles$`+Ei;function Ni(e){var t=e[Di];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ki]||n[Di]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ti(e);e!==null;){if(n=e[Di])return n;e=Ti(e)}return t}e=n,n=e.parentNode}return null}function Pi(e){return e=e[Di]||e[ki],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Fi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ii(e){return e[Oi]||null}var Li=[],Ri=-1;function zi(e){return{current:e}}function Bi(e){0>Ri||(e.current=Li[Ri],Li[Ri]=null,Ri--)}function Vi(e,t){Ri++,Li[Ri]=e.current,e.current=t}var Hi={},Ui=zi(Hi),Wi=zi(!1),Gi=Hi;function Ki(e,t){var n=e.type.contextTypes;if(!n)return Hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qi(e){return e=e.childContextTypes,e!=null}function Ji(){Bi(Wi),Bi(Ui)}function Yi(e,t,n){if(Ui.current!==Hi)throw Error(r(168));Vi(Ui,t),Vi(Wi,n)}function Xi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,se(e)||`Unknown`,a));return F({},n,i)}function Zi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Hi,Gi=Ui.current,Vi(Ui,e),Vi(Wi,Wi.current),!0}function Qi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Xi(e,t,Gi),i.__reactInternalMemoizedMergedChildContext=e,Bi(Wi),Bi(Ui),Vi(Ui,e)):Bi(Wi),Vi(Wi,n)}var $i=null,ea=!1,ta=!1;function na(e){$i===null?$i=[e]:$i.push(e)}function ra(e){ea=!0,na(e)}function ia(){if(!ta&&$i!==null){ta=!0;var e=0,t=Bt;try{var n=$i;for(Bt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$i=null,ea=!1}catch(t){throw $i!==null&&($i=$i.slice(e+1)),ut(gt,ia),t}finally{Bt=t,ta=!1}}return null}var aa=[],oa=0,sa=null,ca=0,la=[],ua=0,da=null,fa=1,pa=``;function ma(e,t){aa[oa++]=ca,aa[oa++]=sa,sa=e,ca=t}function J(e,t,n){la[ua++]=fa,la[ua++]=pa,la[ua++]=da,da=e;var r=fa;e=pa;var i=32-wt(r)-1;r&=~(1<<i),n+=1;var a=32-wt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,fa=1<<32-wt(t)+i|n<<i|r,pa=a+e}else fa=1<<a|n<<i|r,pa=e}function ha(e){e.return!==null&&(ma(e,1),J(e,1,0))}function ga(e){for(;e===sa;)sa=aa[--oa],aa[oa]=null,ca=aa[--oa],aa[oa]=null;for(;e===da;)da=la[--ua],la[ua]=null,pa=la[--ua],la[ua]=null,fa=la[--ua],la[ua]=null}var _a=null,va=null,ya=!1,ba=null;function xa(e,t){var n=Jl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Sa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,_a=e,va=wi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,_a=e,va=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=da===null?null:{id:fa,overflow:pa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Jl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,_a=e,va=null,!0);default:return!1}}function Ca(e){return!!(e.mode&1)&&!(e.flags&128)}function wa(e){if(ya){var t=va;if(t){var n=t;if(!Sa(e,t)){if(Ca(e))throw Error(r(418));t=wi(n.nextSibling);var i=_a;t&&Sa(e,t)?xa(i,n):(e.flags=e.flags&-4097|2,ya=!1,_a=e)}}else{if(Ca(e))throw Error(r(418));e.flags=e.flags&-4097|2,ya=!1,_a=e}}}function Ta(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;_a=e}function Ea(e){if(e!==_a)return!1;if(!ya)return Ta(e),ya=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!q(e.type,e.memoizedProps)),t&&=va){if(Ca(e))throw Da(),Error(r(418));for(;t;)xa(e,t),t=wi(t.nextSibling)}if(Ta(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){va=wi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}va=null}}else va=_a?wi(e.stateNode.nextSibling):null;return!0}function Da(){for(var e=va;e;)e=wi(e.nextSibling)}function Oa(){va=_a=null,ya=!1}function ka(e){ba===null?ba=[e]:ba.push(e)}var Aa=x.ReactCurrentBatchConfig;function ja(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ma(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Na(e){var t=e._init;return t(e._payload)}function Pa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Zl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=tu(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===w?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===N&&Na(i)===t.type)?(r=a(t,n.props),r.ref=ja(e,t,n),r.return=e,r):(r=Ql(n.type,n.key,n.props,null,e.mode,r),r.ref=ja(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=nu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=$l(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=tu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case S:return n=Ql(t.type,t.key,t.props,null,e.mode,n),n.ref=ja(e,null,t),n.return=e,n;case C:return t=nu(t,e.mode,n),t.return=e,t;case N:var r=t._init;return f(e,r(t._payload),n)}if(ve(t)||te(t))return t=$l(t,e.mode,n,null),t.return=e,t;Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case S:return n.key===i?l(e,t,n,r):null;case C:return n.key===i?u(e,t,n,r):null;case N:return i=n._init,p(e,t,i(n._payload),r)}if(ve(n)||te(n))return i===null?d(e,t,n,r,null):null;Ma(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case S:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case C:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ve(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);Ma(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ya&&ma(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ya&&ma(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),ya&&ma(r,h),l}function g(a,s,c,l){var u=te(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ya&&ma(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ya&&ma(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ya&&ma(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===w&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case S:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===w){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===N&&Na(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ja(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===w?(r=$l(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Ql(i.type,i.key,i.props,null,e.mode,o),o.ref=ja(e,r,i),o.return=e,e=o)}return s(e);case C:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=nu(i,e.mode,o),r.return=e,e=r}return s(e);case N:return l=i._init,_(e,r,l(i._payload),o)}if(ve(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Ma(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=tu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Fa=Pa(!0),Ia=Pa(!1),La=zi(null),Ra=null,za=null,Ba=null;function Va(){Ba=za=Ra=null}function Ha(e){var t=La.current;Bi(La),e._currentValue=t}function Ua(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Wa(e,t){Ra=e,Ba=za=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ms=!0),e.firstContext=null)}function Ga(e){var t=e._currentValue;if(Ba!==e){if(e={context:e,memoizedValue:t,next:null},za===null){if(Ra===null)throw Error(r(308));za=e,Ra.dependencies={lanes:0,firstContext:e}}else za=za.next=e}return t}var Ka=null;function qa(e){Ka===null?Ka=[e]:Ka.push(e)}function Ja(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,qa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ya(e,r)}function Ya(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Xa=!1;function Za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function $a(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function eo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Ya(e,n)}return i=r.interleaved,i===null?(t.next=t,qa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ya(e,n)}function to(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zt(e,n)}}function Y(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function no(e,t,n,r){var i=e.updateQueue;Xa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:Xa=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function ro(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var io={},ao=zi(io),oo=zi(io),so=zi(io);function co(e){if(e===io)throw Error(r(174));return e}function X(e,t){switch(Vi(so,t),Vi(oo,e),Vi(ao,io),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Te(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Te(t,e)}Bi(ao),Vi(ao,t)}function lo(){Bi(ao),Bi(oo),Bi(so)}function uo(e){co(so.current);var t=co(ao.current),n=Te(t,e.type);t!==n&&(Vi(oo,e),Vi(ao,n))}function fo(e){oo.current===e&&(Bi(ao),Bi(oo))}var po=zi(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=[];function go(){for(var e=0;e<ho.length;e++)ho[e]._workInProgressVersionPrimary=null;ho.length=0}var _o=x.ReactCurrentDispatcher,vo=x.ReactCurrentBatchConfig,yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=0,Eo=0;function Do(){throw Error(r(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function ko(e,t,n,i,a,o){if(yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_o.current=e===null||e.memoizedState===null?fs:ps,e=n(i,a),wo){o=0;do{if(wo=!1,To=0,25<=o)throw Error(r(301));o+=1,So=xo=null,t.updateQueue=null,_o.current=ms,e=n(i,a)}while(wo)}if(_o.current=ds,t=xo!==null&&xo.next!==null,yo=0,So=xo=bo=null,Co=!1,t)throw Error(r(300));return e}function Ao(){var e=To!==0;return To=0,e}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Mo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw Error(r(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=xo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((yo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,bo.lanes|=d,Xc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Cr(i,t.memoizedState)||(Ms=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,bo.lanes|=o,Xc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Cr(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(e,t){var n=bo,i=Mo(),a=t(),o=!Cr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ms=!0),i=i.queue,Yo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Wo(9,zo.bind(null,n,i,a,t),void 0,null),Uc===null)throw Error(r(349));yo&30||Ro(n,t,a)}return a}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function Ho(e){var t=Ya(e,1);t!==null&&gl(t,e,1,-1)}function Uo(e){var t=jo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t.queue=e,e=e.dispatch=ss.bind(null,bo,e),[t.memoizedState,e]}function Wo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Go(){return Mo().memoizedState}function Ko(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Wo(1|t,n,void 0,r===void 0?null:r)}function qo(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=void 0;if(xo!==null){var o=xo.memoizedState;if(a=o.destroy,r!==null&&Oo(r,o.deps)){i.memoizedState=Wo(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Wo(1|t,n,a,r)}function Jo(e,t){return Ko(8390656,8,e,t)}function Yo(e,t){return qo(2048,8,e,t)}function Xo(e,t){return qo(4,2,e,t)}function Zo(e,t){return qo(4,4,e,t)}function Qo(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $o(e,t,n){return n=n==null?null:n.concat([e]),qo(4,4,Qo.bind(null,t,e),n)}function es(){}function ts(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ns(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rs(e,t,n){return yo&21?(Cr(n,t)||(n=Ft(),bo.lanes|=n,Xc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ms=!0),e.memoizedState=n)}function is(e,t){var n=Bt;Bt=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{Bt=n,vo.transition=r}}function as(){return Mo().memoizedState}function os(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cs(e))ls(t,n);else if(n=Ja(e,t,n,r),n!==null){var i=ml();gl(n,e,r,i),us(n,t,r)}}function ss(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cs(e))ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Cr(s,o)){var c=t.interleaved;c===null?(i.next=i,qa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ja(e,t,i,r),n!==null&&(i=ml(),gl(n,e,r,i),us(n,t,r))}}function cs(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function ls(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function us(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zt(e,n)}}var ds={readContext:Ga,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useInsertionEffect:Do,useLayoutEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useMutableSource:Do,useSyncExternalStore:Do,useId:Do,unstable_isNewReconciler:!1},fs={readContext:Ga,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:Ga,useEffect:Jo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Ko(4194308,4,Qo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=os.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:es,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=is.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=bo,a=jo();if(ya){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Uc===null)throw Error(r(349));yo&30||Ro(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Jo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Wo(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Uc.identifierPrefix;if(ya){var n=pa,r=fa;n=(r&~(1<<32-wt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Eo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ps={readContext:Ga,useCallback:ts,useContext:Ga,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Po,useRef:Go,useState:function(){return Po(No)},useDebugValue:es,useDeferredValue:function(e){return rs(Mo(),xo.memoizedState,e)},useTransition:function(){return[Po(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1},ms={readContext:Ga,useCallback:ts,useContext:Ga,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Fo,useRef:Go,useState:function(){return Fo(No)},useDebugValue:es,useDeferredValue:function(e){var t=Mo();return xo===null?t.memoizedState=e:rs(t,xo.memoizedState,e)},useTransition:function(){return[Fo(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1};function hs(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:F({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var _s={isMounted:function(e){return(e=e._reactInternals)?at(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ml(),i=hl(e),a=$a(r,i);a.payload=t,n!=null&&(a.callback=n),t=eo(e,a,i),t!==null&&(gl(t,e,i,r),to(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ml(),i=hl(e),a=$a(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=eo(e,a,i),t!==null&&(gl(t,e,i,r),to(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ml(),r=hl(e),i=$a(n,r);i.tag=2,t!=null&&(i.callback=t),t=eo(e,i,r),t!==null&&(gl(t,e,r,n),to(t,e,r))}};function vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!wr(n,r)||!wr(i,a):!0}function ys(e,t,n){var r=!1,i=Hi,a=t.contextType;return typeof a==`object`&&a?a=Ga(a):(i=qi(t)?Gi:Ui.current,r=t.contextTypes,a=(r=r!=null)?Ki(e,i):Hi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_s,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&_s.enqueueReplaceState(t,t.state,null)}function xs(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Za(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ga(a):(a=qi(t)?Gi:Ui.current,i.context=Ki(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(gs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&_s.enqueueReplaceState(i,i.state,null),no(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ss(e,t){try{var n=``,r=t;do n+=I(r),r=r.return;while(r);var i=n}catch(e){i=`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Cs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ws(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ts=typeof WeakMap==`function`?WeakMap:Map;function Es(e,t,n){n=$a(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){il||(il=!0,al=r),ws(e,t)},n}function Ds(e,t,n){n=$a(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ws(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ws(e,t),typeof r!=`function`&&(ol===null?ol=new Set([this]):ol.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Os(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ts;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Vl.bind(null,e,t,n),t.then(e,e))}function ks(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function As(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=$a(-1,1),t.tag=2,eo(n,t,1))),n.lanes|=1),e)}var js=x.ReactCurrentOwner,Ms=!1;function Ns(e,t,n,r){t.child=e===null?Ia(t,null,n,r):Fa(t,e.child,n,r)}function Ps(e,t,n,r,i){n=n.render;var a=t.ref;return Wa(t,i),r=ko(e,t,n,r,a,i),n=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(ya&&n&&ha(t),t.flags|=1,Ns(e,t,r,i),t.child)}function Fs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Yl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Is(e,t,a,r,i)):(e=Ql(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return tc(e,t,i)}return t.flags|=1,e=Zl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Is(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref){if(Ms=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ms=!0);else return t.lanes=e.lanes,tc(e,t,i)}}return zs(e,t,n,r,i)}function Ls(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Vi(qc,Kc),Kc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Vi(qc,Kc),Kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Vi(qc,Kc),Kc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Vi(qc,Kc),Kc|=r;return Ns(e,t,i,n),t.child}function Rs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zs(e,t,n,r,i){var a=qi(n)?Gi:Ui.current;return a=Ki(t,a),Wa(t,i),n=ko(e,t,n,r,a,i),r=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(ya&&r&&ha(t),t.flags|=1,Ns(e,t,n,i),t.child)}function Bs(e,t,n,r,i){if(qi(n)){var a=!0;Zi(t)}else a=!1;if(Wa(t,i),t.stateNode===null)ec(e,t),ys(t,n,r),xs(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ga(l):(l=qi(n)?Gi:Ui.current,l=Ki(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&bs(t,o,r,l),Xa=!1;var f=t.memoizedState;o.state=f,no(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Wi.current||Xa?(typeof u==`function`&&(gs(t,n,u,r),c=t.memoizedState),(s=Xa||vs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Qa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:hs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ga(c):(c=qi(n)?Gi:Ui.current,c=Ki(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&bs(t,o,r,c),Xa=!1,f=t.memoizedState,o.state=f,no(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Wi.current||Xa?(typeof p==`function`&&(gs(t,n,p,r),m=t.memoizedState),(l=Xa||vs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Vs(e,t,n,r,a,i)}function Vs(e,t,n,r,i,a){Rs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Qi(t,n,!1),tc(e,t,a);r=t.stateNode,js.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Fa(t,e.child,null,a),t.child=Fa(t,null,s,a)):Ns(e,t,s,a),t.memoizedState=r.state,i&&Qi(t,n,!0),t.child}function Hs(e){var t=e.stateNode;t.pendingContext?Yi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yi(e,t.context,!1),X(e,t.containerInfo)}function Us(e,t,n,r,i){return Oa(),ka(i),t.flags|=256,Ns(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=po.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Vi(po,i&1),e===null)return wa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=eu(o,r,0,null),e=$l(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Zl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=$l(a,o,n,null),a.flags|=2):a=Zl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,r}return a=e.child,e=a.sibling,r=Zl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Js(e,t){return t=eu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&ka(r),Fa(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Cs(Error(r(422))),Ys(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=eu({mode:`visible`,children:i.children},a,0,null),o=$l(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Fa(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Cs(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ms||c){if(i=Uc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Ya(e,a),gl(i,e,a,-1))}return Al(),i=Cs(Error(r(421))),Ys(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Ul.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,va=wi(a.nextSibling),_a=t,ya=!0,ba=null,e!==null&&(la[ua++]=fa,la[ua++]=pa,la[ua++]=da,fa=e.id,pa=e.overflow,da=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ua(e.return,t,n)}function Qs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ns(e,t,r.children,n),r=po.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zs(e,n,t);else if(e.tag===19)Zs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Vi(po,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Zl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nc(e,t,n){switch(t.tag){case 3:Hs(t),Oa();break;case 5:uo(t);break;case 1:qi(t.type)&&Zi(t);break;case 4:X(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Vi(La,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Vi(po,po.current&1),e=tc(e,t,n),e===null?null:e.sibling):qs(e,t,n):(Vi(po,po.current&1),t.flags|=128,null);Vi(po,po.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Vi(po,po.current),r)break;return null;case 22:case 23:return t.lanes=0,Ls(e,t,n)}return tc(e,t,n)}var rc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ic=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,co(ao.current);var o=null;switch(n){case`input`:i=fe(e,i),r=fe(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=be(e,i),r=be(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=mi)}Pe(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ti(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ac=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!ya)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function sc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cc(e,t,n){var i=t.pendingProps;switch(ga(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sc(t),null;case 1:return qi(t.type)&&Ji(),sc(t),null;case 3:return i=t.stateNode,lo(),Bi(Wi),Bi(Ui),go(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ea(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ba!==null&&(bl(ba),ba=null))),sc(t),null;case 5:fo(t);var o=co(so.current);if(n=t.type,e!==null&&t.stateNode!=null)ic(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return sc(t),null}if(e=co(ao.current),Ea(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Di]=t,i[Oi]=s,e=!!(t.mode&1),n){case`dialog`:ti(`cancel`,i),ti(`close`,i);break;case`iframe`:case`object`:case`embed`:ti(`load`,i);break;case`video`:case`audio`:for(o=0;o<Zr.length;o++)ti(Zr[o],i);break;case`source`:ti(`error`,i);break;case`img`:case`image`:case`link`:ti(`error`,i),ti(`load`,i);break;case`details`:ti(`toggle`,i);break;case`input`:pe(i,s),ti(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ti(`invalid`,i);break;case`textarea`:xe(i,s),ti(`invalid`,i)}for(var c in Pe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&pi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&pi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ti(`scroll`,i)}switch(n){case`input`:R(i),ge(i,s,!0);break;case`textarea`:R(i),Ce(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=mi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=we(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Di]=t,e[Oi]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:ti(`cancel`,e),ti(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ti(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Zr.length;o++)ti(Zr[o],e);o=i;break;case`source`:ti(`error`,e),o=i;break;case`img`:case`image`:case`link`:ti(`error`,e),ti(`load`,e),o=i;break;case`details`:ti(`toggle`,e),o=i;break;case`input`:pe(e,i),o=fe(e,i),ti(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),ti(`invalid`,e);break;case`textarea`:xe(e,i),o=be(e,i),ti(`invalid`,e);break;default:o=i}for(s in Pe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Me(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&De(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Oe(e,u):typeof u==`number`&&Oe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ti(`scroll`,e):u!=null&&b(e,s,u,c))}switch(n){case`input`:R(e),ge(e,i,!1);break;case`textarea`:R(e),Ce(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+L(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ye(e,!!i.multiple,i.defaultValue,!0):ye(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=mi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=co(so.current),co(ao.current),Ea(t)){if(i=t.stateNode,n=t.memoizedProps,i[Di]=t,(s=i.nodeValue!==n)&&(e=_a,e!==null))switch(e.tag){case 3:pi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&pi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Di]=t,t.stateNode=i}return sc(t),null;case 13:if(Bi(po),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ya&&va!==null&&t.mode&1&&!(t.flags&128))Da(),Oa(),t.flags|=98560,s=!1;else if(s=Ea(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Di]=t}else Oa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else ba!==null&&(bl(ba),ba=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||po.current&1?Jc===0&&(Jc=3):Al())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return lo(),e===null&&ii(t.stateNode.containerInfo),sc(t),null;case 10:return Ha(t.type._context),sc(t),null;case 17:return qi(t.type)&&Ji(),sc(t),null;case 19:if(Bi(po),s=t.memoizedState,s===null)return sc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)oc(s,!1);else{if(Jc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=mo(e),c!==null){for(t.flags|=128,oc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Vi(po,po.current&1|2),t.child}e=e.sibling}s.tail!==null&&mt()>nl&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=mo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ya)return sc(t),null}else 2*mt()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=mt(),t.sibling=null,n=po.current,Vi(po,i?n&1|2:n&1),t);case 22:case 23:return El(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Kc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(ga(t),t.tag){case 1:return qi(t.type)&&Ji(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),Bi(Wi),Bi(Ui),go(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fo(t),null;case 13:if(Bi(po),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bi(po),null;case 4:return lo(),null;case 10:return Ha(t.type._context),null;case 22:case 23:return El(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Bl(e,t,n)}else n.current=null}}function mc(e,t,n){try{n()}catch(n){Bl(e,t,n)}}var hc=!1;function gc(e,t){if(hi=dn,e=Or(),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(gi={focusedElem:e,selectionRange:n},dn=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:hs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Bl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Di],delete t[Oi],delete t[Ai],delete t[ji],delete t[Mi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=mi));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(St&&typeof St.onCommitFiberUnmount==`function`)try{St.onCommitFiberUnmount(xt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Ci(e.parentNode,n):e.nodeType===1&&Ci(e,n),ln(e)):Ci(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Bl(n,t,e)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Wl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Tc=c.stateNode,Ec=!1;break a;case 3:Tc=c.stateNode.containerInfo,Ec=!0;break a;case 4:Tc=c.stateNode.containerInfo,Ec=!0;break a}c=c.return}if(Tc===null)throw Error(r(160));Oc(o,s,a),Tc=null,Ec=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Bl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jc(t,e),t=t.sibling}function jc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ac(t,e),Mc(e),i&4){try{_c(3,e,e.return),vc(3,e)}catch(t){Bl(e,e.return,t)}try{_c(5,e,e.return)}catch(t){Bl(e,e.return,t)}}break;case 1:Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return);break;case 5:if(Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return),e.flags&32){var a=e.stateNode;try{Oe(a,``)}catch(t){Bl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&me(a,o),Fe(c,s);var u=Fe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Me(a,f):d===`dangerouslySetInnerHTML`?De(a,f):d===`children`?Oe(a,f):b(a,d,f,u)}switch(c){case`input`:he(a,o);break;case`textarea`:Se(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ye(a,!!o.multiple,o.multiple?[]:``,!1):ye(a,!!o.multiple,o.defaultValue,!0)):ye(a,!!o.multiple,m,!1)}a[Oi]=o}catch(t){Bl(e,e.return,t)}}break;case 6:if(Ac(t,e),Mc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Bl(e,e.return,t)}}break;case 3:if(Ac(t,e),Mc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{ln(t.containerInfo)}catch(t){Bl(e,e.return,t)}break;case 4:Ac(t,e),Mc(e);break;case 13:Ac(t,e),Mc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(tl=mt())),i&4&&kc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dc=(u=dc)||d,Ac(t,e),dc=u):Ac(t,e),Mc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(p=Z,m=p.child,p.tag){case 0:case 11:case 14:case 15:_c(4,p,p.return);break;case 1:pc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Bl(i,n,e)}}break;case 5:pc(p,p.return);break;case 22:if(p.memoizedState!==null){Ic(f);continue}}m===null?Ic(f):(m.return=p,Z=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=je(`display`,s))}catch(t){Bl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Bl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ac(t,e),Mc(e),i&4&&kc(e);break;case 21:break;default:Ac(t,e),Mc(e)}}function Mc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(xc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Oe(a,``),i.flags&=-33),wc(e,Sc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Cc(e,Sc(e),o);break;default:throw Error(r(161))}}catch(t){Bl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nc(e,t,n){Z=e,Pc(e,t,n)}function Pc(e,t,n){for(var r=!!(e.mode&1);Z!==null;){var i=Z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||uc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||dc;s=uc;var l=dc;if(uc=o,(dc=c)&&!l)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Lc(i):(c.return=o,Z=c);for(;a!==null;)Z=a,Pc(a,t,n),a=a.sibling;Z=i,uc=s,dc=l}Fc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Fc(e,t,n)}}function Fc(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dc||vc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!dc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:hs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&ro(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ro(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ln(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}dc||t.flags&512&&yc(t)}catch(e){Bl(t,t.return,e)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ic(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Lc(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vc(4,t)}catch(e){Bl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Bl(t,i,e)}}var a=t.return;try{yc(t)}catch(e){Bl(t,a,e)}break;case 5:var o=t.return;try{yc(t)}catch(e){Bl(t,o,e)}}}catch(e){Bl(t,t.return,e)}if(t===e){Z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Z=s;break}Z=t.return}}var Rc=Math.ceil,zc=x.ReactCurrentDispatcher,Bc=x.ReactCurrentOwner,Vc=x.ReactCurrentBatchConfig,Hc=0,Uc=null,Wc=null,Gc=0,Kc=0,qc=zi(0),Jc=0,Yc=null,Xc=0,Zc=0,Qc=0,$c=null,el=null,tl=0,nl=1/0,rl=null,il=!1,al=null,ol=null,sl=!1,cl=null,ll=0,ul=0,dl=null,fl=-1,pl=0;function ml(){return Hc&6?mt():fl===-1?fl=mt():fl}function hl(e){return e.mode&1?Hc&2&&Gc!==0?Gc&-Gc:Aa.transition===null?(e=Bt,e===0?(e=window.event,e=e===void 0?16:_n(e.type),e):e):(pl===0&&(pl=Ft()),pl):1}function gl(e,t,n,i){if(50<ul)throw ul=0,dl=null,Error(r(185));Lt(e,n,i),(!(Hc&2)||e!==Uc)&&(e===Uc&&(!(Hc&2)&&(Zc|=n),Jc===4&&Sl(e,Gc)),_l(e,i),n===1&&Hc===0&&!(t.mode&1)&&(nl=mt()+500,ea&&ia()))}function _l(e,t){var n=e.callbackNode;Nt(e,t);var r=jt(e,e===Uc?Gc:0);if(r===0)n!==null&&dt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dt(n),t===1)e.tag===0?ra(Cl.bind(null,e)):na(Cl.bind(null,e)),xi(function(){!(Hc&6)&&ia()}),n=null;else{switch(Vt(r)){case 1:n=gt;break;case 4:n=_t;break;case 16:n=vt;break;case 536870912:n=bt;break;default:n=vt}n=Kl(n,vl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function vl(e,t){if(fl=-1,pl=0,Hc&6)throw Error(r(327));var n=e.callbackNode;if(Rl()&&e.callbackNode!==n)return null;var i=jt(e,e===Uc?Gc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=jl(e,i);else{t=i;var a=Hc;Hc|=2;var o=kl();(Uc!==e||Gc!==t)&&(rl=null,nl=mt()+500,Dl(e,t));do try{Nl();break}catch(t){Ol(e,t)}while(1);Va(),zc.current=o,Hc=a,Wc===null?(Uc=null,Gc=0,t=Jc):t=0}if(t!==0){if(t===2&&(a=Pt(e),a!==0&&(i=a,t=yl(e,a))),t===1)throw n=Yc,Dl(e,0),Sl(e,i),_l(e,mt()),n;if(t===6)Sl(e,i);else{if(a=e.current.alternate,!(i&30)&&!xl(a)&&(t=jl(e,i),t===2&&(o=Pt(e),o!==0&&(i=o,t=yl(e,o))),t===1))throw n=Yc,Dl(e,0),Sl(e,i),_l(e,mt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Il(e,el,rl);break;case 3:if(Sl(e,i),(i&130023424)===i&&(t=tl+500-mt(),10<t)){if(jt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){ml(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=vi(Il.bind(null,e,el,rl),t);break}Il(e,el,rl);break;case 4:if(Sl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-wt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=mt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Rc(i/1960))-i,10<i){e.timeoutHandle=vi(Il.bind(null,e,el,rl),i);break}Il(e,el,rl);break;case 5:Il(e,el,rl);break;default:throw Error(r(329))}}}return _l(e,mt()),e.callbackNode===n?vl.bind(null,e):null}function yl(e,t){var n=$c;return e.current.memoizedState.isDehydrated&&(Dl(e,t).flags|=256),e=jl(e,t),e!==2&&(t=el,el=n,t!==null&&bl(t)),e}function bl(e){el===null?el=e:el.push.apply(el,e)}function xl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Cr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Sl(e,t){for(t&=~Qc,t&=~Zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-wt(t),r=1<<n;e[n]=-1,t&=~r}}function Cl(e){if(Hc&6)throw Error(r(327));Rl();var t=jt(e,0);if(!(t&1))return _l(e,mt()),null;var n=jl(e,t);if(e.tag!==0&&n===2){var i=Pt(e);i!==0&&(t=i,n=yl(e,i))}if(n===1)throw n=Yc,Dl(e,0),Sl(e,t),_l(e,mt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Il(e,el,rl),_l(e,mt()),null}function wl(e,t){var n=Hc;Hc|=1;try{return e(t)}finally{Hc=n,Hc===0&&(nl=mt()+500,ea&&ia())}}function Tl(e){cl!==null&&cl.tag===0&&!(Hc&6)&&Rl();var t=Hc;Hc|=1;var n=Vc.transition,r=Bt;try{if(Vc.transition=null,Bt=1,e)return e()}finally{Bt=r,Vc.transition=n,Hc=t,!(Hc&6)&&ia()}}function El(){Kc=qc.current,Bi(qc)}function Dl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,yi(n)),Wc!==null)for(n=Wc.return;n!==null;){var r=n;switch(ga(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ji();break;case 3:lo(),Bi(Wi),Bi(Ui),go();break;case 5:fo(r);break;case 4:lo();break;case 13:Bi(po);break;case 19:Bi(po);break;case 10:Ha(r.type._context);break;case 22:case 23:El()}n=n.return}if(Uc=e,Wc=e=Zl(e.current,null),Gc=Kc=t,Jc=0,Yc=null,Qc=Zc=Xc=0,el=$c=null,Ka!==null){for(t=0;t<Ka.length;t++)if(n=Ka[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ka=null}return e}function Ol(e,t){do{var n=Wc;try{if(Va(),_o.current=ds,Co){for(var i=bo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Co=!1}if(yo=0,So=xo=bo=null,wo=!1,To=0,Bc.current=null,n===null||n.return===null){Jc=1,Yc=t,Wc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Gc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=ks(s);if(m!==null){m.flags&=-257,As(m,s,c,o,t),m.mode&1&&Os(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Os(o,u,t),Al();break a}l=Error(r(426))}else if(ya&&c.mode&1){var _=ks(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),As(_,s,c,o,t),ka(Ss(l,c));break a}}o=l=Ss(l,c),Jc!==4&&(Jc=2),$c===null?$c=[o]:$c.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Es(o,l,t);Y(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ol===null||!ol.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ds(o,c,t);Y(o,x);break a}}o=o.return}while(o!==null)}Fl(n)}catch(e){t=e,Wc===n&&n!==null&&(Wc=n=n.return);continue}break}while(1)}function kl(){var e=zc.current;return zc.current=ds,e===null?ds:e}function Al(){(Jc===0||Jc===3||Jc===2)&&(Jc=4),Uc===null||!(Xc&268435455)&&!(Zc&268435455)||Sl(Uc,Gc)}function jl(e,t){var n=Hc;Hc|=2;var i=kl();(Uc!==e||Gc!==t)&&(rl=null,Dl(e,t));do try{Ml();break}catch(t){Ol(e,t)}while(1);if(Va(),Hc=n,zc.current=i,Wc!==null)throw Error(r(261));return Uc=null,Gc=0,Jc}function Ml(){for(;Wc!==null;)Pl(Wc)}function Nl(){for(;Wc!==null&&!ft();)Pl(Wc)}function Pl(e){var t=Gl(e.alternate,e,Kc);e.memoizedProps=e.pendingProps,t===null?Fl(e):Wc=t,Bc.current=null}function Fl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lc(n,t),n!==null){n.flags&=32767,Wc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Jc=6,Wc=null;return}}else if(n=cc(n,t,Kc),n!==null){Wc=n;return}if(t=t.sibling,t!==null){Wc=t;return}Wc=t=e}while(t!==null);Jc===0&&(Jc=5)}function Il(e,t,n){var r=Bt,i=Vc.transition;try{Vc.transition=null,Bt=1,Ll(e,t,n,r)}finally{Vc.transition=i,Bt=r}return null}function Ll(e,t,n,i){do Rl();while(cl!==null);if(Hc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Rt(e,o),e===Uc&&(Wc=Uc=null,Gc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sl||(sl=!0,Kl(vt,function(){return Rl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=Bt;Bt=1;var c=Hc;Hc|=4,Bc.current=null,gc(e,n),jc(n,e),Ar(gi),dn=!!hi,gi=hi=null,e.current=n,Nc(n,e,a),pt(),Hc=c,Bt=s,Vc.transition=o}else e.current=n;if(sl&&(sl=!1,cl=e,ll=a),o=e.pendingLanes,o===0&&(ol=null),Ct(n.stateNode,i),_l(e,mt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(il)throw il=!1,e=al,al=null,e;return ll&1&&e.tag!==0&&Rl(),o=e.pendingLanes,o&1?e===dl?ul++:(ul=0,dl=e):ul=0,ia(),null}function Rl(){if(cl!==null){var e=Vt(ll),t=Vc.transition,n=Bt;try{if(Vc.transition=null,Bt=16>e?16:e,cl===null)var i=!1;else{if(e=cl,cl=null,ll=0,Hc&6)throw Error(r(331));var a=Hc;for(Hc|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:_c(8,d,o)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var p=d.sibling,m=d.return;if(bc(d),d===u){Z=null;break}if(p!==null){p.return=m,Z=p;break}Z=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Z=s;else b:for(;Z!==null;){if(o=Z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_c(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Z=v;break b}Z=o.return}}var y=e.current;for(Z=y;Z!==null;){s=Z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Z=b;else b:for(s=y;Z!==null;){if(c=Z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:vc(9,c)}}catch(e){Bl(c,c.return,e)}if(c===s){Z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Z=x;break b}Z=c.return}}if(Hc=a,ia(),St&&typeof St.onPostCommitFiberRoot==`function`)try{St.onPostCommitFiberRoot(xt,e)}catch{}i=!0}return i}finally{Bt=n,Vc.transition=t}}return!1}function zl(e,t,n){t=Ss(n,t),t=Es(e,t,1),e=eo(e,t,1),t=ml(),e!==null&&(Lt(e,1,t),_l(e,t))}function Bl(e,t,n){if(e.tag===3)zl(e,e,n);else for(;t!==null;){if(t.tag===3){zl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ol===null||!ol.has(r))){e=Ss(n,e),e=Ds(t,e,1),t=eo(t,e,1),e=ml(),t!==null&&(Lt(t,1,e),_l(t,e));break}}t=t.return}}function Vl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ml(),e.pingedLanes|=e.suspendedLanes&n,Uc===e&&(Gc&n)===n&&(Jc===4||Jc===3&&(Gc&130023424)===Gc&&500>mt()-tl?Dl(e,0):Qc|=n),_l(e,t)}function Hl(e,t){t===0&&(e.mode&1?(t=kt,kt<<=1,!(kt&130023424)&&(kt=4194304)):t=1);var n=ml();e=Ya(e,t),e!==null&&(Lt(e,t,n),_l(e,n))}function Ul(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hl(e,n)}function Wl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Hl(e,n)}var Gl=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Wi.current)Ms=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ms=!1,nc(e,t,n);Ms=!!(e.flags&131072)}}else Ms=!1,ya&&t.flags&1048576&&J(t,ca,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=Ki(t,Ui.current);Wa(t,n),a=ko(null,t,i,e,a,n);var o=Ao();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qi(i)?(o=!0,Zi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Za(t),a.updater=_s,t.stateNode=a,a._reactInternals=t,xs(t,i,e,n),t=Vs(null,t,i,!0,o,n)):(t.tag=0,ya&&o&&ha(t),Ns(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Xl(i),e=hs(i,e),a){case 0:t=zs(null,t,i,e,n);break a;case 1:t=Bs(null,t,i,e,n);break a;case 11:t=Ps(null,t,i,e,n);break a;case 14:t=Fs(null,t,i,hs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),zs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Bs(e,t,i,a,n);case 3:a:{if(Hs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Qa(e,t),no(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ss(Error(r(423)),t),t=Us(e,t,i,n,a);break a}if(i!==a){a=Ss(Error(r(424)),t),t=Us(e,t,i,n,a);break a}for(va=wi(t.stateNode.containerInfo.firstChild),_a=t,ya=!0,ba=null,n=Ia(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Oa(),i===a){t=tc(e,t,n);break a}Ns(e,t,i,n)}t=t.child}return t;case 5:return uo(t),e===null&&wa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,q(i,a)?s=null:o!==null&&q(i,o)&&(t.flags|=32),Rs(e,t),Ns(e,t,s,n),t.child;case 6:return e===null&&wa(t),null;case 13:return qs(e,t,n);case 4:return X(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Fa(t,null,i,n):Ns(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Ps(e,t,i,a,n);case 7:return Ns(e,t,t.pendingProps,n),t.child;case 8:return Ns(e,t,t.pendingProps.children,n),t.child;case 12:return Ns(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Vi(La,i._currentValue),i._currentValue=s,o!==null){if(Cr(o.value,s)){if(o.children===a.children&&!Wi.current){t=tc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=$a(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ua(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ua(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ns(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Wa(t,n),a=Ga(a),i=i(a),t.flags|=1,Ns(e,t,i,n),t.child;case 14:return i=t.type,a=hs(i,t.pendingProps),a=hs(i.type,a),Fs(e,t,i,a,n);case 15:return Is(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),ec(e,t),t.tag=1,qi(i)?(e=!0,Zi(t)):e=!1,Wa(t,n),ys(t,i,a),xs(t,i,a,n),Vs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Ls(e,t,n)}throw Error(r(156,t.tag))};function Kl(e,t){return ut(e,t)}function ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jl(e,t,n,r){return new ql(e,t,n,r)}function Yl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xl(e){if(typeof e==`function`)return+!!Yl(e);if(e!=null){if(e=e.$$typeof,e===k)return 11;if(e===M)return 14}return 2}function Zl(e,t){var n=e.alternate;return n===null?(n=Jl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ql(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Yl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case w:return $l(n.children,a,o,t);case T:s=8,a|=8;break;case E:return e=Jl(12,n,t,a|2),e.elementType=E,e.lanes=o,e;case A:return e=Jl(13,n,t,a),e.elementType=A,e.lanes=o,e;case j:return e=Jl(19,n,t,a),e.elementType=j,e.lanes=o,e;case P:return eu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case O:s=9;break a;case k:s=11;break a;case M:s=14;break a;case N:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Jl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function $l(e,t,n,r){return e=Jl(7,e,r,t),e.lanes=n,e}function eu(e,t,n,r){return e=Jl(22,e,r,t),e.elementType=P,e.lanes=n,e.stateNode={isHidden:!1},e}function tu(e,t,n){return e=Jl(6,e,null,t),e.lanes=n,e}function nu(e,t,n){return t=Jl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ru(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=It(0),this.expirationTimes=It(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=It(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function iu(e,t,n,r,i,a,o,s,c){return e=new ru(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Jl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Za(a),e}function au(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function ou(e){if(!e)return Hi;e=e._reactInternals;a:{if(at(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(qi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(qi(n))return Xi(e,n,t)}return t}function su(e,t,n,r,i,a,o,s,c){return e=iu(n,r,!0,e,i,a,o,s,c),e.context=ou(null),n=e.current,r=ml(),i=hl(n),a=$a(r,i),a.callback=t??null,eo(n,a,i),e.current.lanes=i,Lt(e,i,r),_l(e,r),e}function cu(e,t,n,r){var i=t.current,a=ml(),o=hl(i);return n=ou(n),t.context===null?t.context=n:t.pendingContext=n,t=$a(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=eo(i,t,o),e!==null&&(gl(e,i,o,a),to(e,i,o)),o}function lu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function du(e,t){uu(e,t),(e=e.alternate)&&uu(e,t)}function fu(){return null}var pu=typeof reportError==`function`?reportError:function(e){console.error(e)};function mu(e){this._internalRoot=e}hu.prototype.render=mu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));cu(e,t,null,null)},hu.prototype.unmount=mu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Tl(function(){cu(null,e,null,null)}),t[ki]=null}};function hu(e){this._internalRoot=e}hu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<B.length&&t!==0&&t<B[n].priority;n++);B.splice(n,0,e),n===0&&rn(e)}};function gu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function vu(){}function yu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=lu(o);a.call(e)}}var o=su(t,r,e,0,null,!1,!1,``,vu);return e._reactRootContainer=o,e[ki]=o.current,ii(e.nodeType===8?e.parentNode:e),Tl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=lu(c);s.call(e)}}var c=iu(e,0,!1,null,null,!1,!1,``,vu);return e._reactRootContainer=c,e[ki]=c.current,ii(e.nodeType===8?e.parentNode:e),Tl(function(){cu(t,c,n,r)}),c}function bu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=lu(o);s.call(e)}}cu(t,o,e,i)}else o=yu(n,t,e,i,r);return lu(o)}Ht=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=At(t.pendingLanes);n!==0&&(zt(t,n|1),_l(t,mt()),!(Hc&6)&&(nl=mt()+500,ia()))}break;case 13:Tl(function(){var t=Ya(e,1);t!==null&&gl(t,e,1,ml())}),du(e,1)}},Ut=function(e){if(e.tag===13){var t=Ya(e,134217728);t!==null&&gl(t,e,134217728,ml()),du(e,134217728)}},Wt=function(e){if(e.tag===13){var t=hl(e),n=Ya(e,t);n!==null&&gl(n,e,t,ml()),du(e,t)}},Gt=function(){return Bt},Kt=function(e,t){var n=Bt;try{return Bt=e,t()}finally{Bt=n}},Re=function(e,t,n){switch(t){case`input`:if(he(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ii(i);if(!a)throw Error(r(90));ue(i),he(i,a)}}}break;case`textarea`:Se(e,n);break;case`select`:t=n.value,t!=null&&ye(e,!!n.multiple,t,!1)}},We=wl,Ge=Tl;var xu={usingClientEntryPoint:!1,Events:[Pi,Fi,Ii,He,Ue,wl]},Su={findFiberByHostInstance:Ni,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Cu={bundleType:Su.bundleType,version:Su.version,rendererPackageName:Su.rendererPackageName,rendererConfig:Su.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=lt(e),e===null?null:e.stateNode},findFiberByHostInstance:Su.findFiberByHostInstance||fu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{xt=wu.inject(Cu),St=wu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gu(t))throw Error(r(200));return au(e,t,null,n)},e.createRoot=function(e,t){if(!gu(e))throw Error(r(299));var n=!1,i=``,a=pu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=iu(e,1,!1,null,null,n,!1,i,a),e[ki]=t.current,ii(e.nodeType===8?e.parentNode:e),new mu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=lt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Tl(e)},e.hydrate=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!gu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=pu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=su(t,null,e,1,n??null,a,!1,o,s),e[ki]=t.current,ii(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new hu(t)},e.render=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!_u(e))throw Error(r(40));return e._reactRootContainer?(Tl(function(){bu(null,null,e,!1,function(){e._reactRootContainer=null,e[ki]=null})}),!0):!1},e.unstable_batchedUpdates=wl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!_u(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return bu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),Ks=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Gs()})),qs=n((e=>{var t=Ks();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function Js(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),on(t))}var Ys=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var Xs=globalThis[Ys],Zs=Xs?Xs.RpcTarget:class{},Qs=async function(){}.constructor,$s=typeof Buffer<`u`?Buffer.prototype:void 0;function ec(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case Qs.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case $s:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case fc.prototype:return`stub`;case Z.prototype:return`rpc-promise`;default:if(Xs){if(t==Xs.RpcStub.prototype||e instanceof Xs.ServiceStub)return`rpc-target`;if(t==Xs.RpcPromise.prototype||t==Xs.RpcProperty.prototype)return`rpc-thenable`}return e instanceof Zs?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function tc(){throw Error(`RPC map() implementation was not loaded.`)}var nc={applyMap:tc,sendMap:tc};function rc(){throw Error(`Stream implementation was not loaded.`)}var ic={createWritableStreamHook:rc,createWritableStreamFromHook:rc,createReadableStreamHook:rc},ac=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},oc=class extends ac{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},sc=new oc(Error(`Attempted to use RPC stub after it has been disposed.`)),cc=(e,t,n)=>e.call(t,n);function lc(e,t){let n=cc;cc=e;try{return t()}finally{cc=n}}var uc=Symbol(`realStub`),dc={apply(e,t,n){let r=e.raw;return new Z(cc(r.hook,r.pathIfPromise||[],yc.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===uc)return r;if(t in Z.prototype)return r[t];if(typeof t==`string`)return new Z(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=sc}},has(e,t){let n=e.raw;return t===uc?!0:t in Z.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},fc=class e extends Zs{constructor(e,t){if(super(),!(e instanceof ac)){let n=e;if(e=n instanceof Zs||n instanceof Function?wc.create(n,void 0):new Sc(yc.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,dc)}hook;pathIfPromise;dup(){let t=this[uc];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[uc].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[uc];return nc.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},Z=class extends fc{constructor(e,t){if(e instanceof ac)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=ec(e);if(n===`rpc-promise`){let t=_c(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=sc,super(e,[])}}else if(n===`rpc-thenable`)super(wc.create(e,void 0),[]);else{let t=new Tc(Promise.resolve(e).then(e=>new Sc(yc.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return vc(this).then(...arguments)}catch(e){return vc(this).catch(...arguments)}finally(e){return vc(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function pc(e){let{hook:t,pathIfPromise:n}=e[uc];return n&&n.length>0?t.get(n):t}function mc(e){let{hook:t,pathIfPromise:n}=e[uc];return n?t.get(n):t.dup()}function hc(e){let{hook:t,pathIfPromise:n}=e[uc];if(!(n&&n.length>0))return t}function gc(e){return e[uc].hook}function _c(e){return e[uc]}async function vc(e){let{hook:t,pathIfPromise:n}=e[uc];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var yc=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return wc.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=wc.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return ic.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ic.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return ic.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ic.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(ec(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?mc(t):pc(t),t instanceof Z){let e=new Z(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new fc(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):wc.create(n,t),this.hooks.push(r),new fc(r)}case`rpc-thenable`:{let o=e,s;return s=a?new Z(a.getHookForRpcTarget(o,t,i),[]):new Z(wc.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):ic.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):ic.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof Z)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=hc(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof Z?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(ec(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=hc(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):Cc(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ic.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ic.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>gc(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(ec(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:gc(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function bc(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(ec(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=_c(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof Z){let{hook:t,pathIfPromise:n}=_c(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var xc=class extends ac{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=bc(t,void 0,e,r)}catch(e){return t.dispose(),new oc(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new Tc(t.deliverCall(n.value,n.parent).then(e=>new Sc(e))):(t.dispose(),new oc(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=bc(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):nc.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new oc(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=bc(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new Sc(yc.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new oc(e)}}},Sc=class e extends xc{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(yc.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof fc&&this.payload.value.onRpcBroken(e)}};function Cc(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var wc=class e extends xc{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>yc.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&Cc(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},Tc=class e extends ac{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},Ec={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},Dc=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Oc=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function kc(e){return Oc.includes(e)}var Ac={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},jc={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},Mc=new Map;for(let e of Object.keys(jc))Mc.set(jc[e],e);function Nc(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var Pc=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function Fc(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Ic={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},Lc=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=Pc,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(ec(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=Mc.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=Ac[t];!Dc&&i&&(n=n.slice(),Nc(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=ic.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=ic.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=_c(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return Ec}};function Rc(e,t){return new Z(new Tc(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new Sc(yc.fromAppReturn(r))})),[])}function zc(e,t){return new Z(new Tc(Fc(e,t).then(e=>new Sc(yc.fromAppReturn(e)))),[])}var Bc=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=yc.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!kc(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=Ac[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!Dc&&r!==void 0&&Nc(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=Ic[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=Rc(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=zc(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new Z(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new Z(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new Z(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new Z(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new fc(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=ic.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=ic.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},Vc=16,Hc=8,Uc=16,Wc=64;function Gc(e){return 2+e.length*3}function Kc(e,t,n=0){if(n>=Wc)return Hc;switch(typeof e){case`string`:return Gc(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return Uc+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return Uc+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return Hc;if(t.add(e),e instanceof Array){let r=Vc;for(let i of e)r+=Hc+Kc(i,t,n+1);return r}if(e instanceof Error){let r=Vc+Gc(e.name)+Gc(e.message)+Gc(e.stack??``);for(let i of Object.keys(e))r+=Hc+Gc(i)+Kc(e[i],t,n+1);return r}let r=Vc;for(let i of Object.keys(e))r+=Hc+Gc(i)+Kc(e[i],t,n+1);return r}default:return 16}}var qc=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){this.resolution||(this.resolution=new oc(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations=void 0)}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},Jc=class e extends ac{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},Yc=class extends Jc{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},Xc=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...Ec,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new qc(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new Yc(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof fc){let{hook:n,pathIfPromise:r}=_c(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=Lc.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,Lc.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,Lc.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof Jc&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new qc(this,e,!1),this.imports[e]=t),new Jc(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new oc(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new qc(this,e,!0);return this.imports[e]=t,new Jc(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new qc(this,n,!1);this.imports.push(r);let i=new Jc(!1,r),a=ic.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=Lc.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new qc(this,this.imports.length,!1);return this.imports.push(i),new Jc(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=Lc.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=Kc(a));let s=this.imports.length,c=new qc(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new qc(this,this.imports.length,!1);return this.imports.push(a),new Jc(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,Lc.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t in this.onBrokenCallbacks)try{this.onBrokenCallbacks[t](e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new Sc(new Bc(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new Sc(new Bc(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=ic.createWritableStreamHook(t);this.exports.push({hook:n,refcount:1,pipeReadable:e});continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new Sc(new Bc(this,this.encodingLevel).evaluate(n[2])));else{let e=new Bc(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new oc(e.value))}}else n[0]==`resolve`&&new Bc(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new Bc(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},Zc=class{#e;#t;constructor(e,t,n={}){let r;r=t?new Sc(yc.fromAppReturn(t)):new oc(Error(`This connection has no main object.`)),this.#e=new Xc(e,r,n),this.#t=new fc(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function Qc(e,t,n){return new Zc(new $c(e),t,n).getRemoteMain()}var $c=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},el,tl=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=el?{parent:el,captures:[],subject:el.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},el=this}unregister(){el=this.context.parent}makeInput(){return new rl(this,0)}makeOutput(e){let t;try{t=Lc.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new rl(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=Lc.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new rl(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new rl(this,this.instructions.length)}capture(e){if(e instanceof rl&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};nc.sendMap=(e,t,n)=>{let r=new tl(e,t),i;try{i=yc.fromAppReturn(lc(r.pushCall.bind(r),()=>n(new Z(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new Z(r.makeOutput(i),[])};function nl(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var rl=class extends ac{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(el)return el.pushGet(this,e);nl()}call(e,t){t.dispose(),nl()}map(e,t,n){for(let e of t)e.dispose();nl()}pull(){nl()}ignoreUnhandledRejections(){}onBroken(e){nl()}},il=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new Bc(this).evaluateCopy(t);if(e.value instanceof fc){let t=hc(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new Sc(e))}return new Bc(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return Ec}};function al(e,t,n,r,i){let a=new il(r,new Sc(yc.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}nc.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof Z)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(al(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=yc.fromArray(t)}else a=e==null?yc.fromAppReturn(e):al(e,t,n,r,i);return new Sc(a)}finally{for(let e of r)e.dispose()}};var ol=class e extends ac{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new Tc((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new Sc(e)))}catch(e){return t.dispose(),new oc(e)}}map(e,t,n){for(let e of t)e.dispose();return new oc(Error(`Cannot use map() on a WritableStream`))}get(e){return new oc(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){}},sl=262144,cl=1073741824,ll=65536,ul=2,dl=1.25,fl=.9,pl=3,ml=class{now;window=sl;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?ul:dl,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*fl):Math.max(s,this.window),this.window=Math.max(Math.min(s,cl),ll),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*dl?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=pl&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function hl(e){let t,n=!1,r=new ml(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({write(n,s){if(t!==void 0)throw t;let c=yc.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],yc.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],yc.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var gl=class e extends ac{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new oc(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new oc(Error(`Cannot use map() on a ReadableStream`))}get(e){return new oc(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};ic.createWritableStreamHook=ol.create,ic.createWritableStreamFromHook=hl,ic.createReadableStreamHook=gl.create;var _l=fc,vl=Zs,yl=Qc;function bl(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function xl(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onActivate:()=>()=>void 0});function Sl(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function Cl(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function wl(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Tl(e){return{name:wl(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function El(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function Dl(e,t){let n=El(Tl(e));return{stroke:n,display:t?.display??Fl(n),match:t?.match??jl(n),tokenName:t?.tokenName?Cl(t.tokenName):void 0}}function Ol(e){return{stroke:El(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function kl(e){return e.map(e=>Ol(e))}function Al(e){return`match`in e?e.match:`stroke`in e?jl(e.stroke):jl(e)}function jl(e){return`key:${Il(Tl(e))}`}function Ml(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Nl(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Fl(e.stroke):Fl(Tl(e))}function Pl(e,t){return e.map(e=>Nl(e,t)).join(t?.separator??``)}function Fl(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function Il(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Ll=Symbol(`keymap-extension-context`);function Rl(e){return e.isDestroyed?null:e.getFocusedTarget()}function zl(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function Bl(e,t){let n=new Set;return zl(e,t,e=>{n.add(e)}),n}function Vl(e,t,n){let r=[],i=Bl(t,n),a=Array.isArray(e)?e:Hl(e);for(let e of a)Ul(t,e,n,i)&&r.push(e);return r}function Hl(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Ul(e,t,n,r=Bl(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function Wl(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function Gl(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?Wl(e)>=i.min:n}function Kl(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&Wl(e)<n.max)return!0}return Gl(e,t,n)&&e.index+1<e.binding.sequence.length}function ql(e,t){return e.index===e.binding.sequence.length-1&&Gl(e,t,!1)}function Jl(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function Yl(e,t){let n=Jl(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=Jl(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=Jl(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function Xl(e,t){let n=[];for(let r of e){if(!Gl(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function Zl(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function Ql(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function $l(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return Zl({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function eu(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&Wl(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Zl(e,e.index,r,t.value??n.name)}}return Gl(e,r,!1)?$l(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return $l(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function tu(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=$l(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Ql(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function nu(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function ru(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function iu(){let e=ru();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function au(){let e=ru(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function ou(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function su(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!ou(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function cu(e){let t=su(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function lu(e){return{...e,sequence:kl(e.sequence)}}function uu(e,t){let n=iu();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=du(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function du(e){return e.map(t=>({sequence:kl(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:lu(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&fu(e,t)),hasContinuations:e.some(e=>e.event===`press`&&pu(t,e))}))}function fu(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function pu(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function mu(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function hu(){return{plain:mu(),bindings:mu(),metadata:mu(),bindingsAndMetadata:mu()}}function gu(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function _u(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function vu(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function yu(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function bu(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function xu(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=Nl(i.stroke)),c&&(o=void 0),n.push(Dl(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function Su(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function Cu(e,t,n,r,i,a,o={}){let s=hu(),c=-1,l=[],u=()=>Su(t).getFocusedTarget(),d=()=>Rl(t),f=t=>{let n=e.pending;yu(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),L(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&Kl(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?xu(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=bu(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=gu(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&Su(t);let o=u(),s=_u(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?ee(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,vu(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return ee(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?ee(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=Vl(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Ul(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?Nl(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return ne(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?oe(c,s,r):t.set(e,I(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=ae(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=ae(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},ee=(t,n,r,i,a)=>{let o=new Map,s=new Set;return te(Xl(t,e.patterns),o,s,n,i,a),ne(o,n,r,i,a)},te=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),F(s,e,t,n,r,i,a))},F=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=re(e,t,i,a,o);if(!c)return;let l=n.get(s);l?oe(l,c,i):n.set(s,I(e.part.stroke,c,i)),c.stop&&r.add(s)},ne=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=se(o,t,n,r,i);e&&a.push(e)}return a},re=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=ae(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=ie(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},ie=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?Nl(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},ae=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},I=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),oe=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},se=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:El(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},L=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?xu(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:xu,collectMatchingBindings:E,collectActiveBindings:A}}var wu=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),Tu=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Eu=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function Du(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function Ou(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function ku(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Au(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),ku(n,e.command.name,i)}return{entries:t,chainsByName:n}}function ju(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),ku(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function Mu(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Vl(e.sortedLayers,t,r)),ju(e.activeLayersCache,n,!0)}function Nu(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function Pu(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function Fu(e){let t=`field ${e.fieldName}`;return{require(n,r){Nu(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Pu(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Iu(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Lu(e,t){return e instanceof Error&&e.message?e.message:t}function Ru(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function zu(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>zu(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Iu(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?zu(i,t):i;return r?Object.freeze(a):a}return e}var Bu=[`name`],Vu=Object.freeze({}),Hu=new WeakMap;function Uu(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>Gu({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>ne(()=>e.commandResolvers.prepend(t),t),y=t=>ne(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>le(e).map(e=>Wu(e.commandState)),S=e=>{let t=ce(e),n=le(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:Wu(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&R(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(ue(n,ce(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=ge(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=ge(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=I(ae(t));return g.set(t,n??null),n},E=(e,t)=>I(M(t).chainsByName.get(e)),D=(e,t)=>ge(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>ge(e,t,{mode:`active`,execution:n}),k=(e,t)=>re(e,t)?.command,A=e=>ie(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!Ul(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=Mu(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=Au(e),o),P=()=>e.activeCommandViewCacheBlockers===0,ee=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:oe(e.command,t,`active`)!==void 0:!1,te=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:oe(e.command,t,`active`)?.attrs},F=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=ge(e,Rl(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},ne=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),re=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:oe(e,t,`active`)},ie=e=>ae(e)?.[0],ae=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},I=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},oe=(e,t,n)=>ge(e,t,{mode:n}).resolved,se=()=>N().entries,L=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},ce=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:Rl(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},le=(e,t=ce(e))=>{let r;return r=t.visibility===`registered`?se():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],Xu({entries:r,query:e,getCommand:e=>Wu(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},R=(e,t,n)=>{de(n,n=>{fe(e,t,n)})},ue=(e,t)=>{if(t.visibility===`registered`){let t=L();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(me(i,e))}return}de(t,n=>{pe(e,n,t)})},de=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&ee(a,t.focused,i)&&n(a)}},fe=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(me(n,r.commandAttrs))}},pe=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(me(t,he(t,n)))},me=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),he=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return te(e,t.focused,n)},ge=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=Ku(t,e.commandResolvers.values(),()=>ye(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=ve(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=_e(c.command.name,r,a)??Yu(c.command);e&&(s.resolved={...c,attrs:e})}return s},_e=(e,t,n)=>n===`registered`?ie(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,ve=(e,t,n)=>n===`registered`?ie(e):M(t).reachableByName.get(e),ye=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:ee,getBindingCommandAttrs:te,getCommandResolutionStatus:F}}function Wu(e){return e.command}function Gu(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Ou(r.name),s=qu(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,Fu({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,Lu(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Ku(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:Ju(t,o.getExecutionFields())}}return{hadError:i}}function qu(e){let t={};for(let[n,r]of Object.entries(e))!wu.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Vu:t}function Ju(e,t){return{command:e,input:t.input,payload:t.payload}}function Yu(e){let t=qu(e);return t===Vu?void 0:t}function Xu(e){let t=e.query?.namespace,n=Zu(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Bu;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if($u(u,t)&&Qu(u,r,i)&&!(c&&!c.has(u.command.name))&&ed(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function Zu(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Qu(e,t,n){if(!t)return!0;for(let r of n)if(td(e,r,t))return!0;return!1}function $u(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?cd(n.namespace,t):!1}function ed(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!ad(e,r,i,n))return!1;return!0}function td(e,t,n){return nd(e,t)?.includes(n)===!0}function nd(e,t){let n=Hu.get(e);if(n||(n=new Map,Hu.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=rd(a);return n.set(t,o),o}function rd(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=rd(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function id(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function ad(e,t,n,r){return typeof n==`function`?od(e,t,n,r):sd(e,t,n)}function od(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,id(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,id(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,id(n,o[t],l(),r.onFilterError))?!0:!c&&id(n,void 0,l(),r.onFilterError)}function sd(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&cd(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&cd(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&cd(a[t],n)}function cd(e,t){return Array.isArray(t)?t.some(t=>ld(e,t)):ld(e,t)}function ld(e,t){return Array.isArray(e)?e.some(e=>ld(e,t)):Object.is(e,t)}function ud(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(Ru(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(dd(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=Du(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(fd(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return fd(n,i),!0;return!1}}}function dd(e){return typeof e==`object`&&!!e&&`ok`in e}function fd(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var pd=Object.freeze({}),md=[],hd=[];function gd(e){if(Object.keys(e).length!==0)return zu(e,{freeze:!0})}function _d(e,t,n,r){let i=t=>Cd(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:pd,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=Sd(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:pd,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>Pl(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=bd(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Lu(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?Sd(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=xd(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Lu(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||Tu.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,Fu({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?gd(u):void 0,m=Du(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:lu(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):md,matchers:d.length>0?d:hd,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&yd(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Lu(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>Dl(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:kl(r)}];let l={...n,sequence:kl(r)},u=[],d=!0,f=o??pd;for(let n of s)try{n(l,{layer:f,parseKey:t=>Cd(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(lu(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function vd(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function yd(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&vd(n.sequence,t.sequence)||t.command!==void 0&&vd(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function bd(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??pd,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function xd(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function Sd(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??pd,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:Cl,createMatch:Ml,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function Cd(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=Sd(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function wd(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function Td(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(wd(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var Ed=Symbol(`keymap-disambiguation-decision`),Dd=Symbol(`keymap-deferred-disambiguation-decision`);function Od(e,t){return{[Ed]:!0,action:e,handler:t}}function kd(e){return{[Dd]:!0,action:e}}function Ad(e){return!!e&&typeof e==`object`&&e[Ed]===!0}function jd(e){return!!e&&typeof e==`object`&&e[Dd]===!0}function Md(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Nd(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function Pd(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...Dl({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function Fd(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function Id(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return F(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return F(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&me()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:kl(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:kl(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?kl(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function ee(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function te(i,a){a||me();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=ne(i);o&&j(o,i,a,s,e);return}let u=re(i);o&&j(o,i,a,s,u)}function F(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function ne(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=be(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=xe(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function re(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=be(e);if(n)return ie(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=I(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function ie(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=eu(r,n,i,e.patterns,Se,Ce);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Ql(t,n)),1/0),u=c.filter(e=>Ql(e,n)===l);if(u.length===0||!u.some(e=>De(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return ae(u,0,!1,i,a)}function ae(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=ve(t,i,n);if(u.length>0){if(s)continue;let e=ye(t,n);return L(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!ql(n,e.patterns))continue;let d=ye(t,n);for(let e of d)l.add(e);let f=Oe(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function I(e,t,n,r){return oe(e,0,t,n,r)}function oe(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=we(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>Kl(t,e.patterns,!1)).length>0){let n=u.filter(t=>ql(t,e.patterns)),i=_e(t,s,r,a,o);return se(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=Oe(n,u.filter(t=>ql(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function se(e,t,n,i,a,o,s){return ce({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=Oe(i,a,o,s);return c.stop?c.outcome:A(c.outcome,oe(e,t+1,n,o,s))}})}function L(e,t,n,i,a,o,s){return ce({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=Oe(n,i,a,o);return c.stop?c.outcome:A(c.outcome,ae(e,t+1,s||c.handled,a,o))}})}function ce(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>ee(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=R({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?le(g,a,l,f,p,i,h):(ge(h()),f())}function le(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return ue(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function R(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=kl(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:El(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:kl(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>Od(`run-exact`),continueSequence:()=>Od(`continue-sequence`),clear:()=>Od(`clear`),defer:e=>Od(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(Ru(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!Ad(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function ue(e,t,n,r,i){me();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{de(o,t,n,r)})}function de(e,n,r,i){if(!he(e))return;let a={signal:e.controller.signal,sequence:kl(i),focused:r,sleep:t=>Md(t,e.controller.signal),runExact:()=>kd(`run-exact`),continueSequence:()=>kd(`continue-sequence`),clear:()=>kd(`clear`)},o;try{o=n(a)}catch(n){he(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),pe(e));return}if(Ru(o)){o.then(t=>{fe(e,t)}).catch(n=>{he(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),pe(e))});return}fe(e,o)}function fe(e,n){if(he(e)){if(n!==void 0&&!jd(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),pe(e);return}pe(e),e.apply(n)}}function pe(e){he(e)&&(d=null)}function me(){let e=d;e&&(d=null,e.controller.abort())}function he(e){return d===e}function ge(e){let n=Pl(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function _e(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of we(n,r,a,o,l))Kl(t,e.patterns,!1)&&c.push(t)}return c}function ve(t,n,r){return t.filter((t,i)=>i>=n&&Kl(t,e.patterns,!1)&&Rd(t.parts,r.parts))}function ye(t,n){return t.filter(t=>t.layer===n.layer&&ql(t,e.patterns)&&Rd(t.parts,n.parts))}function be(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return Ld(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function xe(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function Se(n,r){return Nd(e.patterns,t,n,r)}function Ce(t,n,r){return Pd(e.patterns,t,n,r)}function we(e,t,n,r,i){let a=tu(e,t,n,Se,Ce);return a.some(e=>De(e,r,i))?a:[]}function Te(n){return Fd(e.patterns,t,n)}function Ee(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function De(e,t,n){return Ee(e.binding,t,n)}function Oe(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,Te(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:te}}function Ld(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function Rd(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var zd=()=>{};function Bd(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function Vd(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function Hd(e,t,n,r,i){let a;try{a=Cl(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Lu(e,`Failed to register keymap token`)),zd}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),zd;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,Lu(e,`Failed to register keymap token "${a}"`)),zd}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,Lu(e,`Failed to register keymap token "${a}"`)),zd}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,Lu(e,`Failed to unregister keymap token "${a}"`))}}}function Ud(e,t,n,r){let i,a;try{i=Cl(r.name);let e=Bd(i,`min`,r.min,1),t=Bd(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:Ml(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Lu(e,`Failed to register keymap sequence pattern`)),zd}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),zd):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function Wd(e,t,n,r){return Vd(r,{kind:n,reservedFields:n===`layer`?Eu:n===`binding`?Tu:wu,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var Gd=()=>{};function Kd(e,t){return t.priority-e.priority||t.order-e.order}function qd(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function Jd(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function Yd(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),Gd;let o,s,c,p,m,v,y;try{y=l(n),o=u(cu(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,Lu(e,`Failed to register keymap layer`)),Gd}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return Gd;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:Yl(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(Kd),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>su(e)});t&&(i=cu(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(Eu.has(c)||l===void 0)continue;o[c]=zu(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Fu({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?zu(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=Yl(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,Lu(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=qd(t),r=Jd(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,Lu(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var Xd=1e3;function Zd(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=Xd){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:Xd},`[Keymap] Possible infinite state listener feedback loop detected after ${Xd} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function Qd(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var $d=Object.freeze({});function ef(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:iu(),bindingExpanders:iu(),bindingParsers:iu(),bindingTransformers:iu(),bindingFields:new Map,commandTransformers:iu(),commandFields:new Map,eventMatchResolvers:iu(),disambiguationResolvers:iu(),keyHooks:au(),keyAfterHooks:au(),rawHooks:au(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:iu(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:$d,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function tf(e){return Al(e)}var nf=class{#e=ef();#t=!1;#n=new Map;#r=[];#i=nu(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=nu((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Zd(this.#e,this.#i,this.#a),this.#l=Td(this.#e,this.#o),this.#u=Uu(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=Cu(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Qd(this.#e,this.#o,this.#s),this.#d=ud(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=_d(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=uu(this.#o,this.#u),this.#m=Yd(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=Id(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[Ll](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?tf(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return Wd(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return Hd(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Ud(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return Wd(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return Wd(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},rf=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),af=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),of=cf(rf),sf=cf(af);function cf(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function lf(e){return e>=65&&e<=90?e+32:e}function uf(e){return e>=48&&e<=57}function df(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(lf(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function ff(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(lf(r));if(i){for(let e of i)if(df(t,e,n))return e}}function pf(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function mf(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function hf(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function gf(e,t){let n=ff(of,e,t);if(n)return n;if(lf(e.charCodeAt(t))!==102||!uf(e.charCodeAt(t+1)))return;let r=uf(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function _f(e,t){return ff(sf,e,t)}function vf(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=_f(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=gf(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var yf=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[mf(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[mf(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[pf(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[mf(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=vf(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=gf(t,n);return s?{parts:[hf(s,e)],nextIndex:n+s.length}:{parts:[mf(a,e)],nextIndex:n+1}},bf=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function xf(e){return e.appendBindingParser(e=>yf(e))}function Sf(e){return e.appendEventMatchResolver((e,t)=>bf(e,t))}function Cf(e){let t=xf(e),n=Sf(e);return()=>{n(),t()}}var wf=Symbol(`keymap:mod-bindings`),Tf=/(^|[+,\s])mod(?=\s*\+)/i,Ef=/(^|[+,\s])mod(?=\s*\+)/gi;function Df(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Of(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function kf(e){return e.acquireResource(wf,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Tf.test(t))return;let r=Df(e.getHostMetadata());return[{key:t.replace(Ef,(e,t)=>`${t}${r}`),displays:n??Of(t)}]}))}var Af=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function jf(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Mf(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=jf(t);return n===`unknown`?jf(e?.platform??e?.userAgent):n}function Nf(){let e=Mf();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Pf(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Ff(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Pf(t.name)?[t]:[t,{...t,shift:!1}]}var If=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Lf(){return globalThis.MutationObserver}function Rf(e){return Af.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function zf(e){if(!e)return new If(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new If(Rf(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Bf=class{metadata=Nf();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(zf(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(zf(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return zf()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Lf();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Vf(e){return new Bf(e)}var Hf=(e,t)=>Ff(e).map(e=>t.resolveKey(e)),Uf=`fungi.app.ready`,Wf=`fungi.app.connect`,Gf=e=>V.pipe(G(Rn(1)),G(K(e))),Kf=e=>W(Gf(e)),qf=Pn.pipe(G(xr()),G(Gn(Number.isSafeInteger,{message:`Expected a safe integer`}))),Jf=qf.pipe(G(sn(0))),Yf=qf.pipe(G(Qr(0))),Xf=U({appId:Gf(160),releaseId:Gf(160),surfaceId:Gf(160)}),Zf=U({editing:$r,surface:xn([Gf(160),vn])}),Qf=xn([U({kind:B(`compose`),requestId:Gf(160),text:Gf(2e3)}),U({kind:B(`navigate`),requestId:Gf(160),params:H(U({key:Gf(64),value:Gf(4096)})).pipe(G(K(16)))})]),$f=U({computerId:xn([Gf(256),vn]),teamHasComputers:W(wn($r)),computerAccessGranted:W($r),focus:Zf,openRequest:xn([vn,Qf]),visibility:Sr([`visible`,`hidden`])}),ep=Sr([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),tp=U({altKey:$r,ctrlKey:$r,id:Gf(160),key:Gf(64),metaKey:$r,shiftKey:$r}),np=U({action:W(Yn),availability:W(Yn),category:Gf(160),description:Kf(512),id:Gf(160),projections:W(Yn),title:Gf(160)}),rp=U({arguments:W(Yn),commandId:Gf(321),origin:Sr([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:Gf(160)}),ip=xn([U({result:W(Yn),status:B(`handled`)}),U({error:Yn,status:B(`failed`)})]),ap=e=>Gf(e).pipe(G(Gn(e=>{for(let t=0;t<e.length;t+=1)if(bl(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),op={id:Gf(64),text:ap(80),end:An($r)},sp=An(Pn.pipe(G(xr()),G(gr({minimum:0,maximum:9999})))),cp=H(xn([U({...op,kind:B(`text`),tone:An(Sr([`neutral`,`success`,`warning`,`error`]))}),U({...op,kind:B(`button`),icon:An(Sr([`folder`,`ports`,`processes`,`access`])),count:sp,title:An(ap(1024)),disabled:An($r),opens:An(B(`dialog`)),expanded:An($r)}),U({...op,kind:B(`toggle`),pressed:$r}),U({...op,kind:B(`menu`),count:sp,title:An(ap(1024)),options:H(U({id:Gf(64),text:ap(80),checked:An($r),disabled:An($r)})).pipe(G(K(16)),G(Gn(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(G(K(6)),G(Gn(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),lp=U({computerId:Gf(256),path:Gf(1024)}),up=Gf(80).pipe(G(Gn(e=>e.trim()===e,{message:`Expected a trimmed title`}))),dp=Gf(64),fp=Gf(80),pp=e=>new Set(e.map(e=>e.id)).size===e.length,mp=U({id:dp,label:fp,siblings:W(H(U({id:dp,label:fp})).pipe(G(K(16)),G(Gn(pp,{message:`Expected unique crumb sibling ids`}))))}),hp=U({id:dp,label:fp,icon:W(B(`play`)),variant:W(Sr([`primary`,`outline`,`ghost`])),tone:W(B(`destructive`)),disabled:W($r)}),gp=e=>H(hp).pipe(G(K(e)),G(Gn(pp,{message:`Expected unique header command ids`}))),_p=U({id:dp,label:fp,presentation:W(B(`bead`)),tone:W(Sr([`neutral`,`info`,`warning`,`success`,`error`]))}),vp={status:W(H(_p).pipe(G(K(4)),G(Gn(pp,{message:`Expected unique header status ids`})))),crumbs:W(H(mp).pipe(G(K(8)),G(Gn(pp,{message:`Expected unique crumb ids`})))),primary:W(gp(3)),menu:W(gp(12))},yp=U({contractVersion:B(1),canGoBack:$r,title:W(up),...vp}),bp=U({canGoBack:$r,title:W(V),...vp}),xp=xn([U({kind:B(`crumb`),crumbId:dp,siblingId:W(dp)}),U({kind:B(`action`),actionId:dp})]),Sp=wn(U({agentId:Gf(256),sessionId:Gf(256)})),Cp=U({agents:W(H(Sr([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(G(K(4)))),computers:W(H(Sr([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(G(K(4))))}),wp=Sr([`granted`,`declined`,`customize`]),Tp=U({message:Gf(512),tone:W(Sr([`info`,`success`,`warning`,`error`]))}),Ep=Sr(to);U({code:Ep.pick([`DELIVERY_PENDING`])});var Dp=U({code:Ep,message:Gf(512),retryable:$r}),Op=U({protocolVersion:B(2),type:B(Uf)}),kp=U({epoch:Gf(160),protocolVersion:B(2),type:B(Wf)}),Ap=U({epoch:Gf(160),protocolVersion:B(2)}),jp={[Symbol.dispose]:W(Yn)},Mp=xn([U({...jp,ok:B(!0),value:Yn}),U({...jp,error:Dp,ok:B(!1)})]);function Np(e,t,n=`PROTOCOL`){return Bt(tr(e,{onExcessProperty:`error`}),v({onFailure:e=>{throw new Y(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function Pp(e){return Object.freeze(e)}function Fp(e,t){let n=e.arguments===void 0?void 0:Ta(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),Pp(r)}var Ip=Np(np,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),Pp(Tm(()=>za(t)))},`INVALID_ARGUMENT`),Lp=Np(Gf(321),e=>e),Rp=Np(rp,e=>{let t=e.arguments===void 0?void 0:Ta(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),Pp(n)}),zp=Np(xn([Sn,Yn]),e=>e===void 0?void 0:Ta(e)),Bp=Np(kp,e=>Pp(e));Np(Ap,e=>Pp(e));var Vp=Np($f,e=>{let t={computerId:e.computerId,focus:Pp({...e.focus}),openRequest:e.openRequest===null?null:Pp({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),Pp(t)}),Hp=Np(Dp,e=>Pp({...e})),Up=Np(Zf,e=>Pp({...e}),`INVALID_ARGUMENT`),Wp=Np(Xf,e=>Pp({...e})),Gp=Np(ep,e=>e),Kp=Np(cp,e=>Pp(e.map(e=>e.kind===`menu`?Pp({...e,options:Pp(e.options.map(e=>Pp(e)))}):Pp(e))),`INVALID_ARGUMENT`),qp=Np(U({itemId:Gf(64),optionId:An(Gf(64)),anchor:An(U({start:Pn.pipe(G(gr({minimum:0,maximum:1e5}))),width:Pn.pipe(G(gr({minimum:0,maximum:1e5})))}))}),e=>Pp(e.anchor===void 0?{...e}:{...e,anchor:Pp({...e.anchor})}),`INVALID_ARGUMENT`),Jp=Np(lp,e=>Pp({...e}),`INVALID_ARGUMENT`);function Yp(e){let t={id:e.id,label:e.label};return e.presentation!==void 0&&(t={...t,presentation:e.presentation}),e.tone!==void 0&&(t={...t,tone:e.tone}),Pp(t)}function Xp(e){let t={id:e.id,label:e.label};return e.siblings===void 0?Pp(t):Pp({...t,siblings:Pp(e.siblings.map(e=>Pp({...e})))})}function Zp(e){let t={id:e.id,label:e.label};return e.icon!==void 0&&(t={...t,icon:e.icon}),e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),Pp(t)}function Qp(e){let t={canGoBack:e.canGoBack};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:Pp(e.crumbs.map(Xp))}),e.primary!==void 0&&(t={...t,primary:Pp(e.primary.map(Zp))}),e.menu!==void 0&&(t={...t,menu:Pp(e.menu.map(Zp))}),e.status!==void 0&&(t={...t,status:Pp(e.status.map(Yp))}),Pp(t)}var $p=Np(yp,Qp,`INVALID_ARGUMENT`),em=Np(bp,e=>{let t=e.title?.trim();return tm({...Qp({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:1})},`INVALID_ARGUMENT`),tm=Np(yp,e=>Pp({...Qp(e),contractVersion:1}),`INVALID_ARGUMENT`),nm=Np(xp,e=>e.kind===`action`?Pp({...e}):Pp(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),rm=Np(Sp,e=>e===null?null:Pp({...e}),`INVALID_ARGUMENT`),im=Np(Cp,e=>Pp({agents:Pp([...new Set(e.agents??[])]),computers:Pp([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);Np(Op,e=>Pp(e));var am=Np(Gf(512),e=>e),om=Np(Tp,e=>Pp({...e}),`INVALID_ARGUMENT`);Np(U({id:Gf(160),repeat:$r}),e=>Pp(e));var sm=Np(H(tp).pipe(G(K(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new Y(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return Pp(e.map(e=>Pp({...e})))});function cm(e){return Np(U({value:Yn,version:Jf}),t=>Pp({value:e(t.value),version:t.version}))}var lm=cm(Vp),um=Np(U({capabilities:H(Yn).pipe(G(K(128))),context:Yn}),e=>Pp({capabilities:Pp(e.capabilities.map(e=>gm(e))),context:lm(e.context)})),dm=cm(Gp),fm=cm(sm),pm=cm(am),mm=Bt(dm,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new Y(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return Pp({value:e.value,version:e.version})});function hm(e){return Np(U({handle:Yn,id:Gf(160),version:Yf}),t=>{if(!(t.handle instanceof _l)&&!(e&&t.handle instanceof vl))throw new Y(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return Pp({handle:t.handle,id:t.id,version:t.version})})}var gm=hm(!1),_m=hm(!0);function vm(e){let t=e?_m:gm;return Np(U({capabilities:H(Yn).pipe(G(K(128))),context:Yn,identity:Yn,lifecycle:Yn,reservedChords:Yn,theme:Yn}),e=>Pp({capabilities:Pp(e.capabilities.map(e=>t(e))),context:lm(e.context),identity:Wp(e.identity),lifecycle:mm(e.lifecycle),reservedChords:fm(e.reservedChords),theme:pm(e.theme)}))}var ym=vm(!1);vm(!0);function bm(e){return Np(Mp,t=>t.ok?Pp({ok:!0,value:e(t.value)}):Pp({ok:!1,error:Hp(t.error)}))}var xm=bm(ym),Sm=bm(Np(U({commandId:Gf(321)}),e=>Pp(e)));bm(Np(ip,e=>{if(e.status===`failed`)return Pp({status:`failed`,error:Tm(()=>Oa(e.error))});let t=e.result===void 0?void 0:Ta(e.result);return Pp(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Cm=bm(Np(Sn,()=>void 0)),wm=bm(Np(wp,e=>e));bm(Np($r,e=>e)),bm(Np($r,e=>e));function Tm(e){try{return e()}catch(e){throw new Y(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Em=xn([U({kind:B(`saveFile`),name:Gf(255).pipe(G(zr(/^[^\p{Cc}/\\]+$/u))),mime:Gf(255),bytes:gn}),U({kind:B(`copyText`),text:V})]);function Dm(e){let t=tr(Em,{onExcessProperty:`error`})(e);if(fe(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var Om=bm(Np(xn([U({kind:B(`saved`)}),U({kind:B(`copied`)}),U({kind:B(`refused`),reason:Sr([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>Pp(e)));function km(e){return e instanceof Y?{code:e.code,message:jm(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Am(e){try{let t=Hp(e);return new Y(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new Y(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function jm(e){return e.trim().slice(0,512)||`Host operation failed`}var Mm=e=>({ok:!0,value:e}),Nm=e=>({error:km(e),ok:!1});async function Pm(e,t){let n,r=new Set;try{return n=await e,Fm(t(n))}catch(e){throw Im(e)&&Lm(e,r),e instanceof Y?e:new Y(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Im(n)&&Lm(n,r)}}function Fm(e){if(e.ok)return e.value;throw Am(e.error)}function Im(e){return ut(e)&&Symbol.dispose in e&&st(e[Symbol.dispose])}function Lm(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Rm(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function zm(e){let t=sm(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=sm(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Bm(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Vf(r),a=new nf(i);Cf(a),kf(a),a.prependEventMatchResolver(Hf);let o=Hm(e.onBroken),s=Km(a,e.chords,e.remote,o),c=Vm(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Um(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Wm(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Wm(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Km(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function Vm(e,t,n,r,i){return()=>{if(!n())return;let a=Um(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Hm(e){return t=>{try{Pm(t(),Cm).catch(t=>{Js(`browser-bridge.host-call`,t),e(t)})}catch(t){Js(`browser-bridge.host-call`,t),e(t)}}}function Um(e,t){let n=e.activeElement;return Up({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Wm(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||Gm(e.key)&&n())return!1;e.run()}})),priority:500})}function Gm(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Km(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:Rf(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function qm(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=Xm(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=Ym(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of Jm)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of Jm)e.window.removeEventListener(t,n)}}var Jm=[`mousedown`,`mouseup`,`auxclick`];function Ym(e){return e===3?`back`:e===4?`forward`:null}function Xm(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:Zm(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function Zm(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function Qm(){return!Kt(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function $m(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function eh(e){let t=new Map,n=$m(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=gm(n),r=ih(e.id,e.version);if(t.has(r))throw nh(e.handle),new Y(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())nh(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)nh(t)},o=e=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=ih(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new Y(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new Y(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var th=Ft().transform(e=>{let t=E(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=Pr(U({[Symbol.dispose]:W(Lr(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function nh(e){try{let t=th.parse(e);if(t===void 0||rh.has(t.owner))return;rh.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var rh=new WeakSet;function ih(e,t){return`${e}@${String(t)}`}var ah=class extends vl{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(Lp(e))?.abort(),Promise.resolve(Mm(void 0))}catch(e){return Promise.resolve(Nm(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new Y(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=Rp(e);if(this.#n.has(t.requestId))throw new Y(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new Y(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=zp(await this.#t(Fp(t,n.signal)));return Mm(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof vi)try{return Mm({status:`failed`,error:Oa({code:e.code,message:e.message,details:e.details})})}catch(e){return Nm(e)}return Nm(e)}}[Symbol.dispose](){this.dispose()}};function oh(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function sh(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:oh(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{Pm(e(),Cm).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:lh(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function ch(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new Y(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function lh(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!st(s))throw new Y(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Ip(o),l=new ah(s),u=ch(n,c,s,l);try{let t=await uh(e,c,u.target);r()&&await dh(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function uh(e,t,n){return Pm(e.registerCommand(t,n),Sm)}async function dh(e,t,n){throw n.dispose(),await Pm(e.unregisterCommand(t),Cm),new Y(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var fh=Mn(e=>e instanceof _l),ph=class extends vl{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw wh();let t=e===void 0?void 0:Hp(e);return setTimeout(()=>this.#t.disconnect?.(t??Oh()),0),Promise.resolve(Mm(void 0))}catch(e){return Promise.resolve(Nm(e))}}async requestClose(){try{if(this.#e)throw wh();return Mm(await(this.#t.beforeClose?.()??!0))}catch(e){return Nm(e)}}async requestBack(){try{if(this.#e)throw wh();return Mm(await(this.#t.back?.()??!1))}catch(e){return Nm(e)}}async activateNavigation(e){try{if(this.#e)throw wh();let t=nm(e);return Sl(this.#t.navigation,t)?Mm(await(this.#t.activate?.(t)??!1)):Mm(!1)}catch(e){return Nm(e)}}async activateStatus(e){try{if(this.#e)throw wh();let t=qp(e);return xl(this.#t.statusItems,t)?Mm(await(this.#t.statusAction?.(t)??!1)):Mm(!1)}catch(e){return Nm(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Nm(wh()):this.#n(e,`context`,Vp,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw wh();let n=um(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Mm(void 0));for(let e of n.capabilities)t.push({...e,handle:Pr(fh)(e.handle).dup()});if(!this.#t.capabilities)throw wh();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Mm(void 0))}catch(e){for(let e of t)nh(e.handle);return Promise.resolve(Nm(e))}}updateLifecycle(e){try{if(this.#e)throw wh();let t=cm(Gp)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Mm(void 0));if(!kh(this.#t.lifecycle.get(),t.value))throw new Y(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Mm(void 0))}catch(e){return Promise.resolve(Nm(e))}}async updateReservedChords(e){return this.#e?Nm(wh()):this.#n(e,`chords`,sm,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Nm(wh()):this.#n(e,`theme`,am,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=cm(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Mm(void 0))}catch(e){return Promise.resolve(Nm(e))}}};async function mh(e){let t=vh(),n=new ph(t),r=yl(e.port,n),i,a=_h(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=Fm(xm(o));if(!e.isActive())throw gh();let c=yh({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return jh(t,e,n,r,i)}}function hh(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function gh(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function _h(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{Js(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function vh(){return{statusItems:[],navigation:{canGoBack:!1},bindings:Rm(),chords:zm([]),context:$m({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:$m(`connecting`),theme:$m(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function yh(e){let t=Wp(e.bootstrap.identity),n=Ah(e.bootstrap);hh(e.state,n);let r=eh(e.bootstrap.capabilities);return e.state.capabilities=r,xh(e,t,r)}function bh(e,t,n){return Bm({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof Y?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function xh(e,t,n){let r=!1,i=t=>{r||(r=!0,Eh([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{nh(e.bootstrapOwner)},()=>{nh(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=sh(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=Ch(e.remote,a,e.state),c=Sh(e.state,e.remote,a),l=bh(e,t,i),u=qm({window:e.options.window,mac:Qm(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{Js(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Th(i)}),Dh({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function Sh(e,t,n){let r=Object.freeze({async publish(r){n();let i=em(r);e.canGoBack=i.canGoBack,e.navigation=$p(i),await Pm(t.reportNavigation(i),Cm)},onActivate(t){if(n(),e.activate!==void 0)throw new Y(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new Y(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new Y(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function Ch(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await Pm(e.requestComputerChoice(),Cm)},async requestBrowserAction(n){t();let r=Dm(n);return r.kind===`refused`?r:await Pm(e.requestBrowserAction(r),Om)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new Y(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await Pm(e.requestAppPermissions(im(n)),wm)},async openDesktopSettings(){t(),await Pm(e.openDesktopSettings(),Cm)},async openTeamBilling(){t(),await Pm(e.openTeamBilling(),Cm)},async openNavigation(n){t(),await Pm(e.openNavigation(Jp(n)),Cm)},async reportStatus(r){t();let i=Kp(r);n.statusItems=i,await Pm(e.reportStatus(i),Cm)},async reportAgentSessionSelection(n){t(),await Pm(e.reportAgentSessionSelection(rm(n)),Cm)},async showToast(n){t(),await Pm(e.showToast(om(n)),Cm)}})}function wh(){return new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Th(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function Eh(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function Dh(e){return Object.freeze(e)}function Oh(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function kh(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function Ah(e){let t=cm(Vp)(e.context),n=cm(am)(e.theme),r=cm(Gp)(e.lifecycle),i=cm(sm)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new Y(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function jh(e,t,n,r,i){throw Eh([()=>{n[Symbol.dispose]()},()=>{i&&nh(i)},()=>{nh(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof Y?e:new Y(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Mh=!1,Nh=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(Mh=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Fh())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:Uf},`*`)}catch(e){Js(`connect.notify-host`,e),n(Vh(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(Lh())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),Mh=!1,a(e??Lh());return}i(t)}}#s(e,t,n){if(!Bh(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||Rh(e.origin)===void 0){t(zh());return}let r=Hh(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Uh(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),mh({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Mh=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Ih(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Fh();if(Mh)return new Y(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Kt(globalThis.window)||this.#e.parent===this.#e)return new Y(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Ph(e){return new Nh(e).start()}function Fh(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Ih(e){return e instanceof Y?e:new Y(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function Lh(){return new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function Rh(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function zh(){return new Y(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var Bh=Dr(U({type:B(Wf)}));function Vh(e){return new Y(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Hh(e,t){try{return Bp(e.data)}catch(e){Js(`connect.decode-message`,e),t(e instanceof Y?e:new Y(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Uh(e){return new Y(e,{code:`PROTOCOL`,retryable:!1})}function Wh(e,t,n){e.style.isolation=`isolate`;let r=(0,qs.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=oo(a),s,c,l,u=!1,d=e=>{let i=(0,q.createElement)(Gh,{state:e,render:n});r.render(t.queryClient?(0,q.createElement)(fo,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):ao(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),Ph({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,ao(e.theme.get(),a),c=e.theme.subscribe(e=>{ao(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof Y&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof Y?e:new Y(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new Y(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function Gh({state:e,render:t}){return(0,q.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,q.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,q.createElement)(q.Fragment,null,e.status===`not-hosted`?(0,q.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function Kh(e){let t=(0,q.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,q.useCallback)(()=>e?.get(),[e]);return(0,q.useSyncExternalStore)(t,n,n)}function qh(e){return Kh(e?.context)??null}function Jh(e,t,n,r){let i=(0,q.useRef)(t);i.current=t;let a=(0,q.useRef)(n);a.current=n;let o=(0,q.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,q.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,q.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,q.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function Yh(e,{canGoBack:t,title:n,crumbs:r,primary:i,menu:a,status:o,onBack:s,onCrumb:c,onAction:l}){let u=(0,q.useRef)(s),d=(0,q.useRef)(c),f=(0,q.useRef)(l);(0,q.useEffect)(()=>{u.current=s,d.current=c,f.current=l},[s,c,l]),(0,q.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>u.current()),n=e.onActivate(e=>{if(e.kind===`action`){let t=f.current;return t?.(e.actionId),t!==void 0}let t=d.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),Xh(e,{canGoBack:!1})}},[e]);let p=JSON.stringify([r,i,a,o]),m=(0,q.useRef)({crumbs:r,primary:i,menu:a,status:o});(0,q.useEffect)(()=>{m.current={crumbs:r,primary:i,menu:a,status:o}},[r,i,a,o]),(0,q.useEffect)(()=>{if(!e)return;let r={canGoBack:t};n!==void 0&&(r={...r,title:n});let i=m.current;i.crumbs!==void 0&&(r={...r,crumbs:i.crumbs}),i.primary!==void 0&&(r={...r,primary:i.primary}),i.menu!==void 0&&(r={...r,menu:i.menu}),i.status!==void 0&&(r={...r,status:i.status}),Xh(e,r)},[e,t,n,p])}function Xh(e,t){e.publish(t).catch(e=>{e instanceof Y&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var Zh=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function Qh(e,t,n){return new Zh(e,t,n)}function $h(e){let t=ot(e),n=E(Object),r=ot(Object.fromEntries(Object.keys(e).map(e=>[e,Ft().optional()])));return Ft().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,_().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){nh(e)}}})}function eg(e){return Ft().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof Y?e:new Y(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{nh(t)}})}function tg(e){return _({output:Nt(Ft().transform(t=>{try{return e.parse(t)}catch(e){throw nh(t),e instanceof Y?e:new Y(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var ng=tg(eg(xe())),rg=$h({fetch:tg(E(Response)),close:ng}),ig=[];for(let e=0;e<256;++e)ig.push((e+256).toString(16).slice(1));function ag(e,t=0){return(ig[e[t+0]]+ig[e[t+1]]+ig[e[t+2]]+ig[e[t+3]]+`-`+ig[e[t+4]]+ig[e[t+5]]+`-`+ig[e[t+6]]+ig[e[t+7]]+`-`+ig[e[t+8]]+ig[e[t+9]]+`-`+ig[e[t+10]]+ig[e[t+11]]+ig[e[t+12]]+ig[e[t+13]]+ig[e[t+14]]+ig[e[t+15]]).toLowerCase()}var og,sg=new Uint8Array(16);function cg(){if(!og){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);og=crypto.getRandomValues.bind(crypto)}return og(sg)}var lg={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ug(e,t,n){if(lg.randomUUID&&!t&&!e)return lg.randomUUID();e||={};let r=e.random??e.rng?.()??cg();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ag(r)}var dg=Me({version:`v7`}),fg=z().regex(/^replay_[a-f0-9]{64}$/);Ve(e=>fg.safeParse(e).success);var pg=Me({version:`v4`});Ve(e=>dg.safeParse(e).success);var mg=Ve(e=>pg.safeParse(e).success);function hg(){return mg.parse(ug())}var gg=me([`plain`,`pencil`,`manga`,`riso`,`halftone`,`blueprint`,`crt`,`watercolor`]),_g={ink:`var(--sprite-ink, var(--color-base-content, #1c1c1a))`,paper:`var(--sprite-paper, var(--color-base-100, #fbfaf6))`,accent:`var(--sprite-accent, var(--color-accent, #d20f39))`,risoFirst:`var(--sprite-riso-first, var(--color-info, #1e66f5))`,risoSecond:`var(--sprite-riso-second, var(--color-accent, #ea76cb))`,blueprint:`var(--sprite-blueprint, color-mix(in oklab, var(--color-info, #1e66f5) 55%, #0b2350))`,blueprintLine:`var(--sprite-blueprint-line, color-mix(in oklab, var(--color-info-content, #ffffff) 25%, #ffffff))`,screen:`var(--sprite-screen, color-mix(in oklab, var(--color-base-content, #111111) 12%, #050805))`,phosphor:`var(--sprite-phosphor, var(--color-success, #40a02b))`},vg=(e,t={},...n)=>({tag:e,attributes:t,children:n}),yg=(e,t,n=1)=>vg(`feFlood`,{style:`flood-color: ${e}`,"flood-opacity":n,result:t}),bg=(e,t,n)=>[vg(`feImage`,{href:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${String(t)}' height='${String(t)}'>${e}</svg>`)}`,width:t,height:t,result:`${n}Cell`}),vg(`feTile`,{in:`${n}Cell`,result:n})],xg=(e,t,n)=>vg(`feColorMatrix`,{in:t,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${e}`,result:n}),Sg=(e,t)=>xg(`-0.333 -0.333 -0.333 1 0`,e,t),Cg=(e,t,n,r=1.1)=>[vg(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,result:`${t}In`}),vg(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,result:`${t}Out`}),vg(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),xg(`${String(n)} ${String(n)} ${String(n)} ${String(r)} 0`,`${t}Edges`,t)],wg=(e,t,n,r)=>[vg(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,preserveAlpha:`true`,result:`${t}In`}),vg(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,preserveAlpha:`true`,result:`${t}Out`}),vg(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),xg(`${String(n)} ${String(n)} ${String(n)} 0 -0.15`,`${t}Edges`,`${t}Inner`),vg(`feMorphology`,{in:e,operator:`dilate`,radius:r,result:`${t}Grown`}),vg(`feComposite`,{in:`${t}Grown`,in2:e,operator:`out`,result:`${t}Ring`}),xg(`0 0 0 1 0`,`${t}Ring`,`${t}Outline`),Eg(t,`${t}Inner`,`${t}Outline`)],Tg=(e,t,n)=>vg(`feComponentTransfer`,{in:e,result:n},vg(`feFuncA`,{type:`discrete`,tableValues:t})),Eg=(e,...t)=>vg(`feMerge`,{result:e},...t.map(e=>vg(`feMergeNode`,{in:e}))),Dg=(e,t,n,r=1)=>[yg(e,`${n}Flood`,r),vg(`feComposite`,{in:`${n}Flood`,in2:t,operator:`in`,result:n})],Og={x:`0%`,y:`0%`,width:`100%`,height:`100%`},kg={x:`-8%`,y:`-8%`,width:`116%`,height:`116%`},Ag={value:1.6,line:6,outline:2.4,midHatch:[3.2,-.05],darkHatch:[3.4,-.4],tooth:`0 0 0 -0.7 1.45`,opacity:1},jg=e=>({region:kg,primitives:[vg(`feComponentTransfer`,{in:`SourceGraphic`,result:`valued`},...[`feFuncR`,`feFuncG`,`feFuncB`].map(t=>vg(t,{type:`gamma`,amplitude:1,exponent:e.value,offset:0}))),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:2,seed:1,result:`wobble`,"data-sprite-boil":`wobble`}),vg(`feDisplacementMap`,{in:`valued`,in2:`wobble`,scale:2.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...Cg(`drawn`,`line`,e.line,e.outline),Sg(`drawn`,`dark`),...bg(`<path d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='black' stroke-width='1.1'/>`,6,`hatch45`),vg(`feOffset`,{in:`hatch45`,dx:0,dy:0,result:`hatchOffset`,"data-sprite-boil":`hatch`}),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.07,numOctaves:2,seed:5,result:`strokeBend`}),vg(`feDisplacementMap`,{in:`hatchOffset`,in2:`strokeBend`,scale:4,xChannelSelector:`R`,yChannelSelector:`B`,result:`hatchA`}),...bg(`<path d='M-1 4l2 2M0 0l5 5M4 -1l2 2' stroke='black' stroke-width='0.9'/>`,5,`hatch135`),vg(`feDisplacementMap`,{in:`hatch135`,in2:`strokeBend`,scale:3,xChannelSelector:`G`,yChannelSelector:`R`,result:`hatchB`}),vg(`feComposite`,{in:`dark`,in2:`hatchA`,operator:`arithmetic`,k1:e.midHatch[0],k4:e.midHatch[1],result:`shadeA`}),vg(`feComposite`,{in:`dark`,in2:`hatchB`,operator:`arithmetic`,k1:e.darkHatch[0],k4:e.darkHatch[1],result:`shadeB`}),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.9,numOctaves:1,seed:3,result:`tooth`}),xg(e.tooth,`tooth`,`toothMask`),xg(`0 0 0 6 -4.6`,`dark`,`solid`),Eg(`graphiteRaw`,`solid`,`shadeA`,`shadeB`,`line`),vg(`feComposite`,{in:`graphiteRaw`,in2:`toothMask`,operator:`in`,result:`graphite`}),...Dg(_g.ink,`graphite`,`pencil`,e.opacity)],boil:{intervalMs:160,tracks:[{name:`wobble`,attribute:`seed`,frames:[1,2,3]},{name:`hatch`,attribute:`dx`,frames:[0,1,2]}]}}),Mg={region:kg,primitives:[vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.04,numOctaves:2,seed:2,result:`brush`,"data-sprite-boil":`brush`}),vg(`feDisplacementMap`,{in:`SourceGraphic`,in2:`brush`,scale:2,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...Dg(_g.paper,`SourceAlpha`,`paperFill`),Sg(`drawn`,`dark`),...bg(`<circle cx='2.5' cy='2.5' r='1.15' fill='black'/>`,5,`dots`),Tg(`dark`,`0 1 1 0`,`midTone`),vg(`feComposite`,{in:`dots`,in2:`midTone`,operator:`in`,result:`tone`}),Tg(`dark`,`0 0 0 1`,`solid`),xg(`3 -3 0 0 -0.35`,`drawn`,`satRG`),xg(`-3 3 0 0 -0.35`,`drawn`,`satGR`),xg(`0 3 -3 0 -0.35`,`drawn`,`satGB`),xg(`0 -3 3 0 -0.35`,`drawn`,`satBG`),Eg(`saturation`,`satRG`,`satGR`,`satGB`,`satBG`),Tg(`saturation`,`0 1`,`accentMask`),...Dg(_g.accent,`accentMask`,`accentFill`),...wg(`drawn`,`edge`,2,2.2),vg(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.25,result:`stroke`}),Eg(`inkRaw`,`tone`,`solid`,`stroke`),...Dg(_g.ink,`inkRaw`,`ink`),Eg(`manga`,`paperFill`,`accentFill`,`ink`)],boil:{intervalMs:180,tracks:[{name:`brush`,attribute:`seed`,frames:[2,4,6]}]}},Ng={region:kg,primitives:[xg(`-0.55 -0.55 -0.55 1.65 0`,`SourceGraphic`,`dark`),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.85,numOctaves:1,seed:7,result:`grain`}),xg(`0 0 0 -0.9 1.35`,`grain`,`grainMask`),vg(`feComposite`,{in:`dark`,in2:`grainMask`,operator:`in`,result:`firstMask`}),...Dg(_g.risoFirst,`firstMask`,`firstInk`,.92),xg(`0 -1.9 0 1.9 0`,`SourceGraphic`,`secondMask`),...Dg(_g.risoSecond,`secondMask`,`secondInk`,.9),vg(`feOffset`,{in:`firstInk`,dx:-1.5,dy:1,result:`firstPlate`,"data-sprite-boil":`register`}),vg(`feOffset`,{in:`secondInk`,dx:1.5,dy:-.5,result:`secondPlate`}),vg(`feBlend`,{in:`firstPlate`,in2:`secondPlate`,mode:`multiply`})],boil:{intervalMs:240,tracks:[{name:`register`,attribute:`dx`,frames:[-1.5,-1,-2]}]}},Pg={region:kg,primitives:[xg(`-0.5 -0.5 -0.5 1.65 0`,`SourceGraphic`,`value`),xg(`0 0 0 0.16 0`,`SourceGraphic`,`floor`),Eg(`dark`,`floor`,`value`),...bg(`<defs><radialGradient id='d'><stop offset='0' stop-opacity='1'/><stop offset='1' stop-opacity='0'/></radialGradient></defs><rect width='6' height='6' fill='url(#d)'/>`,6,`screen`),vg(`feComposite`,{in:`dark`,in2:`screen`,operator:`arithmetic`,k2:1,k3:1,k4:-.92,result:`dotField`}),vg(`feComponentTransfer`,{in:`dotField`,result:`dotsRaw`},vg(`feFuncA`,{type:`linear`,slope:12,intercept:0})),vg(`feComposite`,{in:`dotsRaw`,in2:`SourceAlpha`,operator:`in`,result:`dots`}),...Dg(_g.ink,`dots`,`halftone`)]},Fg={region:Og,primitives:[yg(_g.blueprint,`ground`),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:1,seed:4,result:`hand`,"data-sprite-boil":`hand`}),vg(`feDisplacementMap`,{in:`SourceGraphic`,in2:`hand`,scale:1.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...bg(`<path d='M0 0.5h16M0.5 0v16' stroke='black' stroke-width='1' stroke-opacity='0.22'/>`,16,`grid`),...Dg(_g.blueprintLine,`grid`,`gridLines`),...Dg(_g.blueprintLine,`SourceAlpha`,`wash`,.12),...wg(`drawn`,`edge`,3,1.2),vg(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.3,result:`stroke`}),...Dg(_g.blueprintLine,`stroke`,`lines`),Eg(`blueprint`,`ground`,`gridLines`,`wash`,`lines`)],boil:{intervalMs:200,tracks:[{name:`hand`,attribute:`seed`,frames:[4,5,6]}]}},Ig={region:Og,primitives:[yg(_g.screen,`ground`),vg(`feColorMatrix`,{in:`SourceGraphic`,type:`luminanceToAlpha`,result:`lumRaw`}),vg(`feComposite`,{in:`lumRaw`,in2:`SourceAlpha`,operator:`in`,result:`lum`}),vg(`feComponentTransfer`,{in:`lum`,result:`beam`},vg(`feFuncA`,{type:`linear`,slope:1.5,intercept:-.35})),vg(`feComposite`,{in:`beam`,in2:`SourceAlpha`,operator:`in`,result:`trace`}),...Dg(_g.phosphor,`trace`,`glow`),vg(`feGaussianBlur`,{in:`glow`,stdDeviation:2.5,result:`bloom`}),...bg(`<rect y='2' width='3' height='1' fill='black'/>`,3,`scan`),vg(`feOffset`,{in:`scan`,dx:0,dy:0,result:`scanRoll`,"data-sprite-boil":`roll`}),...Dg(_g.screen,`scanRoll`,`scanlines`,.6),Eg(`crt`,`ground`,`bloom`,`glow`,`scanlines`)],boil:{intervalMs:120,tracks:[{name:`roll`,attribute:`dy`,frames:[0,1,2]}]}},Lg={region:kg,primitives:[vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.03,numOctaves:3,seed:9,result:`flow`}),vg(`feDisplacementMap`,{in:`SourceGraphic`,in2:`flow`,scale:7,xChannelSelector:`R`,yChannelSelector:`G`,result:`bled`}),vg(`feGaussianBlur`,{in:`bled`,stdDeviation:1.4,result:`wash`}),vg(`feComponentTransfer`,{in:`wash`,result:`thin`},vg(`feFuncR`,{type:`linear`,slope:.78,intercept:.2}),vg(`feFuncG`,{type:`linear`,slope:.78,intercept:.2}),vg(`feFuncB`,{type:`linear`,slope:.78,intercept:.2}),vg(`feFuncA`,{type:`linear`,slope:.9,intercept:0})),vg(`feGaussianBlur`,{in:`wash`,stdDeviation:3,result:`spread`}),vg(`feComposite`,{in:`wash`,in2:`spread`,operator:`arithmetic`,k2:1.6,k3:-1.4,result:`rimMask`}),vg(`feComponentTransfer`,{in:`wash`,result:`deep`},vg(`feFuncR`,{type:`linear`,slope:.6,intercept:0}),vg(`feFuncG`,{type:`linear`,slope:.6,intercept:0}),vg(`feFuncB`,{type:`linear`,slope:.6,intercept:0})),vg(`feComposite`,{in:`deep`,in2:`rimMask`,operator:`in`,result:`rim`}),vg(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.7,numOctaves:2,seed:11,result:`tooth`}),xg(`0 0 0 -0.8 1.5`,`tooth`,`toothMask`),Sg(`SourceGraphic`,`dark`),xg(`0 0 0 5 -3.8`,`dark`,`keyMask`),...Dg(_g.ink,`keyMask`,`key`,.9),Eg(`paint`,`thin`,`rim`,`key`),vg(`feComposite`,{in:`paint`,in2:`toothMask`,operator:`in`})]},Rg=jg(Ag),zg={manga:Mg,riso:Ng,halftone:Pg,blueprint:Fg,crt:Ig,watercolor:Lg},Bg=e=>e===`pencil`?Rg:zg[e],Vg=`http://www.w3.org/2000/svg`,Hg=(e,t)=>{let n=e.createElementNS(Vg,t.tag);for(let[e,r]of Object.entries(t.attributes))n.setAttribute(e,String(r));for(let r of t.children)n.append(Hg(e,r));return n};function Ug(e){let t=`sprite-style-${hg()}`,n=e.ownerDocument,r=n.defaultView,i=`plain`,a,o,s=!1,c=!0,l,u=0,d=()=>{l!==void 0&&clearInterval(l),l=void 0},f=()=>{if(d(),i===`plain`||!o||s||!c||n.hidden)return;let e=Bg(i).boil;if(!e)return;let t=o;l=setInterval(()=>{if(!n.hidden){u+=1;for(let n of e.tracks){let e=n.frames[u%n.frames.length];t.querySelector(`[data-sprite-boil="${n.name}"]`)?.setAttribute(n.attribute,String(e))}}},e.intervalMs)},p=r?.IntersectionObserver,m=p?new p(e=>{c=e.some(e=>e.isIntersecting),f()}):void 0;m?.observe(e);let h=()=>{d(),o?.remove(),o=void 0,a&&(a.style.filter=``)};return{set(r,s){if(r===i&&s===a||(h(),i=r,a=s,r===`plain`))return;let c=Bg(r),l=`${t}-${r}`,u=n.createElementNS(Vg,`svg`);u.setAttribute(`aria-hidden`,`true`),u.setAttribute(`focusable`,`false`),u.setAttribute(`width`,`0`),u.setAttribute(`height`,`0`),u.style.cssText=`position:absolute;width:0;height:0;overflow:hidden`,u.append(Hg(n,vg(`filter`,{id:l,...c.region,"color-interpolation-filters":`sRGB`},...c.primitives))),e.append(u),o=u,s.style.filter=`url(#${l})`,f()},still(e){e!==s&&(s=e,f())},dispose(){h(),a=void 0,m?.disconnect()}}}var Wg=[`mushroom`,`cat`,`burger`];me([`shift`,`keep`]);var Gg=z().regex(/^#[0-9a-f]{6}$/i),Kg=Ee([Gg,Fe(),a()]),qg=16,Jg=yt({v:Oe(1),character:me(Wg),appearance:Re(z().min(1),Kg).refine(e=>Object.keys(e).length<=qg,{message:`Avatar appearance cannot exceed ${String(qg)} keys`}),expression:z().min(1),renderStyle:gg});function Yg(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(-1,Math.min(n-3,9-n,1));return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function Xg(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}function Zg(e){let t=Xg(e)%360;return{cap:Yg(t,68,72),capSpot:Yg(t,70,92)}}function Qg(e){return{v:1,character:`mushroom`,appearance:Zg(e),expression:`normal`,renderStyle:`plain`}}var $g=V.pipe(G(Rn(1)),G(K(256))),e_=Mn(e=>Jg.safeParse(e).success,{expected:`an Avatar v1 descriptor`}),t_=U({agentId:$g,name:$g,avatar:e_,sessionOperations:H(Sr([`agent.read`,`agent.send`,`agent.manage`]))});Qe(()=>yt({agents:_e(yt({agentId:z(),name:z()}))}));var n_=Sr([`new`,`none`]),r_=U({name:$g,requestId:$g,computer:An(n_),avatar:An(e_)}),i_=H(t_),a_=Pr(i_,{onExcessProperty:`error`}),o_=Pr($g),s_=Pr(Lr(Response)),c_=Qh(`agent.list`,1,Qe(()=>$h({list:tg(eg(Ft().transform(e=>a_(e))))}))),l_=Qh(`agent.manage`,1,Qe(()=>$h({open:tg(rg),create:tg(eg(Ft().transform(e=>Pr(t_)(e))))}))),u_=U({agentId:$g,name:$g}),d_=Qh(`agent.rename`,1,Qe(()=>$h({rename:tg(eg(Ft().transform(e=>Pr(t_)(e))))})));async function f_(e,t){let n=Pr(u_)(t),r=await e.require(d_).rename(n);return Pr(t_)(r)}var p_=U({agentId:$g,avatar:e_}),m_=Qh(`agent.avatar`,1,Qe(()=>$h({setAvatar:tg(eg(Ft().transform(e=>Pr(t_)(e))))})));async function h_(e,t){let n=Pr(p_)(t),r=await e.require(m_).setAvatar(n);return Pr(t_)(r)}var g_=Qe(()=>Ee([ot({status:Oe(`pending`),revision:z()}),ot({status:Oe(`approved`),revision:z()})])),__=Qe(()=>Ee([g_,ot({error:z()})])),v_=Qh(`agent.toolPolicy`,1,Qe(()=>$h({status:tg(eg(Ee([g_,Ct()]))),approve:tg(eg(__))}))),y_=Qh(`agent.read`,1,Qe(()=>$h({open:tg(rg),openInbox:tg(rg)}))),b_=Qh(`agent.send`,1,Qe(()=>$h({open:tg(rg),openInbox:tg(rg)})));async function x_(e,t){let n=Pr(r_)(t),r=await e.require(l_).create(n);return Pr(t_)(r)}async function S_(e,t){let n=await e(),r,i,a=()=>{if(i)throw new Y(`The Agent connection is closed`,{code:`DISCONNECTED`,retryable:!0})},o=async e=>{try{await e.close()}finally{e[Symbol.dispose]()}};return{fetch:async i=>{a();let o=i.method===`GET`||i.method===`HEAD`||e===t?n:await(r??=t());return a(),s_(await o.fetch(i))},close:()=>(i||(i=Promise.all([o(n),...r?[r.then(o)]:[]]).then(()=>void 0),i.catch(e=>{Js(`agents.close`,e)})),i)}}var C_=`https://agent-session.fungi.invalid`;async function w_(e,t){let n=o_(t.agentId),r=`/agents/id-${encodeURIComponent(n)}`,i=`${C_}${r}`,a=e.has(y_)?e.require(y_):e.has(b_)?e.require(b_):e.require(l_),o=()=>a.open({agentId:n}),s=await S_(o,e.has(y_)?()=>(e.has(b_)?e.require(b_):e.require(l_)).open({agentId:n}):o);return Object.freeze({baseUrl:i,fetch:async(e,t)=>{let n=new Request(e,t),i=new URL(n.url);if(i.origin!==C_||!i.pathname.startsWith(`${r}/`))throw new Y(`The Agent request target is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return i.pathname=i.pathname.slice(r.length),s.fetch(new Request(i,n))},close:s.close})}var T_=`${C_}/member`;async function E_(e){let t=e.has(y_)?y_:b_,n=()=>e.require(t).openInbox(),r=await S_(n,e.has(y_)?()=>e.require(b_).openInbox():n);return Object.freeze({baseUrl:T_,fetch:async(e,t)=>{let n=new Request(e,t),i=new URL(n.url);if(i.origin!==C_||!i.pathname.startsWith(`/member/inbox`))throw new Y(`The inbox request target is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return i.pathname=i.pathname.slice(7),r.fetch(new Request(i,n))},close:r.close})}var D_=`~effect/Sink`,O_={_A:L,_In:L,_L:L,_E:L,_R:L},k_={[D_]:O_,pipe(){return s(this,arguments)}},A_=e=>{let t=Object.create(k_);return t.transform=e,t},j_=((e,t,n)=>A_(r=>{let i=e(),a;return t(i)?r.pipe(Wt(e=>{for(let r=0;r<e.length;r++)if(i=n(i,e[r]),!t(i))return r+1<e.length&&(a=e.slice(r+1)),mn();return I}),oe({disableYield:!0}),Dn(()=>Be([i,a]))):Be([i])}))(et,F,(e,t)=>_t(t)),M_=()=>j_,N_=class extends Event{code;message;constructor(e,t){super(e),this.code=t?.code??void 0,this.message=t?.message??void 0}[Symbol.for(`nodejs.util.inspect.custom`)](e,t,n){return n(I_(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(I_(this),t)}};function P_(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function F_(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(F_).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${F_(e.cause)}`:e.message:`${e}`}function I_(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var L_=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},R_=10,z_=13,B_=32,V_=6;function H_(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{maxBufferSize:t,onComment:n,onError:r,onEvent:i,onId:a,onRetry:o}=e,s=[],c=0,l=!0,u,d=``,f=0,p,m=!1,h=!1,g=!1;function _(e){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,e.charCodeAt(0)===65279?e=e.slice(1):e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),(h||g)&&(e=v(e),!e))return;if(!s.length){let t=S(e);t!==``&&y(t),x();return}if(e.indexOf(`
10
+ `)===-1&&e.indexOf(`\r`)===-1){if(c<V_&&!b(s.join(``)+e.slice(0,V_-c))){s.length=0,c=0,h=!0;return}s.push(e),c+=e.length,x();return}s.push(e);let t=s.join(``);s.length=0,c=0,y(S(t)),x()}function v(e){if(e.length===0)return e;if(g)return g=!1,e.charCodeAt(0)===R_?e.slice(1):e;let t=e.indexOf(`\r`),n=e.indexOf(`
11
+ `),r=t===-1?n:n===-1||t<n?t:n;return r===-1?``:r===e.length-1&&e.charCodeAt(r)===z_?(h=!1,g=!0,``):(h=!1,e.slice(r+(e.charCodeAt(r)===z_&&e.charCodeAt(r+1)===R_?2:1)))}function y(e){if(e){if(e.charCodeAt(e.length-1)===z_){C(e,0,e.length-1),g=!0;return}if(b(e)){s.push(e),c=e.length;return}h=!0}}function b(e){let t=e.charCodeAt(0);return t===58&&!!n||t===100&&G_(e,`data`)||t===101&&G_(e,`event`)||t===105&&G_(e,`id`)||t===114&&G_(e,`retry`)}function x(){t!==void 0&&(c+d.length<=t||(m=!0,s.length=0,c=0,u=void 0,d=``,f=0,p=void 0,h=!1,g=!1,r?.(new L_(`Buffered data exceeded max buffer size of ${t} characters`,{type:`max-buffer-size-exceeded`}))))}function S(e){let t=0;if(e.indexOf(`\r`)===-1){let n=e.indexOf(`
12
+ `,t);for(;n!==-1;){if(t===n){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0,t=n+1,n=e.indexOf(`
13
+ `,t);continue}let r=e.charCodeAt(t);if(U_(e,t,r)){let r=e.charCodeAt(t+5)===B_?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===R_){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(`
14
+ `,t);continue}d=f===0?o:`${d}\n${o}`,f++}else W_(e,t,r)?p=e.slice(e.charCodeAt(t+6)===B_?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(`
15
+ `,t)}return e.slice(t)}for(;t<e.length;){let n=e.indexOf(`\r`,t),r=e.indexOf(`
16
+ `,t),i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;C(e,t,i),t=i+1,e.charCodeAt(t-1)===z_&&e.charCodeAt(t)===R_&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(U_(e,t,i)){let n=e.charCodeAt(t+5)===B_?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(W_(e,t,i)){p=e.slice(e.charCodeAt(t+6)===B_?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===B_?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===B_?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===B_?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new L_(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new L_(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function U_(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function W_(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function G_(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}var K_=104857600,q_=class extends EventTarget{static CONNECTING=0;static OPEN=1;static CLOSED=2;CONNECTING=0;OPEN=1;CLOSED=2;get readyState(){return this.#e}get url(){return this.#t.href}get withCredentials(){return this.#r}get onerror(){return this.#u}set onerror(e){this.#u&&this.removeEventListener(`error`,this.#u),this.#u=e,e&&this.addEventListener(`error`,e)}get onmessage(){return this.#d}set onmessage(e){this.#d&&this.removeEventListener(`message`,this.#d),this.#d=e,e&&this.addEventListener(`message`,e)}get onopen(){return this.#f}set onopen(e){this.#f&&this.removeEventListener(`open`,this.#f),this.#f=e,e&&this.addEventListener(`open`,e)}addEventListener(e,t,n){let r=t;super.addEventListener(e,r,n)}removeEventListener(e,t,n){let r=t;super.removeEventListener(e,r,n)}constructor(e,t){super();try{if(e instanceof URL)this.#t=e;else if(typeof e==`string`)this.#t=new URL(e,Y_());else throw Error(`Invalid URL`)}catch{throw P_(`An invalid or illegal string was specified`)}this.#l=H_({maxBufferSize:t?.maxBufferSize??K_,onEvent:this.#v,onError:this.#b,onId:this.#_,onRetry:this.#y}),this.#e=this.CONNECTING,this.#a=3e3,this.#i=t?.fetch??globalThis.fetch,this.#r=t?.withCredentials??!1,this.#p()}close(){this.#o&&clearTimeout(this.#o),this.#e!==this.CLOSED&&(this.#c&&this.#c.abort(),this.#e=this.CLOSED,this.#c=void 0)}#e;#t;#n;#r;#i;#a;#o;#s=null;#c;#l;#u=null;#d=null;#f=null;#p(){this.#e=this.CONNECTING,this.#c=new AbortController;let e=this.#i;e(this.#t,this.#g()).then(this.#m).catch(this.#h)}#m=async e=>{this.#l.reset();let{body:t,redirected:n,status:r,headers:i}=e;if(r===204){this.#x(`Server sent HTTP 204, not reconnecting`,204),this.close();return}if(this.#n=n?new URL(e.url):void 0,r!==200){this.#x(`Non-200 status code (${r})`,r);return}if(!(i.get(`content-type`)||``).startsWith(`text/event-stream`)){this.#x(`Invalid content type, expected "text/event-stream"`,r);return}if(this.#e===this.CLOSED)return;this.#e=this.OPEN;let a=new Event(`open`);if(this.dispatchEvent(a),typeof t!=`object`||!t||!(`getReader`in t)){this.#x(`Invalid response body, expected a web ReadableStream`,r),this.close();return}let o=new TextDecoder,s=t.getReader(),c=!0;do{let{done:e,value:t}=await s.read();if(this.#e===this.CLOSED){c=!1;break}t&&this.#l.feed(o.decode(t,{stream:!e})),e&&(c=!1,this.#l.reset(),this.#S())}while(c)};#h=e=>{this.#c=void 0,e.name!==`AbortError`&&e.type!==`aborted`&&this.#S(F_(e))};#g(){let e={mode:`cors`,redirect:`follow`,headers:{Accept:`text/event-stream`,...this.#s?{"Last-Event-ID":this.#s}:void 0},cache:`no-store`,signal:this.#c?.signal};return`window`in globalThis&&(e.credentials=this.withCredentials?`include`:`same-origin`),e}#_=e=>{this.#s=e};#v=e=>{let t=this.#n?this.#n.origin:this.#t.origin,n=this.#s??``,r=new MessageEvent(e.event||`message`,{data:e.data,origin:t,lastEventId:n});r.origin!==t&&X_(r,`origin`,t),r.lastEventId!==n&&X_(r,`lastEventId`,n),this.dispatchEvent(r)};#y=e=>{this.#a=e};#b=e=>{e.type===`max-buffer-size-exceeded`&&(this.close(),this.#x(e.message))};#x(e,t){this.#e!==this.CLOSED&&(this.#e=this.CLOSED);let n=new N_(`error`,{code:t,message:e});this.dispatchEvent(n)}#S(e,t){if(this.#e===this.CLOSED)return;this.#e=this.CONNECTING;let n=new N_(`error`,{code:t,message:e});this.dispatchEvent(n);let r=setTimeout(this.#C,this.#a);typeof r==`object`&&r&&`unref`in r&&r.unref(),this.#o=r}#C=()=>{this.#o=void 0,this.#e===this.CONNECTING&&this.#p()}};Object.defineProperty(q_,"name",{value:`EventSource`}),Object.defineProperty(q_,Symbol.for(`eventsource.supports-fetch-override`),{value:!0,writable:!1,configurable:!1,enumerable:!1});var J_=q_;function Y_(){let e=`document`in globalThis?globalThis.document:void 0;return e&&typeof e==`object`&&`baseURI`in e&&typeof e.baseURI==`string`?e.baseURI:void 0}function X_(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0})}var Z_=V.check(Rn(1),K(256)),Q_=Pn.check(xr(),sn(0)),$_=xn([U({agentId:Z_,sessionId:Z_,title:V.check(K(4096)),triggerId:An(Z_),createdAt:Q_,lastActivityAt:Q_,settledAt:An(Q_),visitedAt:An(Q_),state:Sr([`needs_you`,`running`,`errored`,`done`])}),U({agentId:Z_,sessionId:Z_,state:B(`unavailable`)})]),ev=U({runId:Z_,nodeId:Z_,iteration:Z_}),tv=U({kind:B(`workflow-review`),key:ev,installationId:Z_,workflowId:wn(Z_),workflowTitle:V,reviewTitle:V,reviewers:Sr([`runner`,`owners`]),show:H(On),choices:An(H(Z_)),openedAt:Q_,expiresAt:Q_,state:Sr([`pending`,`answered`,`delivered`,`timed_out`,`closed`])}),nv=xn([$_,tv]),rv=xn([nv,U({agentId:Z_,sessionId:Z_,deleted:B(!0)})]);function iv(e,t){return`${e}\u0000${t}`}function av(e){return`kind`in e?JSON.stringify([e.kind,e.installationId,e.key.runId,e.key.nodeId,e.key.iteration]):iv(e.agentId,e.sessionId)}var ov=V.pipe(G(Rn(1),K(256))),sv=U({kind:B(`seller-closed`),dispositionId:V.pipe(G(Rn(1),K(1024))),sellerAccountId:ov,buyerAccountId:ov,appId:ov,releaseIds:Wn([ov]),displayName:ov,sellerName:ov,requestId:ov}),cv=V.pipe(G(Rn(1)),G(K(4096))),lv=V.pipe(G(Rn(1)),G(K(513))),uv=U({params:H(U({key:V.check(Rn(1),K(64)),value:V.check(K(4096))})).check(K(16))}),dv=U({id:lv,title:cv,detail:W(V.pipe(G(K(1024)))),tone:W(Sr([`attention`,`running`,`error`,`settled`,`muted`])),status:W(U({label:cv,tone:Sr([`neutral`,`primary`,`secondary`,`accent`,`success`,`info`,`warning`,`error`])})),open:W(uv)}),fv=H(dv).pipe(G(K(200)));U({...dv.fields,media:W(U({path:cv,format:Sr([`fungi:image`,`fungi:video`])}))});var pv=e=>new Set(e).size===e.length,mv=V.pipe(G(K(256)),G(Gn(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),hv=mv.pipe(G(K(64))),gv=U({key:hv,label:mv,kind:Sr([`computer`,`repository`,`branch`]),required:$r,options:W(mv)}).check(Gn(e=>e.kind!==`computer`||e.options===void 0,{message:`Computer options are host-owned`})),_v=H(gv).check(K(4),Gn(e=>pv(e.map(e=>e.key)),{message:`Gill parameter keys must be unique`})),vv=xn([U({storage:mv}),U({binding:mv})]),yv=U({id:mv.pipe(G(Gn(e=>!e.includes(`:`),{message:`Gill IDs are App-local`}))),title:mv,source:mv,params:W(_v),watch:W(vv),desktop:W(U({sizes:H(Sr([`S`,`M`,`L`])).check(Rn(1),K(3),Gn(pv,{message:`Desktop Gill sizes must be unique`}))}))}),bv=ai(hv,V.check(K(256))).check(Gn(e=>Object.keys(e).length<=4,{message:`Gill placement supports at most four parameters`}));U({viewId:lv,params:W(bv),after:W(V.check(K(1024))),options:W(hv)}),U({id:lv,params:W(bv),after:W(V.check(K(1024))),options:W(hv)});var xv=xn([U({viewId:lv,title:cv,state:B(`empty`),rows:Wn([]),next:W(V.pipe(G(K(1024))))}),U({viewId:lv,title:cv,state:B(`error`),rows:Wn([]),reason:W(Sr([`exec_isolation_required`,`params_required`])),error:V.pipe(G(Rn(1)),G(K(512))),recovery:W(xn([U({kind:B(`configure`),param:hv}),U({kind:B(`open`)})]))}),U({viewId:lv,title:cv,state:B(`full`),rows:fv.pipe(G(Rn(1))),next:W(V.pipe(G(K(1024))))})]);Pr(xv,{onExcessProperty:`error`});var Sv=U({options:H(U({value:V.check(K(256)),label:cv,detail:W(V.check(K(1024)))})).check(K(200)),next:W(V.check(K(1024)))}),Cv=xn([xv,Sv]);Pr(Cv,{onExcessProperty:`error`}),Pr(Sv,{onExcessProperty:`error`});var wv={BACKGROUND:{name:`BACKGROUND`,operations:{admit:{cap:`app.background.admit`,requires:[],effect:`read`}}},GIT:{name:`GIT`,operations:{create:{cap:`app.git.create`,requires:[`git.repository`],effect:`write`},fork:{cap:`app.git.fork`,requires:[`git.repository`],effect:`write`},read:{cap:`app.git.read`,requires:[`git.repository`],effect:`read`},write:{cap:`app.git.write`,requires:[`git.repository`],effect:`write`},exchange:{cap:`app.git.exchange`,requires:[`git.repository`],effect:`write`}}},EVENTS:{name:`EVENTS`,operations:{emit:{cap:`app.events.emit`,requires:[`app.events.emit`],effect:`write`}}},APPS:{name:`APPS`,operations:{register:{cap:`app.register`,requires:[`git.repository`],effect:`write`},repository:{cap:`app.catalog.read`,requires:[`git.repository`],effect:`read`},build:{cap:`app.build`,requires:[`git.repository`,`computer.execute`],effect:`write`},buildStatus:{cap:`app.build`,requires:[`git.repository`,`computer.execute`],effect:`read`},select:{cap:`app.select`,requires:[`git.repository`,`computer.execute`],effect:`write`},catalog:{cap:`app.catalog.read`,requires:[`team.workbenchHost`],effect:`read`},fork:{cap:`app.fork`,requires:[`git.repository`],effect:`write`}}},WORKFLOWS:{name:`WORKFLOWS`,operations:{catalog:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},runGraph:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},armSchedule:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},disarmSchedule:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},schedules:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},armEventTrigger:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},disarmEventTrigger:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},eventTriggers:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},cancel:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},answerReview:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},graphStatus:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},runs:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`}}},APP_STORAGE:{name:`APP_STORAGE`,operations:{read:{cap:`app.storage.read`,requires:[`app.storage`],effect:`read`},write:{cap:`app.storage.write`,requires:[`app.storage`],effect:`write`},reset:{cap:`app.storage.write`,requires:[`app.storage`],effect:`write`}}},MEDIA:{name:`MEDIA`,operations:{models:{cap:`app.media.read`,requires:[`media.generation`],effect:`read`},generate:{cap:`app.media.generate`,requires:[`media.generation`,`computer.writeFile`],effect:`write`}}},COMPUTER:{name:`COMPUTER`,operations:{list:{cap:`app.computer.read`,requires:[`computer.list`],effect:`read`},read:{cap:`app.computer.read`,requires:[`computer.readFile`],effect:`read`},ports:{cap:`app.computer.read`,requires:[`computer.execute`],effect:`read`},processes:{cap:`app.computer.read`,requires:[`computer.execute`],effect:`read`},write:{cap:`app.computer.write`,requires:[`computer.writeFile`],effect:`write`},preview:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},processKill:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},processStart:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},exec:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`}}},INBOX:{name:`INBOX`,operations:{page:{cap:`inbox.read`,requires:[`agent.read`],effect:`read`},visit:{cap:`inbox.visit`,requires:[`agent.read`],effect:`write`}}},AGENTS:{name:`AGENTS`,operations:{list:{cap:`agent.list`,requires:[`agent.list`],effect:`read`},send:{cap:`agent.send`,requires:[`agent.send`],effect:`write`}}}},Tv=[`dashboard`,`inbox`,`files`,`media`,`sessions`,`terminal`],Ev=`approvals,agent.list,agent.manage,agent.rename,agent.avatar,agent.toolPolicy,agent.read,agent.send,computer.list,computer.readFile,computer.writeFile,computer.execute,llm.generation,media.generation,games:servers,git.repository,apps.open,apps.call,app.storage,app.events.emit,team.workbenchHost,marketplace.browse,marketplace.purchase,workflow.run,workflow.publish,workflow.arm,world,channels.read,channels.personal.manage`.split(`,`),Dv=[`file.open`],Ov=[`team`,`member`],kv=Object.freeze({capabilities:[],handlers:[],roles:[]});function Av(e,t){if(t===void 0)return!0;let n=e?.methods[t.method];return n?.effect===`write`&&Object.values(e?.methods??{}).every(e=>e.effect!==`write`||e.requires.every(e=>n.requires.includes(e)))}var jv=Ht(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);Ke.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>bt(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ze(e,t,n),e.parseAsync=async(t,n)=>dt(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ye(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>It(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),Mv=Ht(`ZodMiniString`,(e,t)=>{ze.init(e,t),jv.init(e,t)});function Nv(e){return ge(Mv,e)}var Pv=Ht(`ZodMiniNever`,(e,t)=>{kt.init(e,t),jv.init(e,t)});function Fv(e){return re(Pv,e)}var Iv=Ht(`ZodMiniObject`,(e,t)=>{ct.init(e,t),jv.init(e,t),qt(e,`shape`,()=>t.shape)});function Lv(e,t){return new Iv({type:`object`,shape:e??{},...Ne(t)})}function Rv(e,t){return new Iv({type:`object`,shape:e,catchall:Fv(),...Ne(t)})}var zv=Ht(`ZodMiniDiscriminatedUnion`,(e,t)=>{Tt.init(e,t),jv.init(e,t)});function Bv(e,t,n){return new zv({type:`union`,options:t,discriminator:e,...Ne(n)})}var Vv=Ht(`ZodMiniEnum`,(e,t)=>{$e.init(e,t),jv.init(e,t),e.options=Object.values(t.entries)});function Hv(e,t){return new Vv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Ne(t)})}var Uv=Ht(`ZodMiniLiteral`,(e,t)=>{gt.init(e,t),jv.init(e,t)});function Wv(e,t){return new Uv({type:`literal`,values:Array.isArray(e)?e:[e],...Ne(t)})}var Gv=Ht(`ZodMiniOptional`,(e,t)=>{Pt.init(e,t),jv.init(e,t)});function Kv(e){return new Gv({type:`optional`,innerType:e})}var qv=Ht(`ZodMiniNullable`,(e,t)=>{Ie.init(e,t),jv.init(e,t)});function Jv(e){return new qv({type:`nullable`,innerType:e})}var Yv=Ht(`ZodMiniLazy`,(e,t)=>{ke.init(e,t),jv.init(e,t)});function Xv(e){return new Yv({type:`lazy`,getter:e})}var Zv=Ht(`ZodMiniCustom`,(e,t)=>{pt.init(e,t),jv.init(e,t)});function Qv(e,t={}){return g(Zv,e,t)}var $v=Object.freeze({intrinsic:[`constructor`,`toString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`],rpc:[`then`,`dup`,`connect`,`id`,`name`],instance:[`ctx`,`env`],lifecycle:[`gill`,`onGitPush`,`syncRefused`,`authorizeGitPush`,`fetch`,`alarm`,`queue`,`scheduled`,`tail`,`trace`,`email`,`test`,`tailStream`,`webSocketMessage`,`webSocketClose`,`webSocketError`]}),ey=Nv().check(P(1),nt(256)),ty=Lv({kind:Wv(`member`),memberId:ey}),ny=Lv({kind:Wv(`agent`),agentId:ey}),ry=Lv({kind:Wv(`team-key`),keyId:ey}),iy=Bv(`kind`,[ty,ny,ry]),ay=Lv({workflowId:ey,runId:ey,nodeId:ey,armedBy:iy}),oy=Xv(()=>Rv({method:Nv().check(Qv(e=>cy(e))),seal:Nv().check(T(/^[A-Za-z0-9_-]{43}$/u))})),sy=Lv({computerId:Jv(ey),actor:iy,backgroundLane:Kv(Nv().check(P(8),nt(263))),backgroundOrigin:Kv(oy),role:Kv(Hv([`owner`,`member`])),soleMember:Kv(Wv(!0)),workflow:Kv(ay),idempotencyKey:Kv(Nv().check(P(1),nt(128)))});ty.shape,ny.shape,ry.shape,{...sy.shape},{...ay.shape};var cy=e=>e.length<=80&&/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(e)&&!Object.values($v).flat().some(t=>t===e),ly=V.check(Gn(cy));function uy(e,t=0){return t>16?!1:Dr(H(On))(e)?e.every(e=>uy(e,t+1)):!Dr(Cr)(e)||Object.values(e).every(e=>uy(e,t+1))}var dy=Cr.pipe(G(Gn(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=2e4&&uy(e),{message:`App API schema exceeds its byte or depth bound`}))),fy=V.check(Rn(1),K(128)),py=U({description:V.pipe(G(Rn(1)),G(K(1e3))),input:dy,output:dy,pending:W(B(!0)),hidden:W(B(!0)),anonymous:W(B(!0)),present:W(U({verb:V.check(Rn(1),K(32))})),effect:Sr([`read`,`write`,`external`]),requires:H(Sr(Ev)).pipe(G(Gn(e=>new Set(e).size===e.length)))}).check(Gn(e=>e.anonymous!==!0||e.effect===`read`&&e.requires.length===0,{message:`Anonymous methods must be reads with no required capabilities`})),my=U({methods:ai(V,py).pipe(G(Gn(e=>Object.keys(e).every(Dr(ly)),{message:`Invalid App API method name`})),G(Gn(e=>Object.keys(e).length<=64)),G(Gn(e=>{let t=Object.keys(e);return t.every(e=>!t.some(t=>t.startsWith(`${e}.`)))},{message:`App API method name is also a method group`}))),toolFamily:An(U({name:ly.check(Gn(e=>!e.includes(`.`))),list:ly,call:ly})),events:An(ai(V,U({description:V.check(Rn(1),K(1e3)),payload:dy})).check(Gn(e=>Object.keys(e).every(Dr(fy)),{message:`Invalid App API event name`}),Gn(e=>Object.keys(e).length<=64)))}).pipe(G(Gn(e=>{if(e.toolFamily===void 0)return!0;let{name:t,list:n,call:r}=e.toolFamily,i=e.methods[n],a=e.methods[r];return i?.effect===`read`&&a!==void 0&&a.effect!==`external`&&a.hidden!==!0&&!Object.keys(e.methods).some(e=>e.split(`.`)[0]===t)},{message:`Tool family must reference declared callable methods in a distinct namespace`})),G(Gn(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=256e3,{message:`App API exceeds its total byte bound`}))),hy=e=>new Set(e).size===e.length;function gy(e,t){let n=Object.keys(t);for(let e of n)Pr(ly)(e);return{declaration:U({name:B(e),operations:H(Sr(n)).pipe(G(Rn(1)),G(K(n.length)),G(Gn(hy)))}),shard:U({name:B(e),operations:H(xn(Object.entries(t).map(([e,t])=>U({name:B(e),cap:B(t.cap)})))).pipe(G(Rn(1)),G(K(n.length)),G(Gn(e=>hy(e.map(e=>e.name)),{message:`App backend operation repeated`})))})}}var _y=Object.values(wv).map(e=>gy(e.name,e.operations)),vy=_y.length,yy=H(xn(_y.map(e=>e.declaration))).pipe(G(K(vy)),G(Gn(e=>hy(e.map(e=>e.name)))));H(xn(_y.map(e=>e.shard))).pipe(G(K(vy)),G(Gn(e=>hy(e.map(e=>e.name)))));var by=new Map(Object.entries(wv).map(([e,t])=>[e,new Map(Object.entries(t.operations))]));function xy(e,t){return by.get(e)?.get(t)}var Sy=Sr(Tv),Cy=Sr(Ev),wy=Sr(Dv),Ty={message:`App declaration entries must be unique`},Ey=e=>new Set(e).size===e.length,Dy=new Set([`super+k`,`meta+k`,`cmd+k`,`mod+k`,`ctrl+k`,`control+k`]),Oy=V.pipe(G(K(256)),G(Gn(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),ky={order:W(cn)},Ay=U(ky),jy=U({id:Oy.pipe(G(Gn(e=>!e.includes(`:`),{message:`Declared command IDs are namespace-local`}))),title:Oy,category:Oy,description:W(V.pipe(G(K(1024)))),sigil:W(Oy.pipe(G(K(64)))),projections:W(U({bindings:W(U({...ky,values:H(Oy).pipe(G(K(16)),G(Gn(e=>!e.some(e=>Dy.has(e.trim().toLowerCase())),{message:`Apps cannot bind the reserved leader chord`})))})),agent:W(U({...ky,keybind:W(V)})),help:W(Ay),menu:W(Ay),palette:W(Ay),slash:W(U({...ky,aliases:H(Oy).pipe(G(K(16)))}))}))}),My=e=>Ey(e.map(e=>e.id))&&Ey(e.flatMap(e=>e.projections?.slash?.aliases??[])),Ny=e=>Ey(e.map(e=>e.id)),Py=V.check(zr(/^[a-z][a-z0-9.-]{0,63}$/)),Fy=U({key:Py,scopes:H(Sr(Ov)).check(Rn(1),Gn(Ey,Ty)),maxBytes:cn.check(gr({minimum:1,maximum:65536}))}),Iy=Qt()([Fy],([e])=>(t,n,r)=>Wr(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new or(Fy.ast,nn())}),Ly=U({appId:V.check(Rn(1),K(128)),methods:H(ly).check(Rn(1),K(16),Gn(Ey,Ty))}),Ry=Qt()([Ly],([e])=>(t,n,r)=>Wr(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new or(Ly.ast,nn())}),zy=H(Ry).check(Rn(1),K(16),Gn(e=>Ey(e.map(e=>e.appId)),Ty)),By=U({api:An(my),displayName:W(V.pipe(G(Rn(1)),G(K(64)))),capabilities:H(Cy).pipe(G(Gn(Ey,Ty))),calls:An(zy),guidance:W(V.pipe(G(Rn(1)),G(K(12e3)))),handlers:H(wy).pipe(G(Gn(Ey,Ty))),receives:An(H(B(`git.push`)).check(K(1),Gn(Ey,Ty))),icon:An(V.pipe(G(Rn(1)),G(K(80)))),roles:H(Sy).pipe(G(Gn(Ey,Ty))),storage:An(H(Iy).check(K(16),Gn(e=>Ey(e.map(e=>e.key)),Ty))),commands:W(H(jy).pipe(G(K(64)),G(Gn(My,{message:`Declared command IDs and slash aliases must be unique`})))),gills:W(H(yv).pipe(G(K(16)),G(Gn(Ny,{message:`Declared Gill IDs must be unique`})))),backend:W(U({bindings:yy,sync:An(U({method:ly}))}))}).pipe(G(Gn(e=>e.calls===void 0||e.capabilities.includes(`apps.call`),{message:`App calls require apps.call`})),G(Gn(e=>e.backend?.bindings.every(e=>e.name!==`BACKGROUND`)??!0,{message:`BACKGROUND is host-minted and cannot be declared by an App`})),G(Gn(e=>Av(e.api,e.backend?.sync),{message:`Background continuation must be a declared write covering all write requirements`})),G(Gn(e=>!(e.receives?.includes(`git.push`)??!1)||e.capabilities.includes(`git.repository`),{message:`Git push reception requires git.repository`})),G(Gn(e=>e.backend?.bindings.every(t=>t.operations.every(n=>xy(t.name,n)?.requires.every(t=>e.capabilities.includes(t))===!0))??!0,{message:`Backend bindings require declared App capabilities`})),G(Gn(e=>!e.backend?.bindings.some(e=>e.name===`APP_STORAGE`)||(e.storage?.length??0)>0,{message:`App storage bindings require declared keys`})),G(Gn(e=>Object.values(e.api?.methods??{}).every(t=>t.requires.every(t=>e.capabilities.includes(t))),{message:`App API requires capabilities outside the App declaration`})));function Vy(e){return/^app_[a-z0-9]{1,63}$/u.test(e)}function Hy(e){return/^rel_[a-z0-9]{1,63}$/u.test(e)}function Uy(e){return/^ps_[a-z0-9]{1,63}$/u.test(e)}function Wy(e){return/^artifact:[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9])?$/u.test(e)}function Gy(e){return/^idem_[a-z0-9](?:[a-z0-9_-]{0,126}[a-z0-9])?$/u.test(e)}function Ky(e){return/^git:[0-9a-f]{40}$/u.test(e)}function qy(e){return/^sha256:[0-9a-f]{64}$/u.test(e)}function Jy(e){return/^\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(e)}var Yy=ri({family:`app-release`,version:1,kinds:{transition:{prefix:`app_transition`},surface:{prefix:`ps`},erasure:{prefix:`app_erasure`}}}),Xy=Yy.transition;Yy.surface,Yy.erasure;var Zy=V.pipe(Zt(Vy)),Qy=V.pipe(Zt(Hy)),$y=V.pipe(Zt(Uy)),eb=V.pipe(Zt(Wy)),tb=V.pipe(Zt(Gy)),nb=V.pipe(Zt(Ky)),rb=V.pipe(Zt(qy)),ib=V.pipe(Zt(Jy)),ab=U({byteLength:Pn,copy:Lr(Function)}).pipe(Zt(e=>e.byteLength>=0)),ob=U({appId:Zy}),sb=U({sourceRevision:nb,sourceTreeDigest:rb,buildRecipeDigest:rb}),cb=U({artifactRef:eb,artifactDigest:rb,provenance:sb}),lb=U({releaseId:Qy,appId:Zy,artifact:cb}),ub=U({publicSurfaceId:$y,appId:Zy,stableRoute:ib}),db=V.pipe(G(Rn(1)),G(K(256))),fb=U({...ub.fields,publisher:U({kind:Sr([`customer`,`platform`]),teamId:db,userId:db,requestKey:db})}),pb=Sr([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`,`application/vnd.fungi.app+json`]),mb=U({artifactRef:eb,digest:rb,mediaType:Sr([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`]),version:V.pipe(G(Rn(1))),byteLength:Pn.pipe(G(xr()),G(Qr(0)),G(Gn(Number.isSafeInteger)))}),hb=U({runtime:U({kind:B(`durable-facet`),stateSchema:Pn.pipe(G(xr()),G(Qr(0)))}),compatibilityDate:V.pipe(G(zr(/^\d{4}-\d{2}-\d{2}$/))),exportName:V.pipe(G(Rn(1)))}),gb=U({format:B(`fungi-app-v1`),ui:wn(mb),backend:wn(U({artifact:mb,profile:hb})),declaration:By.pipe(Nr(Be(kv)))}),_b=U({kind:B(`verified`),digest:rb,mediaType:pb,bytes:ab,byteLength:Pn}),vb=xn([_b,U({kind:B(`unavailable`)}),U({kind:B(`missing`)}),U({kind:B(`digest-mismatch`),actualDigest:rb})]),yb=xn([U({kind:B(`found`),app:ob}),U({kind:B(`absent`)})]),bb=xn([U({kind:B(`created`),app:ob}),U({kind:B(`existing`),app:ob})]),xb=xn([U({kind:B(`found`),release:lb}),U({kind:B(`absent`)})]),Sb=xn([U({kind:B(`created`),release:lb}),U({kind:B(`existing`),release:lb})]),Cb=xn([U({kind:B(`found`),surface:ub}),U({kind:B(`absent`)})]),wb=xn([U({kind:B(`created`),surface:ub}),U({kind:B(`existing`),surface:ub}),U({kind:B(`conflict`)})]),Tb=xn([U({kind:B(`verified`),digest:rb,mediaType:B(`application/vnd.fungi.app+json`),description:gb}),U({kind:B(`unverified`)})]),Eb=xn([U({kind:B(`active`)}),U({kind:B(`revoked`)})]),Db=xn([U({kind:B(`promotion`),publicSurfaceId:$y,releaseId:Qy,idempotencyKey:tb}),U({kind:B(`rollback`),publicSurfaceId:$y,releaseId:Qy,idempotencyKey:tb}),U({kind:B(`revocation`),releaseId:Qy,idempotencyKey:tb})]),Ob=Mn(e=>Xy.schema.safeParse(e).success),kb=U({transition:Db,transitionId:Ob}),Ab=xn([U({kind:B(`none`)}),U({kind:B(`selected`),releaseId:Qy})]),jb=xn([U({kind:B(`found`),release:lb,verification:Tb,revocation:Eb}),U({kind:B(`absent`)})]);xn([U({kind:B(`found`),surface:ub,selection:Ab}),U({kind:B(`absent`)})]);var Mb=xn([U({kind:B(`absent`)}),U({kind:B(`found`),receipt:kb}),U({kind:B(`conflict`)})]),Nb=xn([U({kind:B(`created`),receipt:kb}),U({kind:B(`existing`),receipt:kb}),U({kind:B(`conflict`)}),U({kind:B(`identity-collision`)}),U({kind:B(`lifecycle-conflict`)})]),Pb=U({kind:B(`recorded`)}),Fb=U({kind:B(`unavailable`)});function Ib(e){return xn([U({kind:B(`success`),value:e}),U({kind:B(`failure`),failure:Fb})])}var Lb=Ib(yb),Rb=Ib(bb),zb=Ib(xb),Bb=Ib(Sb),Vb=Ib(Cb),Hb=Ib(wb),Ub=Ib(jb),Wb=Ib(Pb),Gb=Ib(Mb),Kb=Ib(Nb);tr(Zy,{onExcessProperty:`error`}),tr(Qy,{onExcessProperty:`error`}),tr($y,{onExcessProperty:`error`}),tr(eb,{onExcessProperty:`error`}),tr(tb,{onExcessProperty:`error`}),tr(nb,{onExcessProperty:`error`}),tr(rb,{onExcessProperty:`error`}),tr(ib,{onExcessProperty:`error`}),tr(Ob,{onExcessProperty:`error`}),Ar(vb,{onExcessProperty:`error`}),tr(ob,{onExcessProperty:`error`}),tr(lb,{onExcessProperty:`error`}),tr(ub,{onExcessProperty:`error`}),tr(fb,{onExcessProperty:`error`}),tr(Lb,{onExcessProperty:`error`}),tr(Rb,{onExcessProperty:`error`}),tr(zb,{onExcessProperty:`error`}),tr(Bb,{onExcessProperty:`error`}),tr(Vb,{onExcessProperty:`error`}),tr(Hb,{onExcessProperty:`error`}),tr(Db,{onExcessProperty:`error`}),tr(Ub,{onExcessProperty:`error`}),tr(Wb,{onExcessProperty:`error`}),tr(Gb,{onExcessProperty:`error`}),tr(Kb,{onExcessProperty:`error`});var qb=V.pipe(G(Rn(1)),G(K(256))),Jb=V.pipe(G(zr(/\S/u)),G(K(1e3)));U({dispositionId:qb,requestId:qb,operatorId:qb,reason:Jb,action:xn([U({kind:B(`retain-detached`)}),U({kind:B(`revoke-with-notice`)})])});var Yb=U({dispositionId:qb,appId:Zy,displayName:V.pipe(G(Rn(1)),G(K(64))),releaseIds:H(Qy).pipe(G(Rn(1)),G(K(1e4))),reason:Jb}),Xb=U({disposition_id:qb,app_id:Zy,release_ids_json:V,artifact_roots_json:V,created_at:Pn,state:Sr([`pending`,`retaining`,`retained`,`revoking`,`revoked`]),request_id:wn(qb),reason:wn(Jb),completed_at:wn(Pn)});U({...Xb.fields,releaseIds:H(Qy).pipe(G(K(1e4)))}),dr(H(Qy).pipe(G(K(1e4)))),dr(H(eb).pipe(G(K(1e4)))),[`CREATE TABLE app_release_artifact_dispositions(disposition_id TEXT PRIMARY KEY, app_id TEXT NOT NULL UNIQUE REFERENCES app_release_apps(app_id),
17
+ release_ids_json TEXT NOT NULL CHECK(json_valid(release_ids_json)), artifact_roots_json TEXT NOT NULL CHECK(json_valid(artifact_roots_json)),
18
+ created_at INTEGER NOT NULL,state TEXT NOT NULL CHECK(state IN ('pending','retaining','retained','revoking','revoked')),
19
+ request_id TEXT,reason TEXT,completed_at INTEGER,
20
+ CHECK((state='pending' AND request_id IS NULL AND reason IS NULL) OR (state<>'pending' AND request_id IS NOT NULL AND length(request_id) BETWEEN 1 AND 256 AND reason IS NOT NULL AND length(trim(reason)) BETWEEN 1 AND 1000)),
21
+ CHECK((state IN ('retained','revoked'))=(completed_at IS NOT NULL))) STRICT;`,`CREATE TABLE app_release_artifact_notice_recipients(recipient_id INTEGER PRIMARY KEY,disposition_id TEXT NOT NULL REFERENCES app_release_artifact_dispositions(disposition_id),
22
+ buyer_team_id TEXT CHECK(buyer_team_id IS NULL OR length(buyer_team_id) BETWEEN 1 AND 256),receipt TEXT CHECK(receipt IS NULL OR length(receipt) BETWEEN 1 AND 256),
23
+ erased_by TEXT,erased_at INTEGER,
24
+ CHECK((erased_by IS NULL)=(erased_at IS NULL)),
25
+ CHECK(erased_by IS NULL OR length(erased_by) BETWEEN 1 AND 256),
26
+ CHECK(receipt IS NULL OR erased_at IS NULL),
27
+ CHECK(buyer_team_id IS NOT NULL OR erased_at IS NOT NULL),
28
+ UNIQUE(disposition_id,buyer_team_id)) STRICT;`,`CREATE INDEX app_release_artifact_dispositions_pending ON app_release_artifact_dispositions(state,disposition_id);`,`CREATE TABLE app_release_artifact_disposition_steps(step_id INTEGER PRIMARY KEY,disposition_id TEXT NOT NULL REFERENCES app_release_artifact_dispositions(disposition_id),
29
+ phase TEXT NOT NULL CHECK(phase IN ('prepared','completed')),operator_id TEXT NOT NULL,recorded_at INTEGER NOT NULL) STRICT;`,`CREATE INDEX app_release_artifact_disposition_steps_by_action ON app_release_artifact_disposition_steps(disposition_id,phase);`].map(e=>e.replaceAll(`
30
+ `,` `)).join(`
31
+ `);var Zb=Pn.pipe(G(xr()),G(sn(0))),Qb=U({items:H(nv),next:wn(V),cursor:Zb});yt({visited:Oe(!0)});var $b=Pr(Qb),ex=Pr(dr(U({kind:B(`rows`),from:Zb,to:Zb,items:H(rv),more:$r})));function tx(e){let t=new Map,n=0,r=!1,i,a=0,o=n=>{r||e.onChange({items:[...t.values()],status:n})},s=e=>{for(let n of e){let e=av(n);`deleted`in n?t.delete(e):t.set(e,n)}},c=()=>{i?.close();let t=++a,u=e.openEvents(`${e.baseUrl}/inbox/events?after=${String(n)}`);i=u;let d=!1;u.addEventListener(`error`,()=>{r||t!==a||(d=!0,Js(`inbox.observe`,Error(`Member inbox stream disconnected`)),o(`error`))}),u.addEventListener(`open`,()=>{r||t!==a||!d||l()}),u.addEventListener(`rows`,e=>{if(r||t!==a)return;let i;try{i=ex(e.data)}catch(e){Js(`inbox.decode-event`,e),o(`loading`),c();return}if(i.from!==n){o(`loading`),c();return}s(i.items),n=i.to,o(`live`)}),u.addEventListener(`reset`,()=>{r||t!==a||l()})},l=async()=>{let l=++a;i?.close(),i=void 0,o(`loading`);try{t.clear();let i=null,u=!0;for(let t=0;t<5;t+=1){let t=i===null?``:`?after=${encodeURIComponent(i)}`,o=await e.fetch(`${e.baseUrl}/inbox${t}`,{cache:`no-store`});if(!o.ok)throw Error(`Inbox unavailable`);let c=$b(await o.json());if(r||l!==a)return;if(u&&(n=c.cursor),u=!1,s(c.items),i=c.next,i===null)break}o(`live`),c()}catch(e){if(r||l!==a)return;Js(`inbox.refresh`,e),o(`error`)}};return l(),Object.freeze({refresh:()=>r?Promise.resolve():l(),visit:async(t,n)=>{let r=await e.fetch(`${e.baseUrl}/inbox/visits`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,sessionId:n})});if(!r.ok&&r.status!==404)throw Error(`Visit was not recorded`)},close:()=>{r=!0,a+=1,i?.close()}})}var nx=Pr(U({items:H(xn([U({...Yb.fields,reason:W(Yb.fields.reason),createdAt:Zb}),U({...sv.fields,createdAt:Zb})])).pipe(G(K(100))),next:wn(V.pipe(G(K(1024))))}),{onExcessProperty:`error`});async function rx(e,t=null){let n=new URL(`${e.baseUrl}/inbox/notices`);t!==null&&n.searchParams.set(`after`,t);let r=await e.fetch(n);if(!r.ok)throw Error(`Team notices unavailable`);return nx(await r.json())}function ix(e,t){return t.status===`live`?t:{...t,data:t.data??e.data}}function ax(e,t,n={}){return zs({queryKey:e,...n,retry:!1,staleTime:1/0,refetchOnMount:`always`,queryFn:Ts({initialValue:{status:`loading`},refetchMode:`append`,reducer:ix,streamFn:({signal:e})=>Tr(lr(n=>tt(function*(){let r={status:`loading`},i=()=>{mr(n)};if(yield*At(xt(()=>{e.addEventListener(`abort`,i,{once:!0})}),()=>xt(()=>{e.removeEventListener(`abort`,i)})),e.aborted){i();return}yield*At(Lt({try:()=>Promise.resolve(t(e=>{r=ix(r,e),Zr(n,r)},e)),catch:sx}),e=>xt(e))}).pipe(Le(e=>$n(n,e))),{bufferSize:1,strategy:`sliding`}))})})}async function ox(e,t,n){if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});let r=await E_(e.capabilities),i=()=>{r.close().catch(e=>{Js(`inbox.query-close`,e)})};if(n.aborted)return i(),()=>void 0;let a=tx({baseUrl:r.baseUrl,fetch:r.fetch,openEvents:e=>{let t=new J_(e,{fetch:(e,t)=>r.fetch(e,t)});return{addEventListener:(e,n)=>{t.addEventListener(e,t=>{e===`open`||e===`error`?n(new MessageEvent(e)):t instanceof MessageEvent&&n(new MessageEvent(e,{data:z().parse(t.data)}))})},close:()=>{t.close()}}},onChange:e=>{t(e.status===`live`?{status:`live`,data:e.items}:{status:e.status})}});return()=>{a.close(),i()}}function sx(e){return e instanceof Y?e:new Y(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var cx=new WeakMap,lx={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function ux(e){let t={};return e&&cx.set(t,e),t}function dx(){let e=new ws({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&cx.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function fx(e,t,n,r){let i=e?.context.get().computerId;return Bs({queryKey:n,meta:ux(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new Y(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw sx(e)}}})}function px(e){Kh(e?.context);let t=uo(),n=e?.context.get().computerId,r=(0,q.useMemo)(()=>lx.of(e,`member-inbox`),[e,n]),i=ax(r,(0,q.useCallback)((t,r)=>{if(e?.context.get().computerId!==n)throw new Y(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return ox(e,t,r)},[e,n]),{enabled:e!==null,meta:ux(e)}),a=(0,q.useCallback)(()=>{t.invalidateQueries({queryKey:r,exact:!0})},[t,r]),o=(0,q.useCallback)(async(t,n)=>{if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});let r=await E_(e.capabilities);try{let e=await r.fetch(`${r.baseUrl}/inbox/visits`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,sessionId:n})});if(!e.ok&&e.status!==404)throw new Y(`Visit was not recorded`,{code:`HOST_FAILURE`,retryable:!0})}finally{await r.close()}},[e]);return{items:i.data?.data??[],status:i.isError?`error`:i.data?.status??`loading`,error:i.error,refresh:a,visit:o}}var mx=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),hx=Object.freeze([`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`]);Object.freeze(`--stipe-font-synthesis.--stipe-surface-frame-width.--stipe-surface-frame-image.--stipe-surface-molding-contrast.--stipe-shadow-raised.--stipe-shadow-inset.--stipe-shadow-edge.--stipe-display-gasket-face.--stipe-display-texture-image.--stipe-display-text-shadow.--stipe-canvas.--stipe-surface.--stipe-surface-raised.--stipe-surface-selected.--stipe-fg-muted.--stipe-linework.--stipe-hairline.--stipe-figure-ink.--stipe-density-compact.--stipe-density-comfortable.--stipe-motion-spring.--stipe-motion-squish.--stipe-motion-fast.--stipe-motion-normal.--stipe-motion-slow.--stipe-motion-ease.--stipe-motion-ease-exit.--stipe-motion-bounce.--stipe-motion-spring-duration.--stipe-motion-stretch.--stipe-motion-distance.--stipe-motion-stagger.--stipe-motion-blur.--stipe-motion-shake.--stipe-motion-steps.--stipe-motion-fuse.--stipe-press-depth.--stipe-press-scale.--stipe-layer-desktop.--stipe-layer-windows.--stipe-layer-chrome.--stipe-layer-popover.--stipe-layer-dialog.--stipe-layer-toast.--stipe-layer-tooltip.--stipe-overlay-shadow-outset.--stipe-icon-size-sm.--stipe-icon-size-md.--stipe-icon-size-lg.--stipe-icon-stroke.--stipe-card-rim.--stipe-card-rim-edge.--stipe-card-face.--stipe-card-panel.--stipe-card-ink.--stipe-card-ink-muted.--stipe-card-accent.--stipe-card-shadow.--stipe-card-foil-highlight.--stipe-card-foil-warm.--stipe-card-foil-cool.--stipe-avatar-shadow.--stipe-art-coral.--stipe-art-blue.--stipe-art-mint.--stipe-art-grape.--stipe-art-yellow.--stipe-art-cream.--stipe-art-ink.--stipe-art-inkcap.--stipe-art-graphite.--stipe-sketch-ink`.split(`.`));function gx(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=gx(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function _x(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=gx(e))&&(r&&(r+=` `),r+=t);return r}var vx=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,yx=_x,bx=(e,t)=>n=>{if(t?.variants==null)return yx(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=vx(t)||vx(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return yx(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},xx=Object.defineProperty,Sx=((e,t)=>{let n={};for(var r in e)xx(n,r,{get:e[r],enumerable:!0});return t||xx(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>Ix,isAnyNonArbitrary:()=>Vx,isArbitraryFamilyName:()=>iS,isArbitraryImage:()=>oS,isArbitraryLength:()=>tS,isArbitraryNumber:()=>nS,isArbitraryPosition:()=>aS,isArbitraryShadow:()=>sS,isArbitrarySize:()=>$x,isArbitraryValue:()=>eS,isArbitraryVariable:()=>cS,isArbitraryVariableFamilyName:()=>uS,isArbitraryVariableImage:()=>pS,isArbitraryVariableLength:()=>lS,isArbitraryVariablePosition:()=>dS,isArbitraryVariableShadow:()=>mS,isArbitraryVariableSize:()=>fS,isArbitraryVariableWeight:()=>hS,isArbitraryWeight:()=>rS,isFraction:()=>jx,isInteger:()=>Nx,isNamedContainerQuery:()=>Hx,isNumber:()=>Mx,isPercent:()=>Px,isTshirtSize:()=>Fx}),Cx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Tx=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dx=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ox=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ax=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jx=e=>Tx.test(e),Mx=e=>!!e&&!Number.isNaN(Number(e)),Nx=e=>!!e&&Number.isInteger(Number(e)),Px=e=>e.endsWith(`%`)&&Mx(e.slice(0,-1)),Fx=e=>Ex.test(e),Ix=()=>!0,Lx=e=>Dx.test(e)&&!Ox.test(e),Rx=()=>!1,zx=e=>kx.test(e),Bx=e=>Ax.test(e),Vx=e=>!eS(e)&&!cS(e),Hx=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Ux=(e,t,n)=>{let r=Cx.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Wx=(e,t,n=!1)=>{let r=wx.exec(e);return r?r[1]?t(r[1]):n:!1},Gx=e=>e===`position`||e===`percentage`,Kx=e=>e===`image`||e===`url`,qx=e=>e===`length`||e===`size`||e===`bg-size`,Jx=e=>e===`length`,Yx=e=>e===`number`,Xx=e=>e===`family-name`,Zx=e=>e===`number`||e===`weight`,Qx=e=>e===`shadow`,$x=e=>Ux(e,qx,Rx),eS=e=>Cx.test(e),tS=e=>Ux(e,Jx,Lx),nS=e=>Ux(e,Yx,Mx),rS=e=>Ux(e,Zx,Ix),iS=e=>Ux(e,Xx,Rx),aS=e=>Ux(e,Gx,Rx),oS=e=>Ux(e,Kx,Bx),sS=e=>Ux(e,Qx,zx),cS=e=>wx.test(e),lS=e=>Wx(e,Jx),uS=e=>Wx(e,Xx),dS=e=>Wx(e,Gx),fS=e=>Wx(e,qx),pS=e=>Wx(e,Kx),mS=e=>Wx(e,Qx,!0),hS=e=>Wx(e,Zx,!0),gS=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},_S=e=>typeof e==`function`&&e.isThemeGetter===!0,vS=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),yS=(e,t)=>{let n=vS(e);t.prefix!==void 0&&(n.prefix=t.prefix);let r=(e,t)=>{if(t)for(let n in t)t[n]!==void 0&&(e[n]=t[n])},i=t.override;i&&(i.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...i.orderSensitiveModifiers]),r(n.theme,i.theme),r(n.classGroups,i.classGroups),r(n.conflictingClassGroups,i.conflictingClassGroups),r(n.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers));let a=(e,t)=>{if(t)for(let n in t){let r=t[n];r&&(e[n]=(e[n]??[]).concat(r))}},o=t.extend;return o&&(o.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...n.orderSensitiveModifiers,...o.orderSensitiveModifiers]),a(n.theme,o.theme),a(n.classGroups,o.classGroups),a(n.conflictingClassGroups,o.conflictingClassGroups),a(n.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers)),n},bS={isAny:0,isAnyNonArbitrary:1,isArbitraryValue:2,isArbitraryVariable:3,isFraction:4,isNumber:5,isInteger:6,isPercent:7,isTshirtSize:8,isNamedContainerQuery:9,isArbitraryLength:10,isArbitraryNumber:11,isArbitraryWeight:12,isArbitraryFamilyName:13,isArbitraryPosition:14,isArbitrarySize:15,isArbitraryImage:16,isArbitraryShadow:17,isArbitraryVariableLength:18,isArbitraryVariableFamilyName:19,isArbitraryVariablePosition:20,isArbitraryVariableSize:21,isArbitraryVariableImage:22,isArbitraryVariableShadow:23,isArbitraryVariableWeight:24},xS=25,SS=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),CS=(e,t,n)=>{let r=e.idByName.get(t);return r===void 0&&(r=e.names.length,e.names.push(t),e.idByName.set(t,r),e.classifierFns.set(t,n)),r},wS=(e,t)=>{if(typeof t==`function`){let n=e.fnName.get(t);return n===void 0&&(n=`$c`+e.fnName.size,e.fnName.set(t,n),e.impls[n]=t),CS(e,n,t)}let n=t.$v,r=Sx[n];if(bS[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return CS(e,n,r)},TS=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),ES=(e,t)=>e.theme[t]??[],DS=(e,t,n)=>{let r=TS(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=TS(),e.nextPart.set(n,t)),e=t}return e},a=(n,r,o)=>{if(typeof n==`string`){let e=n===``?r:i(r,n);e.classGroupId=o;return}if(typeof n==`function`){if(_S(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:wS(t,n),groupId:o});return}if(gS(n,`$t`)){for(let t of ES(e,n.$t))a(t,r,o);return}if(gS(n,`$v`)){(r.validators??=[]).push({validatorId:wS(t,n),groupId:o});return}for(let[e,t]of Object.entries(n)){let n=i(r,e);for(let e of t)a(e,n,o)}};for(let[t,i]of Object.entries(e.classGroups)){let e=n(t);for(let t of i)a(t,r,e)}return r},OS=e=>{let t=SS(),n=[],r=new Map,i=e=>{let t=r.get(e);return t===void 0&&(t=n.length,n.push(e),r.set(e,t)),t},a=DS(e,t,i),o=e=>{if(e.validators)return!1;for(let t of e.nextPart.values())if(!o(t))return!1;return!0},s=(e,t,n)=>{e.classGroupId>=0&&n.push({tail:t,gid:e.classGroupId});for(let[r,i]of e.nextPart)s(i,t+`-`+r,n)},c=e=>{for(let[t,n]of[...e.nextPart])o(n)?(s(n,t,e.lit),e.nextPart.delete(t)):c(n)};c(a);let l=[{edges:new Map,groupId:-1,vlist:-1}],u=()=>(l.push({edges:new Map,groupId:-1,vlist:-1}),l.length-1),d=[],f=new Map,p=e=>{let t=e.map(e=>e.validatorId+`:`+e.groupId).join(`,`),n=f.get(t);return n===void 0&&(n=d.length,d.push(e.map(e=>[e.validatorId,e.groupId])),f.set(t,n)),n},m=(e,t)=>{let n=e;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e),i=l[n].edges.get(r);i===void 0&&(i=u(),l[n].edges.set(r,i)),n=i}return n},h=[],g=(e,t,n)=>{e.classGroupId>=0&&(l[t].groupId=e.classGroupId),e.validators&&(l[t].vlist=p(e.validators));for(let{tail:n,gid:r}of e.lit)h.push({anchor:t,tail:n,gid:r});for(let[r,i]of e.nextPart){let e=t;if(!n){let n=l[t].edges.get(45);n===void 0&&(n=u(),l[t].edges.set(45,n)),e=n}let a=m(e,r);g(i,a,!1)}};g(a,0,!0);let _=new Set(h.map(e=>e.anchor)),v=e=>l[e].groupId>=0||l[e].vlist>=0||_.has(e),y=new Map,b=[],x=e=>{let t=b.length;y.set(e,t);let n={edges:[],groupId:l[e].groupId,vlist:l[e].vlist};b.push(n);let r=[...l[e].edges.entries()].sort((e,t)=>e[0]-t[0]);for(let[e,t]of r){let r=String.fromCharCode(e),i=t;for(;l[i].edges.size===1&&!v(i);){let[[e,t]]=l[i].edges.entries();r+=String.fromCharCode(e),i=t}n.edges.push({label:r,oldTarget:i})}for(let e of n.edges)x(e.oldTarget);return t};x(0);let S=b.length,C=0;for(let e of b)C+=e.edges.length;let w=new Int32Array(S),T=new Int32Array(C),E=``,D=new Int32Array(S),O=new Int32Array(S),k=[];{let e=0;for(let t=0;t<S;t++){let n=b[t];w[t]=n.edges.length;for(let t of n.edges)T[e]=t.label.length,E+=t.label,k.push(y.get(t.oldTarget)),e++;D[t]=n.groupId,O[t]=n.vlist}}{let e=new Int32Array(S);for(let t=S-1;t>=0;t--){let n=1,r=t+1;for(let i=0;i<w[t];i++)n+=e[r],r+=e[r];e[t]=n}let t=0;for(let n=0;n<S;n++){let r=n+1;for(let i=0;i<w[n];i++){if(r!==k[t])throw Error(`cn compiler: edge target mismatch at ${t}`);r+=e[r],t++}}}for(let e of h)e.anchor=y.get(e.anchor);{let e=new Int32Array(d.length).fill(-1),t=[];for(let n=0;n<S;n++){let r=O[n];r>=0&&(e[r]===-1&&(e[r]=t.length,t.push(d[r])),O[n]=e[r])}d.length=0,d.push(...t)}let A=0;for(let e of d)A+=e.length;let j=new Int32Array(A),M=new Int32Array(A);{let e=0;for(let t of d)for(let[n,r]of t)j[e]=n,M[e]=r,e++}h.sort((e,t)=>e.anchor-t.anchor||e.gid-t.gid||(e.tail<t.tail?-1:1));let N=[];for(let e of h){let t=N[N.length-1];t&&t.anchor===e.anchor&&t.gid===e.gid?t.tails.push(e.tail):N.push({anchor:e.anchor,gid:e.gid,tails:[e.tail],set:-1})}let P=new Map,ee=[];for(let e of N){let t=e.tails.join(` `),n=P.get(t);n===void 0&&(n=ee.length,P.set(t,n),ee.push(e.tails)),e.set=n}for(let e of ee.flat())if(e.includes(`|`)||e.includes(` `))throw Error(`cn compiler: tail contains delimiter: `+e);let te=new Set(ee.flat()).size;N.sort((e,t)=>e.anchor-t.anchor||e.set-t.set);for(let t of Object.values(e.conflictingClassGroups))for(let e of t)i(e);for(let t of Object.values(e.conflictingClassGroupModifiers))for(let e of t)i(e);for(let t of e.postfixLookupClassGroups??[])i(t);let F=n.length,ne=new Int32Array(F).fill(-1),re=0,ie=e=>(ne[e]===-1&&(ne[e]=re++),ne[e]);for(let e=0;e<M.length;e++)M[e]=ie(M[e]);for(let e of N)e.gid=ie(e.gid);for(let e=0;e<D.length;e++)D[e]>=0&&(D[e]=ie(D[e]));for(let e=0;e<F;e++)ne[e]===-1&&(ne[e]=re++);let ae=Array(F);for(let e=0;e<F;e++)ae[ne[e]]=n[e];let I=[],oe=[],se=[],L=[],ce=[];for(let t=0;t<F;t++){let n=ae[t],i=(e.conflictingClassGroups[n]??[]).map(e=>ne[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>ne[r.get(e)]);i.length&&(I.push(t),oe.push(i.length),se.push(...i));for(let e of a)L.push(t),ce.push(e)}let le=(e.postfixLookupClassGroups??[]).map(e=>ne[r.get(e)]),R=[],ue=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=bS[n];if(r!==void 0)ue[e]=r;else{let t=R.indexOf(n);t===-1&&(t=R.length,R.push(n)),ue[e]=xS+t}}let de=new Map,fe=[],pe=[],me=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(ue[e++]);let r=n.join(`,`),i=de.get(r);i===void 0&&(i=fe.length,de.set(r,i),fe.push(n.length),pe.push(...n)),me.push(i)}}let he={};for(let e of R)he[e]=t.classifierFns.get(e);return{G:F,customNames:R,impls:he,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:fe,patOps:pe,listPat:me,vlistGroup:M,litEntries:h,sets:ee,attachments:N,uniqueTailCount:te,adjGid:I,adjCnt:oe,adjTgt:se,patGid:L,patTgt:ce,postfixLookup:le,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},kS=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},AS=e=>{let t=OS(e),n=t.litEntries.length,r=new Int32Array(n),i=new Int32Array(n),a=new Int32Array(n),o=``,s=new Int32Array(t.uniqueTailCount*2);{let e=new Map,n=0,c=0;for(let l of t.attachments)for(let u of t.sets[l.set]){let t=e.get(u);t===void 0&&(t=n++,e.set(u,t),s[t*2]=o.length,s[t*2+1]=u.length,o+=u),r[c]=l.anchor,i[c]=l.gid,a[c]=t,c++}}return{tables:{GROUP_COUNT:t.G,edgeStart:kS(t.edgeCounts),labelStart:kS(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:kS(t.patCounts),vlistOps:Int32Array.from(t.patOps),vlistRef:Int32Array.from(t.listPat),vlistGroup:t.vlistGroup,litAnchor:r,litGroup:i,litPool:a,poolOffsets:s,poolText:o,adjGid:Int32Array.from(t.adjGid),adjStart:kS(t.adjCnt),adjTgt:Int32Array.from(t.adjTgt),patGid:Int32Array.from(t.patGid),patTgt:Int32Array.from(t.patTgt),postfixLookupGroups:Int32Array.from(t.postfixLookup),customValidatorNames:t.customNames,orderSensitiveModifiers:t.orderSensitiveModifiers},validatorImpls:t.impls,prefix:t.prefix}},jS=`line`in Error(),MS=-1,NS=-1,PS=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},FS=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},IS=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,ee=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(ee=!1)}let te=1;for(;te<m.length*2;)te<<=1;let F=new Int32Array(te).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(PS(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&te-1;for(;F[n]!==-1;)n=n+1&te-1;F[n]=e}let ne=(e,t,n,r)=>{let i=(PS(t,n,r)^Math.imul(e,2654435761)|0)&te-1,a=r-n;for(;;){let r=F[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&te-1}},re=n.cacheSize??8192,ie=n.prefix??e.prefix??``,ae=ie===``?``:ie+`:`,I=ae.length,oe=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),se=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,L=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ce=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,le=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,R=0,ue=-1,de=-1,fe=-1,pe=-1,me=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,he=e=>/\s/.test(String.fromCharCode(e)),ge=(e,t,n)=>{if(R=0,ue=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)R=1;else if(r===40&&i===41)R=2;else return;fe=t+1,pe=n-1;let a=t+1;if(me(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!me(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ue=t+1,de=a,fe=a+1)}},_e=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},ve=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ye=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,be=e=>!!e&&!Number.isNaN(Number(e)),xe=(e,t,n)=>{if(n-t<11||!_e(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&_e(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&_e(e,t+10,t+18,`-normal/`)},Se=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Ce=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),we=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Te=(e,t,n,r)=>{if(e>=10){if(e>=25)return oe[e-25](t.slice(n,r));let i=e-10;if(R!==Se[i])return!1;if(ue>=0){for(let e of Ce[i])if(_e(t,ue,de,e))return!0;return!1}switch(we[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(fe,pe);return se.test(e)&&!L.test(e)}case 3:return be(t.slice(fe,pe));case 4:return le.test(t.slice(fe,pe));default:return ce.test(t.slice(fe,pe))}}switch(e){case 0:return!0;case 1:return R===0;case 2:return R===1;case 3:return R===2;case 4:return ve.test(t.slice(n,r));case 5:return be(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&be(t.slice(n,r-1));case 8:return ye.test(t.slice(n,r));default:return xe(t,n,r)}},Ee=new Set(typeof E==`string`?E.split(` `):E),De=(e,t,n,r,i,a)=>{let o=PS(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},Oe=new Map,ke=new Map,Ae=2,je=4096,Me=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Ee.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=ke.get(s);return c===void 0&&ke.set(s,c=Ae++),c},Ne=new Map,Pe=r,Fe=r+4096,Ie=()=>Pe++,Le=2097152,Re=8192,ze=new Int32Array(Re),Be=Array(Re).fill(null),Ve=new Int32Array(Re),He=new Int32Array(Re),Ue=new Uint8Array(Re),We=0,Ge=(e,t,n,r,i,a,o,s)=>{let c=e;if(Be[e]!==null){if(Be[e|1]===null)c=e|1;else if(!(We++&3))c=e|We>>2&1;else return}Be[c]=t.slice(n,r),ze[c]=i,Ve[c]=a,He[c]=o,Ue[c]=s},Ke=()=>Be.fill(null),qe=256,Je=[new Int32Array(qe),new Int32Array(qe),new Int32Array(qe),new Int32Array(qe)],[Ye,Xe,Ze,Qe]=Je,$e=new Uint8Array(qe),et=new Uint8Array(qe),tt=()=>{qe*=2,Je=Je.map(e=>{let t=new Int32Array(qe);return t.set(e),t}),[Ye,Xe,Ze,Qe]=Je;let e=new Uint8Array(qe);e.set($e),$e=e,et=new Uint8Array(qe)},nt=64,rt=new Int32Array(nt),it=new Int32Array(nt),at=new Int32Array(r),ot=2048,st=21,ct=new Float64Array(ot),lt=new Int32Array(ot),z=0,ut=(e,t)=>{if(e===0&&t<r)return at[t]===z?1:(at[t]=z,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>st;for(;lt[i]===z;){if(ct[i]===n)return 1;i=i+1&ot-1}return ct[i]=n,lt[i]=z,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?MS:De(Ne,e,t+1,r,0,Ie)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=it[t];if(r>n)continue;let i=rt[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(ee===!1||t!==91&&t!==40){let t=ne(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;ge(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Te(d[t],e,r,n))return p[h+t]}return MS},ft=e=>{let t=e.length,n=0,c=0,u=!1;(Ae>je||Oe.size>je)&&(Oe=new Map,ke=new Map,Ae=2,Ke()),Pe>Fe&&(Ne=new Map,Pe=r,Ke());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&he(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&he(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===qe&&tt();let _=n++;Ye[_]=p,Xe[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(ze[y]===v&&Be[y]!==null&&Be[y].length===g?t=y:ze[y|1]===v&&Be[y|1]!==null&&Be[y|1].length===g&&(t=y|1),t>=0){let n=Be[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Ze[_]=Ve[t],Qe[_]=He[t],$e[_]=Ue[t];continue}}}let b=p;if(I!==0){if(h-p<=I||!e.startsWith(ae,p)){Ze[_]=MS,Ge(y,e,p,h,v,MS,0,0);continue}b=p+I}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,ee=0,te=0,F=-1,ne=0;(l[0]>=0||N[0]===1)&&(rt[0]=0,it[0]=M,ne=1);let re=NS,ie=0;for(let t=M;t<D;t++)if(t===A&&(re=ee<te?NS:P,ie=ne),P!==NS){let n=e.charCodeAt(t),r=-1;if(ee<te)o.charCodeAt(ee)===n?(ee++,ee===te&&(r=P=F)):P=NS;else{let e=i[P],t=i[P+1],c=NS;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(ee=e+1,te=a[i+1],F=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(ne===nt){nt*=2;let e=new Int32Array(nt);e.set(rt),rt=e;let t=new Int32Array(nt);t.set(it),it=t}rt[ne]=r,it[ne]=t+2,ne++}}A===D&&(re=ee<te?NS:P,ie=ne);let oe=ee<te?NS:P,se,L=!1;if(A>=0){if(L=!0,se=dt(e,E,A,re,ie),se!==MS&&se<r&&j[se]){let t=dt(e,E,D,oe,ne);t!==MS&&t!==se&&(se=t,L=!1)}else se===MS&&(se=dt(e,E,D,oe,ne),L=!1)}else se=dt(e,E,D,oe,ne);let ce=0,le=0;se===MS?Ze[_]=MS:(le=+!!L,ce=b>=C?+!!O:De(Oe,e,b,C,+!!O,e=>Me(e,O)),Ze[_]=se,$e[_]=le,Qe[_]=ce),Ge(y,e,p,h,v,se,ce,le)}if(n===0)return``;if(n===1)return Ye[0]===0&&Xe[0]===t?e:e.slice(Ye[0],Xe[0]);if(n*k>ot){for(;n*k>ot;)ot<<=1,st--;ct=new Float64Array(ot),lt=new Int32Array(ot)}if(Ae>=Le||Pe>=Le)throw Error(`cn: too many distinct classes in one merge`);z=z+1|0,z===0&&(at.fill(0),lt.fill(0),z=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Ze[e];if(t===MS){et[e]=1;continue}let n=Qe[e];if(ut(n,t)===1){et[e]=0,f=!0;continue}if(et[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if($e[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!et[m]){m++;continue}let t=Ye[m],r=Xe[m],i=m+1;for(;i<n&&et[i]&&Ye[i]===r+1&&e.charCodeAt(r)===32;)r=Xe[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=FS(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>re&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=FS(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>re&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=FS(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=re===0?ft:jS?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt(zS.apply(null,arguments))},mergeString:Dt,seenBefore:re===0?()=>!1:Et,mergeUncached:ft}},LS=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:LS(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},RS=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:LS(i,t);a&&(n&&(n+=` `),n+=a)}return n},zS=function(){return RS(arguments,!1)},BS=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=LS(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(LS(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},VS=`{"theme":{"animate":[{"$v":"isAny"}],"aspect":["video"],"blur":[{"$v":"isTshirtSize"}],"breakpoint":[{"$v":"isTshirtSize"}],"color":[{"$v":"isAny"}],"container":[{"$v":"isTshirtSize"}],"drop-shadow":[{"$v":"isTshirtSize"}],"ease":["in","out","in-out"],"font":[{"$v":"isAnyNonArbitrary"}],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[{"$v":"isTshirtSize"}],"leading":["none","tight","snug","normal","relaxed","loose"],"perspective":["dramatic","near","normal","midrange","distant","none"],"radius":[{"$v":"isTshirtSize"}],"shadow":[{"$v":"isTshirtSize"}],"spacing":["px",{"$v":"isNumber"}],"text":[{"$v":"isTshirtSize"}],"text-shadow":[{"$v":"isTshirtSize"}],"tracking":["tighter","tight","normal","wide","wider","widest"]},"classGroups":{"aspect":[{"aspect":["auto","square",{"$v":"isFraction"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"aspect"}]}],"container":["container"],"container-type":[{"@container":["","normal","size",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"container-named":[{"$v":"isNamedContainerQuery"}],"columns":[{"columns":[{"$v":"isNumber"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"container"}]},"columns-auto"],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],"box":[{"box":["border","content"]}],"display":["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],"sr":["sr-only","not-sr-only"],"float":[{"float":["right","left","none","start","end"]}],"clear":[{"clear":["left","right","both","none","start","end"]}],"isolation":["isolate","isolation-auto"],"object-fit":[{"object":["contain","cover","fill","none","scale-down"]}],"object-position":[{"object":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"overflow":[{"overflow":["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],"overscroll":[{"overscroll":["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],"position":["static","fixed","absolute","relative","sticky"],"inset":[{"inset":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-x":[{"inset-x":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-y":[{"inset-y":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"start":[{"inset-s":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"start":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"end":[{"inset-e":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"end":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-bs":[{"inset-bs":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-be":[{"inset-be":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"top":[{"top":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"right":[{"right":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"bottom":[{"bottom":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"left":[{"left":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"visibility":["visible","invisible","collapse"],"z":[{"z":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"basis":[{"basis":[{"$v":"isFraction"},"full","auto",{"$t":"container"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"flex-direction":[{"flex":["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{"flex":["nowrap","wrap","wrap-reverse"]}],"flex":[{"flex":[{"$v":"isNumber"},{"$v":"isFraction"},"auto","initial","none",{"$v":"isArbitraryValue"}]}],"grow":[{"grow":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shrink":[{"shrink":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"order":[{"order":[{"$v":"isInteger"},"first","last","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-cols":[{"grid-cols":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start-end":[{"col":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start":[{"col-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-end":[{"col-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-rows":[{"grid-rows":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start-end":[{"row":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start":[{"row-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-end":[{"row-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-cols":[{"$t":"spacing"}]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-rows":[{"$t":"spacing"}]}],"gap":[{"gap":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-x":[{"gap-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-y":[{"gap-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"justify-content":[{"justify":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{"content":["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{"items":["start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"align-self":[{"self":["auto","start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"p":[{"p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"px":[{"px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"py":[{"py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ps":[{"ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pe":[{"pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbs":[{"pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbe":[{"pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pt":[{"pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pr":[{"pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pb":[{"pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pl":[{"pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"m":[{"m":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mx":[{"mx":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"my":[{"my":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ms":[{"ms":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"me":[{"me":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbs":[{"mbs":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbe":[{"mbe":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mt":[{"mt":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mr":[{"mr":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mb":[{"mb":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ml":[{"ml":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x":[{"space-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-y-reverse":["space-y-reverse"],"size":[{"size":[{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inline-size":[{"inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"inline":[{"$t":"container"}]}],"min-inline-size":[{"min-inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"min-inline":[{"$t":"container"}]}],"max-inline-size":[{"max-inline":["none",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"max-inline":[{"$t":"container"}]}],"block-size":[{"block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-block-size":[{"min-block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-block-size":[{"max-block":["none",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"w":[{"w":[{"$t":"container"},"screen",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-w":[{"min-w":[{"$t":"container"},"screen","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-w":[{"max-w":[{"$t":"container"},"screen","none","prose",{"screen":[{"$t":"breakpoint"}]},{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"h":[{"h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-h":[{"min-h":["screen","lh","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-h":[{"max-h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},"max-h-none"],"font-size":[{"text":["base",{"$t":"text"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{"font":[{"$t":"font-weight"},{"$v":"isArbitraryVariableWeight"},{"$v":"isArbitraryWeight"}]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",{"$v":"isPercent"},{"$v":"isArbitraryValue"}]}],"font-family":[{"font":[{"$v":"isArbitraryVariableFamilyName"},{"$v":"isArbitraryFamilyName"},{"$t":"font"}]}],"font-features":[{"font-features":[{"$v":"isArbitraryValue"}]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],"tracking":[{"tracking":[{"$t":"tracking"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"line-clamp":[{"line-clamp":[{"$v":"isNumber"},"none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryNumber"}]}],"leading":[{"leading":[{"$t":"leading"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"list-image":[{"list-image":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"list-style-position":[{"list":["inside","outside"]}],"list-style-type":[{"list":["disc","decimal","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-alignment":[{"text":["left","center","right","justify","start","end"]}],"placeholder-color":[{"placeholder":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-color":[{"text":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{"decoration":["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{"decoration":[{"$v":"isNumber"},"from-font","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryLength"}]}],"text-decoration-color":[{"decoration":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"underline-offset":[{"underline-offset":[{"$v":"isNumber"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{"text":["wrap","nowrap","balance","pretty"]}],"indent":[{"indent":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"tab-size":[{"tab":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"vertical-align":[{"align":["baseline","top","middle","bottom","text-top","text-bottom","sub","super",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"whitespace":[{"whitespace":["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],"break":[{"break":["normal","words","all","keep"]}],"wrap":[{"wrap":["break-word","anywhere","normal"]}],"hyphens":[{"hyphens":["none","manual","auto"]}],"content":[{"content":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"bg-attachment":[{"bg":["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{"bg":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-repeat":[{"bg":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"bg-size":[{"bg":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-image":[{"bg":["none",{"linear":[{"to":["t","tr","r","br","b","bl","l","tl"]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"radial":["",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"conic":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isArbitraryVariableImage"},{"$v":"isArbitraryImage"}]},{"bg-gradient-to":["t","tr","r","br","b","bl","l","tl"]},"bg-conic"],"bg-color":[{"bg":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-from-pos":[{"from":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-via-pos":[{"via":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-to-pos":[{"to":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-from":[{"from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-via":[{"via":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-to":[{"to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded":[{"rounded":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-s":[{"rounded-s":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-e":[{"rounded-e":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-t":[{"rounded-t":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-r":[{"rounded-r":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-b":[{"rounded-b":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-l":[{"rounded-l":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ss":[{"rounded-ss":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-se":[{"rounded-se":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ee":[{"rounded-ee":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-es":[{"rounded-es":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tl":[{"rounded-tl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tr":[{"rounded-tr":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-br":[{"rounded-br":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-bl":[{"rounded-bl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-w":[{"border":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-x":[{"border-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-y":[{"border-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-s":[{"border-s":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-e":[{"border-e":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-bs":[{"border-bs":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-be":[{"border-be":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-t":[{"border-t":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-r":[{"border-r":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-b":[{"border-b":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-l":[{"border-l":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x":[{"divide-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{"border":["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{"divide":["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{"border":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-x":[{"border-x":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-y":[{"border-y":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-s":[{"border-s":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-e":[{"border-e":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-bs":[{"border-bs":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-be":[{"border-be":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-t":[{"border-t":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-r":[{"border-r":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-b":[{"border-b":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-l":[{"border-l":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"divide-color":[{"divide":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-style":[{"outline":["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-w":[{"outline":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"outline-color":[{"outline":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shadow":[{"shadow":["","none",{"$t":"shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]},"shadow-inner"],"shadow-color":[{"shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-shadow":[{"inset-shadow":["none",{"$t":"inset-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"inset-shadow-color":[{"inset-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-w":[{"ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"ring-w-inset":["ring-inset"],"ring-color":[{"ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-offset-w":[{"ring-offset":[{"$v":"isNumber"},{"$v":"isArbitraryLength"}]}],"ring-offset-color":[{"ring-offset":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-ring-w":[{"inset-ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"inset-ring-color":[{"inset-ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-shadow":[{"text-shadow":["none",{"$t":"text-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"text-shadow-color":[{"text-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"opacity":[{"opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{"mask":["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[{"$v":"isNumber"}]}],"mask-image-linear-from-pos":[{"mask-linear-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-to-pos":[{"mask-linear-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-from-color":[{"mask-linear-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-linear-to-color":[{"mask-linear-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-from-pos":[{"mask-t-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-to-pos":[{"mask-t-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-from-color":[{"mask-t-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-to-color":[{"mask-t-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-from-pos":[{"mask-r-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-to-pos":[{"mask-r-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-from-color":[{"mask-r-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-to-color":[{"mask-r-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-from-pos":[{"mask-b-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-to-pos":[{"mask-b-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-from-color":[{"mask-b-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-to-color":[{"mask-b-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-from-pos":[{"mask-l-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-to-pos":[{"mask-l-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-from-color":[{"mask-l-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-to-color":[{"mask-l-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-from-pos":[{"mask-x-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-to-pos":[{"mask-x-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-from-color":[{"mask-x-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-to-color":[{"mask-x-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-from-pos":[{"mask-y-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-to-pos":[{"mask-y-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-from-color":[{"mask-y-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-to-color":[{"mask-y-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial":[{"mask-radial":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-from-pos":[{"mask-radial-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-to-pos":[{"mask-radial-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-from-color":[{"mask-radial-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-to-color":[{"mask-radial-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{"closest":["side","corner"],"farthest":["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[{"$v":"isNumber"}]}],"mask-image-conic-from-pos":[{"mask-conic-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-to-pos":[{"mask-conic-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-from-color":[{"mask-conic-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-conic-to-color":[{"mask-conic-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-mode":[{"mask":["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{"mask":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-repeat":[{"mask":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"mask-size":[{"mask":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{"mask":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"filter":[{"filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"blur":[{"blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"brightness":[{"brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contrast":[{"contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"drop-shadow":[{"drop-shadow":["","none",{"$t":"drop-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"drop-shadow-color":[{"drop-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grayscale":[{"grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"hue-rotate":[{"hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"invert":[{"invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"saturate":[{"saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"sepia":[{"sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-filter":[{"backdrop-filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-blur":[{"backdrop-blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-brightness":[{"backdrop-brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-contrast":[{"backdrop-contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-grayscale":[{"backdrop-grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-invert":[{"backdrop-invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-opacity":[{"backdrop-opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-saturate":[{"backdrop-saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-sepia":[{"backdrop-sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-collapse":[{"border":["collapse","separate"]}],"border-spacing":[{"border-spacing":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-x":[{"border-spacing-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-y":[{"border-spacing-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"table-layout":[{"table":["auto","fixed"]}],"caption":[{"caption":["top","bottom"]}],"transition":[{"transition":["","all","colors","opacity","shadow","transform","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transition-behavior":[{"transition":["normal","discrete"]}],"duration":[{"duration":[{"$v":"isNumber"},"initial",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ease":[{"ease":["linear","initial",{"$t":"ease"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"delay":[{"delay":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"animate":[{"animate":["none",{"$t":"animate"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backface":[{"backface":["hidden","visible"]}],"perspective":[{"perspective":[{"$t":"perspective"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"perspective-origin":[{"perspective-origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate":[{"rotate":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-x":[{"rotate-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-y":[{"rotate-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-z":[{"rotate-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale":[{"scale":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-x":[{"scale-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-y":[{"scale-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-z":[{"scale-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-3d":["scale-3d"],"skew":[{"skew":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-x":[{"skew-x":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-y":[{"skew-y":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform":[{"transform":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},"","none","gpu","cpu"]}],"transform-origin":[{"origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform-style":[{"transform":["3d","flat"]}],"translate":[{"translate":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-x":[{"translate-x":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-y":[{"translate-y":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-z":[{"translate-z":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-none":["translate-none"],"zoom":[{"zoom":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"accent":[{"accent":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"appearance":[{"appearance":["none","auto"]}],"caret-color":[{"caret":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"color-scheme":[{"scheme":["normal","dark","light","light-dark","only-dark","only-light"]}],"cursor":[{"cursor":["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],"resize":[{"resize":["none","","y","x"]}],"scroll-behavior":[{"scroll":["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-track-color":[{"scrollbar-track":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{"scrollbar":["auto","thin","none"]}],"scroll-m":[{"scroll-m":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mx":[{"scroll-mx":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-my":[{"scroll-my":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ms":[{"scroll-ms":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-me":[{"scroll-me":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbs":[{"scroll-mbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbe":[{"scroll-mbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mt":[{"scroll-mt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mr":[{"scroll-mr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mb":[{"scroll-mb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ml":[{"scroll-ml":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-p":[{"scroll-p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-px":[{"scroll-px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-py":[{"scroll-py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ps":[{"scroll-ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pe":[{"scroll-pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbs":[{"scroll-pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbe":[{"scroll-pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pt":[{"scroll-pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pr":[{"scroll-pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pb":[{"scroll-pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pl":[{"scroll-pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"snap-align":[{"snap":["start","end","center","align-none"]}],"snap-stop":[{"snap":["normal","always"]}],"snap-type":[{"snap":["none","x","y","both"]}],"snap-strictness":[{"snap":["mandatory","proximity"]}],"touch":[{"touch":["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],"select":[{"select":["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"fill":[{"fill":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"stroke-w":[{"stroke":[{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"},{"$v":"isArbitraryNumber"}]}],"stroke":[{"stroke":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}],"contain":[{"contain":["none","content","strict",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contain-size":[{"contain":["size","inline-size"]}],"contain-layout":["contain-layout"],"contain-paint":["contain-paint"],"contain-style":["contain-style"]},"conflictingClassGroups":{"container-named":["container-type"],"overflow":["overflow-x","overflow-y"],"overscroll":["overscroll-x","overscroll-y"],"inset":["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],"flex":["basis","grow","shrink"],"gap":["gap-x","gap-y"],"p":["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],"px":["pr","pl"],"py":["pt","pb"],"m":["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],"mx":["mr","ml"],"my":["mt","mb"],"size":["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],"rounded":["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"translate":["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],"touch":["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"],"contain":["contain-size","contain-layout","contain-paint","contain-style"],"contain-size":["contain"],"contain-layout":["contain"],"contain-paint":["contain"],"contain-style":["contain"]},"conflictingClassGroupModifiers":{"font-size":["leading"]},"orderSensitiveModifiers":["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"],"postfixLookupClassGroups":["container-type"]}`,HS=()=>JSON.parse(VS),US=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,WS=e=>e===void 0?{config:HS()}:typeof e==`function`?{config:e(HS())}:US(e)?{config:e}:{config:yS(HS(),e),cacheSize:e.cacheSize},GS=e=>{let{config:t,cacheSize:n}=WS(e),{tables:r,validatorImpls:i,prefix:a}=AS(t);return IS(r,i,{cacheSize:n,prefix:a})},Q=(e=>{let t=null,n=()=>t??=GS(e);return BS(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...hx]}}});function KS(e,t){return typeof e==`function`?e(t):e}var qS={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},JS=(0,q.forwardRef)(function({action:e,children:t,className:n,description:r,title:i,tone:a=`neutral`,...o},s){return(0,X.jsxs)(`div`,{...o,className:Q(`alert caps-alert`,qS[a],n),"data-tone":a,role:o.role??`alert`,ref:s,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i?(0,X.jsx)(`h3`,{className:`font-semibold`,children:i}):null,r?(0,X.jsx)(`p`,{className:`text-sm`,children:r}):null,t]}),e?(0,X.jsx)(`div`,{className:`shrink-0`,children:e}):null]})}),YS=(0,q.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,X.jsx)(`ul`,{...n,className:Q(`list`,t===`compact`&&`list-sm`,e),ref:r})}),XS=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`li`,{...t,className:Q(`list-row`,e),ref:n})}),ZS=(0,q.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,X.jsxs)(r===3?`h3`:`h2`,{...i,className:Q(`caps-data-list-heading`,n),ref:a,children:[(0,X.jsx)(`span`,{children:t}),e===void 0?null:(0,X.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})}),QS=bx(`card caps-card`,{variants:{variant:{surface:`caps-card-surface`,outline:`caps-card-outline`,interactive:`caps-card-interactive`,game:`caps-card-game caps-card-interactive`,fit:`caps-card-fit`},density:{regular:``,compact:`caps-card-compact`}},defaultVariants:{variant:`surface`,density:`regular`}}),$S=(0,q.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,X.jsx)(`div`,{...a,className:Q(QS({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,q.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,X.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,X.jsx)($S,{...i,className:Q(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})});var eC=(0,q.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),tC=(0,q.forwardRef)(function({className:e,level:t=3,...n},r){return(0,X.jsx)(t===2?`h2`:`h3`,{...n,className:Q(`caps-card-title`,e),ref:r})});(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`p`,{...t,className:Q(`caps-card-description`,e),ref:n})});var nC=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`caps-card-content`,e),ref:n})}),rC=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`caps-card-footer`,e),ref:n})});function iC(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function aC(...e){return t=>{let n=!1,r=e.map(e=>{let r=iC(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():iC(e[t],null)}}}}function oC(...e){return q.useCallback(aC(...e),e)}function sC(e){let t=q.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];hC(r)&&typeof yC==`function`&&(r=yC(r._payload)),q.Children.forEach(r,e=>{if(pC(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;hC(n)&&typeof yC==`function`&&(n=yC(n._payload)),a=uC(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=q.cloneElement(a,void 0,s):!o&&q.Children.count(r)===1&&q.isValidElement(r)&&(a=r);let c=a?fC(a):void 0,l=oC(n,c);if(!a){if(r||r===0)throw Error(o?vC(e):_C(e));return r}let u=dC(i,a.props??{});return a.type!==q.Fragment&&(u.ref=n?l:c),q.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var cC=sC(`Slot`),lC=Symbol.for(`radix.slottable`),uC=(e,t)=>{if(`child`in e.props){let t=e.props.child;return q.isValidElement(t)?q.cloneElement(t,void 0,e.props.children(t.props.children)):null}return q.isValidElement(t)?t:null};function dC(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function fC(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pC(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===lC}var mC=Symbol.for(`react.lazy`);function hC(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===mC&&`_payload`in e&&gC(e._payload)}function gC(e){return typeof e==`object`&&!!e&&`then`in e}var _C=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,vC=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,yC=q.use,bC=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),xC=`(prefers-reduced-motion: reduce)`;function SC(e){let t=e.ownerDocument.defaultView;if(!t)return bC;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(xC).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,bC.squish),fast:o(`fast`,bC.fast),normal:o(`normal`,bC.normal),slow:o(`slow`,bC.slow),springDuration:o(`spring-duration`,bC.springDuration),bounce:Math.min(1,s(`bounce`,bC.bounce)),stretch:s(`stretch`,bC.stretch),distance:s(`distance`,bC.distance),stagger:a?0:i(`--stipe-motion-stagger`,bC.stagger),blur:s(`blur`,bC.blur),shake:s(`shake`,bC.shake),steps:Math.floor(s(`steps`,bC.steps)),fuse:r(`--stipe-motion-fuse`,bC.fuse),pressDepth:a?0:r(`--stipe-press-depth`,bC.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,bC.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||bC.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||bC.easeExit}}function CC(e){let[t,n]=(0,q.useState)(()=>({...bC,reduced:!0}));return(0,q.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=SC(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(i);for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]});let o=r.matchMedia?.(xC);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function wC(e,t){return e.reduced?0:Math.round(t*e.normal/bC.normal)}function TC(e,t){if(e.reduced)return 0;let n=t*e.bounce/bC.bounce;return Math.min(.9,Math.max(0,n))}function EC(e,t){return e.reduced?0:Math.round(t*e.springDuration/bC.springDuration)}function DC(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function OC(e){return`animate`in e}var kC=globalThis;function AC(){return kC.matchMedia?.(xC).matches??!1}function jC(e){let t=kC.matchMedia?.(xC);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function MC(){return!0}function NC(){return(0,q.useSyncExternalStore)(jC,AC,MC)}var PC=(0,q.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=Q(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,X.jsx)(cC,{...n,className:i,ref:r}):(0,X.jsx)(`span`,{...n,className:i,ref:r})}),FC=typeof window<`u`,IC=FC?window:null,LC=FC?document:null,RC={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},zC={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},BC={NONE:0,AUTO:1,FORCE:2},VC={replace:0,none:1,blend:2},HC=Symbol(),UC=Symbol(),WC=Symbol(),GC=Symbol(),KC=Symbol(),qC=1e-11,JC=0xe8d4a51000,YC=1e3,XC=[],ZC=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),QC=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],$C=QC.reduce((e,t)=>({...e,[t]:t+`(`}),{}),ew=()=>{},tw=e=>e,nw=/\)\s*[-.\d]/,rw=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,iw=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,aw=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,ow=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,sw=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,cw=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,lw=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,uw=/([a-z])([A-Z])/g,dw=/(\*=|\+=|-=)/,fw=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,pw={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:YC,delay:0,loopDelay:0,ease:`out(2)`,composition:VC.replace,modifier:tw,onBegin:ew,onBeforeUpdate:ew,onUpdate:ew,onLoop:ew,onPause:ew,onComplete:ew,onRender:ew},mw={current:null,root:LC},hw={defaults:pw,precision:4,timeScale:1,tickThreshold:200,editor:null},gw={version:`4.5.0`,engine:null};FC&&(IC.AnimeJS||=[],IC.AnimeJS.push(gw));var _w=e=>e.replace(uw,`$1-$2`).toLowerCase(),vw=(e,t)=>e.indexOf(t)===0,yw=Date.now,bw=Array.isArray,xw=e=>e&&e.constructor===Object,Sw=e=>typeof e==`number`&&!isNaN(e),Cw=e=>typeof e==`string`,ww=e=>typeof e==`function`,Tw=e=>e===void 0,Ew=e=>Tw(e)||e===null,Dw=e=>FC&&e instanceof SVGElement,Ow=e=>rw.test(e),kw=e=>vw(e,`rgb`),Aw=e=>vw(e,`hsl`),jw=e=>Ow(e)||(kw(e)||Aw(e))&&(e[e.length-1]===`)`||!nw.test(e)),Mw=e=>!hw.defaults.hasOwnProperty(e),Nw=[`opacity`,`rotate`,`overflow`,`color`],Pw=(e,t)=>{if(Nw.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},Fw=Math.pow,Iw=Math.sqrt,Lw=Math.sin,Rw=Math.cos,zw=Math.abs,Bw=Math.exp,Vw=Math.ceil,Hw=Math.floor,Uw=Math.asin,Ww=Math.PI,Gw=Math.round,Kw=(e,t,n)=>e<t?t:e>n?n:e,qw=(e,t)=>{if(t<0)return e;if(!t)return Gw(e);let n=10**t;return Gw(e*n)/n},Jw=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,Yw=e=>e===1/0?JC:e===-1/0?-JC:e,Xw=e=>e<=1e-11?qC:Yw(qw(e,11)),Zw=e=>bw(e)?[...e]:e,Qw=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=Tw(i)?t[r]:i}return n},$w=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},eT=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},tT=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},nT=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[GC],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!Tw(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:vw(t,`scale`)?`1`:vw(t,`rotate`)||vw(t,`skew`)?`0deg`:`0px`},rT=e=>{let t=``;for(let n=0,r=QC.length;n<r;n++){let r=QC[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${$C[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},iT=[];function aT(e,t){if(!e)return null;let n=iT.length;outer:for(let r=0;r<n;r++){let n=iT[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=iT[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var oT=e=>{let t=iw.exec(e)||aw.exec(e),n=Tw(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},sT=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},cT=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),lT=e=>{let t=ow.exec(e)||sw.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=Tw(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=qw(cT(t,e,n+1/3)*255,0),s=qw(cT(t,e,n)*255,0),c=qw(cT(t,e,n-1/3)*255,0)}return[o,s,c,a]},uT=e=>kw(e)?oT(e):Ow(e)?sT(e):Aw(e)?lT(e):[0,0,0,1],dT=(e,t)=>Tw(e)?t:e,fT=(e,t)=>{let n=e.match(fw),r=t[UC]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},pT=(e,t,n,r,i,a)=>{if(ww(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Cw(e)&&vw(e,`var(`)){if(!i)return fT(e,t);let n=()=>fT(e,t);return i.func=n,n()}return e},mT=(e,t)=>e[UC]?e[WC]&&Pw(e,t)?RC.ATTRIBUTE:QC.includes(t)||ZC.get(t)?RC.TRANSFORM:vw(t,`--`)?RC.CSS_VAR:t in e.style?RC.CSS:t in e?RC.OBJECT:RC.ATTRIBUTE:RC.OBJECT,hT=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[KC]||e).getPropertyValue(t);return i===`auto`?`0`:i},gT=(e,t,n,r)=>{let i=Tw(n)?mT(e,t):n,a=aT(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===RC.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===RC.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===RC.TRANSFORM?nT(e,t,r):i===RC.CSS_VAR?hT(e,t,r).trimStart():hT(e,t,r)},_T=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,vT=()=>({t:zC.NUMBER,n:0,u:null,o:null,d:null,s:null}),yT=(e,t)=>{if(t.t=zC.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&lw.exec(r);if(i)return t.t=zC.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(jw(r))return t.t=zC.COLOR,t.d=uT(r),t;{let e=r.match(cw);return t.t=zC.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(cw)||[],t}},bT=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=Zw(e._toNumbers),t.s=Zw(e._strings),t),xT=vT(),ST=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(qw(Jw(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},CT=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=Kw(g,-h,o),b=Kw(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=qC,T=i===BC.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=Kw(n,0,l),C&&e._currentIteration--,E=e._currentIteration%2,D=b-n*t||0}let k=f^(p&&E),A=e._ease,j=C?k?0:o:k?c-D:D;A&&(j=c*A(j/c)||0);let M=(a?a.backwards:v<g)?!k:!!k;if(e._currentTime=v,e._iterationTime=j,e.backwards=M,S&&!e.began?(e.began=!0,!n&&!(a&&(M||!a.began))&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),T||i===BC.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||j>=_&&y!==o||j<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=T||(M?x*-1:x)>=hw.tickThreshold,i=qw(e._offset+(a?a._offset:0)+h+j,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==VC.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&j<p._startTime))&&(!m||_||j>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=Kw(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===RC.OBJECT,g=f===zC.NUMBER,_=g&&m||n===0||n===1?-1:hw.precision,v,y;if(g)v=y=i(qw(Jw(o._fromNumber,o._toNumber,n),_));else if(f===zC.UNIT)y=i(qw(Jw(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===zC.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(Jw(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${qw(e[0],0)},${qw(e[1],0)},${qw(e[2],0)},${e[3]})`)}else f===zC.COMPLEX&&(v=ST(o,n,_));if(h&&(o._number=y),!r&&e!==VC.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===RC.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===RC.TRANSFORM?(s!==l&&(l=s,u=s[GC]),u[e]=v,d=1):p===RC.CSS?c[e]=v:p===RC.CSS_VAR&&c.setProperty(e,v)),S&&(O=1)}else o._value=v}else n&&m&&!_&&j<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=rT(u),d=0),o=o._next}!n&&O&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!M&&v>0&&!s||M&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!M):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&!(a&&(M||!a.began))&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,O},wT=(e,t,n,r,i)=>{let a=e._currentIteration;if(CT(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=yw(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;$w(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&CT(t,e,n,1,BC.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}$w(o,e=>{let t=qw((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=CT(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},TT={},ET=(e,t,n)=>{if(n===RC.TRANSFORM)return ZC.get(e)||e;if(n===RC.CSS||n===RC.ATTRIBUTE&&Dw(t)&&e in t.style){let t=TT[e];if(t)return t;{let t=e&&_w(e);return TT[e]=t,t}}return e},DT=(e,t=!1)=>{if(e._hasChildren)$w(e,e=>DT(e,t),!0);else{let n=e;n.pause(),$w(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Ew(o)||o===``;if(e._setter){if(!t&&!s){if(yT(o,xT),xT.d){let t=xT.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=xT.n;e._setter(e.target,e._number,e)}}else if(a===RC.OBJECT)!t&&!s&&(i[r]=o);else if(i[UC]){if(a===RC.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===RC.TRANSFORM){let n=i[GC];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=rT(n):t.removeProperty(`transform`))}else s?t.removeProperty(_w(r)):t[r]=o}}i[UC]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},OT=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=YC/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?qC:t,r=YC/n;n>pw.frameRate&&(pw.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?qC:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?BC.NONE:(this._lastTickTime=n>=t?e-n%t:e,BC.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},kT={animation:null,update:ew},AT=e=>{let t=kT.animation;return t||(t={duration:qC,computeDeltaTime:ew,_offset:0,_delay:0,_head:null,_tail:null},kT.animation=t,kT.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===zC.COMPLEX||e===zC.COLOR?Zw(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),CT(t,1,1,0,BC.FORCE)}),t},jT=FC?requestAnimationFrame:setImmediate,MT=FC?cancelAnimationFrame:clearImmediate,NT=class extends OT{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=pw,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=yw();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(eT(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):wT(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):BC.AUTO),r=i}kT.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(yw()),this.reqId=jT(FT)),this}pause(){if(this.reqId)return this.paused=!0,IT()}resume(){if(this.paused)return this.paused=!1,$w(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(hw.timeScale===1?1:YC)}set speed(e){let t=e*hw.timeScale;this._speed!==t&&(this._speed=t,$w(this,e=>e.speed=e._speed))}get timeUnit(){return hw.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(hw.timeScale!==r){hw.timeScale=r,hw.tickThreshold=200*r;let e=n?t:YC;this.defaults.duration*=e,this._speed*=e}}get precision(){return hw.precision}set precision(e){hw.precision=e}},PT=(()=>{let e=new NT(yw());return FC&&(gw.engine=e,LC.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(LC.hidden?e.pause():e.resume())})),e})(),FT=()=>{PT._head?(PT.reqId=jT(FT),PT.update()):PT.reqId=0},IT=()=>(MT(PT.reqId),PT.reqId=0,PT),LT={_rep:new WeakMap,_add:new Map},RT=(e,t,n=`_rep`)=>{let r=LT[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},zT=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,BT=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=qC,e._currentTime=qC},VT=(e,t)=>{let n=e._composition;if(n===VC.replace){let n=e._absoluteStartTime;tT(t,e,zT,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){BT(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)BT(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=qw(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&BT(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if($w(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;$w(e,e=>{e!==t&&$w(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===VC.blend){let t=RT(e.target,e.property,`_add`),n=AT(LT._add),r=t._head;r||(r={...e},r._composition=VC.replace,r._updateDuration=qC,r._startTime=0,r._numbers=Zw(e._fromNumbers),r._number=0,r._next=null,r._prev=null,tT(t,r),tT(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=Zw(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=Zw(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}tT(t,e,null,`_prevAdd`,`_nextAdd`)}return e},HT=e=>{let t=e._composition;if(t!==VC.none){let n=e.target,r=e.property,i=LT._rep.get(n)[r];if(eT(i,e,`_prevRep`,`_nextRep`),t===VC.blend){let t=LT._add,i=t.get(n);if(!i)return;let a=i[r],o=kT.animation;eT(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){eT(a,s,`_prevAdd`,`_nextAdd`),eT(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},UT=(e,t,n)=>{let r=!1;return $w(t,i=>{let a=i.target;if(e.includes(a)){let e=i.property,o=i._tweenType,s=ET(n,a,o);(!s||s&&s===e)&&(i.parent._tail===i&&i._tweenType===RC.TRANSFORM&&i._prev&&i._prev._tweenType===RC.TRANSFORM&&(i._prev._renderTransforms=1),eT(t,i),HT(i),r=!0)}},!0),r},WT=(e,t,n)=>{let r=t||PT,i;if(r._hasChildren){let t=0;$w(r,a=>{if(!a._hasChildren){if(i=UT(e,a,n),i&&!a._head)a.cancel(),eT(r,a);else{let e=a._offset+a._delay+a.duration;e>t&&(t=e)}}a._head?WT(e,a,n):a._hasChildren=!1},!0),Tw(r.iterationDuration)||(r.iterationDuration=t)}else i=UT(e,r,n);i&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel())},GT=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),KT=e=>e._cancelled?(e._hasChildren?$w(e,KT):$w(e,e=>{e._composition!==VC.none&&VT(e,RT(e.target,e.property))}),e._cancelled=0,e):e,qT=0,JT=(e,t)=>e._priority>t._priority,YT=class extends OT{constructor(e={},t=null,n=0){super(0),++qT;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;mw.current&&mw.current.register(this);let b=t?0:PT._lastTickTime,x=t?t.defaults:hw.defaults,S=ww(i)||Tw(i)?x.delay:+i,C=ww(a)||Tw(a)?1/0:+a,w=dT(c,x.loop),T=dT(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(PT.reqId||PT.requestTick(yw()),D=(PT._lastTickTime-PT._startTime)*hw.timeScale),this.id=Tw(r)?qT:r,this.parent=t,this.duration=Yw((C+T)*E-T)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=E,this._autoplay=!t&&dT(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=ew,this._running=!1,this._reversed=+dT(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=dT(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=dT(d,x.frameRate),this._speed=dT(f,x.playbackRate),this._priority=+dT(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return Kw(qw(this._currentTime,hw.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return Kw(qw(this._iterationTime,hw.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return Kw(qw(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return Kw(qw(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*Kw(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return KT(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,wT(this,0,1,~~e,BC.FORCE),GT(this),this._hasChildren&&$w(this,GT),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&wT(this,this.duration,1,~~e,BC.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!Tw(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*PT._speed);return this._startTime=yw()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?wT(this,qC,0,0,BC.FORCE):(this._running||=(tT(PT,this,JT),PT._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,PT.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){KT(this),this.completed=!1;let r=this.paused;return this.paused=!0,wT(this,e+this._delay,~~t,~~n,BC.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?Hw(JC/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?$w(this,e=>e.cancel(),!0):$w(this,HT),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=Xw(e);if(t===n)return this;let r=e/t,i=e<=qC;return this.duration=i?qC:n,this.iterationDuration=i?qC:Xw(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){wT(this,0,1,0,BC.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=ew){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=ew};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}},XT=e=>new YT(e,null,0).init();function ZT(e){let t=Cw(e)?mw.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function QT(e){if(Ew(e))return[];if(!FC)return bw(e)&&e.flat(1/0)||[e];if(bw(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Ew(r)){let e=ZT(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Ew(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=ZT(e);return t?Array.from(t):[e]}function $T(e){let t=QT(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[HC]){n[HC]=!0;let e=Dw(n);(n.nodeType||e)&&(n[UC]=!0,n[WC]=e,n[GC]={})}}return t}var eE={deg:1,rad:180/Ww,turn:360},tE={},nE=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===zC.UNIT&&i===n)return t;let o=a+i+n,s=tE[o];if(!Tw(s)&&!r)t.n=s;else{let r;if(i in eE)r=a*eE[i]/eE[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==LC?o:LC.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,tE[o]=r}return t.t,zC.UNIT,t.u=n,t},rE=e=>e,iE=(e=1.68)=>t=>Fw(t,+e),aE={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},oE=Ww/2,sE=Ww*2,cE={"":iE,Quad:iE(2),Cubic:iE(3),Quart:iE(4),Quint:iE(5),Sine:e=>1-Rw(e*oE),Circ:e=>1-Iw(1-e*e),Expo:e=>e?Fw(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=Fw(2,--n))-1)/11;);return 1/Fw(4,3-n)-7.5625*Fw((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=Kw(+e,1,10),r=Kw(+t,qC,2),i=r/sE*Uw(1/n),a=sE/r;return e=>e===0||e===1?e:-n*Fw(2,-10*(1-e))*Lw((1-e-i)*a)}},lE=(()=>{let e={linear:rE,none:rE};for(let t in aE)for(let n in cE){let r=cE[n],i=aE[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),uE={linear:rE,none:rE},dE=e=>{if(uE[e])return uE[e];if(e.indexOf(`(`)<=-1){let t=aE[e]||e.includes(`Back`)||e.includes(`Elastic`)?lE[e]():lE[e];return t?uE[e]=t:rE}{let t=e.slice(0,-1).split(`(`),n=lE[t[0]];return n?uE[e]=n(...t[1].split(`,`)):rE}},fE=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],pE=e=>{if(Cw(e)){for(let t=0,n=fE.length;t<n;t++)if(vw(e,fE[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),rE}return ww(e)?e:Cw(e)?dE(e):rE},mE=vT(),hE=vT(),gE={},_E={func:null},vE={func:null},yE=[null],bE=[null,null],xE={to:null},SE=0,CE=0,wE,TE,EE=(e,t)=>{let n={};if(bw(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Mw);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Mw(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=dT(t.duration,hw.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Mw(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},DE=class extends YT{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++CE;let s=$T(e),c=s.length,l=t.keyframes,u=l?Qw(EE(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:hw.defaults,b=dT(m,y.ease),x=dT(h,y.playbackEase),S=x?pE(x):null,C=!Tw(b.ease),w=C?b.ease:dT(m,S?`linear`:y.ease),T=C?b.settlingDuration:dT(p,y.duration),E=dT(f,y.delay),D=g||y.modifier,O=Tw(_)&&c>=1e3?VC.none:Tw(_)?y.composition:_,k=this._offset+(n?n._offset:0);C&&(b.parent=this);let A=NaN,j=NaN,M=0,N=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Mw(e)){let a=mT(t,e),o=aT(t,e),s=ET(e,t,a),f=u[e],p=bw(f);if(i&&!p&&(bE[0]=f,bE[1]=f,f=bE),p){let e=f.length,t=!xw(f[0]);e===2&&t?(xE.to=f,yE[0]=xE,wE=yE):e>2&&t?(wE=[],f.forEach((e,t)=>{t?t===1?(bE[1]=e,wE.push(bE)):wE.push(e):bE[0]=e})):wE=f}else yE[0]=f,wE=yE;let m=null,h=null,g=NaN,_=0,v=0;for(let e=wE.length;v<e;v++){let i=wE[v];xw(i)?TE=i:(xE.to=i,TE=xE),_E.func=null,vE.func=null;let l=pT(dT(TE.composition,O),t,r,c,null,null),u=Sw(l)?l:VC[l];!m&&u!==VC.none&&(m=RT(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=pT(TE.to,t,r,c,_E,f),y;xw(p)&&!Tw(p.to)?(TE=p,y=p.to):y=p;let b=pT(TE.from,t,r,c,vE,f),x=TE.ease||w,S=pT(x,t,r,c,null,f),C=ww(S)||Cw(S)?S:x,A=!Tw(C)&&!Tw(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:pT(dT(TE.duration,e>1?pT(T,t,r,c,null,f)/e:T),t,r,c,null,f),ee=pT(dT(TE.delay,v?0:E),t,r,c,null,f),te=TE.modifier||D,F=!Tw(b),ne=!Tw(y),re=bw(y),ie=re||F&&ne,ae=h?_:0,I=h?_+ee:ee,oe=qw(k+I,12),se=qw(k+ae,12);!N&&(F||re)&&(N=1);let L=h;if(u!==VC.none){let e=m._head;for(;e&&e._absoluteStartTime<=oe;)if(e._isOverridden||(L=e),e=e._nextRep,e&&e._absoluteStartTime>=oe)for(;e;)BT(e),e=e._nextRep}if(ie){yT(re?pT(y[0],t,r,c,vE,f):b,mE),yT(re?pT(y[1],t,r,c,_E,f):y,hE);let e=gT(t,s,a,gE);mE.t===zC.NUMBER&&(L?L._valueType===zC.UNIT&&(mE.t=zC.UNIT,mE.u=L._unit):(yT(e,xT),xT.t===zC.UNIT&&(mE.t=zC.UNIT,mE.u=xT.u)))}else ne?yT(y,hE):h?bT(h,hE):yT(n&&L&&L.parent.parent===n?L._value:gT(t,s,a,gE),hE),F?yT(b,mE):h?bT(h,mE):yT(n&&L&&L.parent.parent===n?L._value:gT(t,s,a,gE),mE);if(mE.o&&(mE.n=_T(L?L._toNumber:yT(gT(t,s,a,gE),xT).n,mE.n,mE.o)),hE.o&&(hE.n=_T(mE.n,hE.n,hE.o)),mE.t!==hE.t){if(mE.t===zC.COMPLEX||hE.t===zC.COMPLEX){let e=mE.t===zC.COMPLEX?mE:hE,t=mE.t===zC.COMPLEX?hE:mE;t.t=zC.COMPLEX,t.s=Zw(e.s),t.d=e.d.map(()=>t.n)}else if(mE.t===zC.UNIT||hE.t===zC.UNIT){let e=mE.t===zC.UNIT?mE:hE,t=mE.t===zC.UNIT?hE:mE;t.t=zC.UNIT,t.u=e.u}else if(mE.t===zC.COLOR||hE.t===zC.COLOR){let e=mE.t===zC.COLOR?mE:hE,t=mE.t===zC.COLOR?hE:mE;t.t=zC.COLOR,t.d=e.d.map(()=>0)}}if(mE.u!==hE.u){let e=hE.u?mE:hE;e=nE(t,e,hE.u?hE.u:mE.u,!1)}if(hE.d&&mE.d&&hE.d.length!==mE.d.length){let e=mE.d.length>hE.d.length?mE:hE,t=e===mE?hE:mE;t.d=e.d.map((e,n)=>Tw(t.d[n])?0:t.d[n]),t.s=Zw(e.s)}let ce=qw(+P||1e-11,12),le=gE[s];Ew(le)||(gE[s]=null);let R=o?o.set:null;_=qw(I+ce,12);let ue=mE.d,de=hE.d,fe=hE.s,pe={parent:this,id:SE++,property:s,target:t,_value:null,_toFunc:_E.func,_fromFunc:vE.func,_ease:pE(j),_fromNumbers:ue?Zw(ue):XC,_toNumbers:de?Zw(de):XC,_strings:fe?Zw(fe):XC,_fromNumber:mE.n,_toNumber:hE.n,_numbers:ue?Zw(ue):XC,_number:mE.n,_unit:hE.u,_modifier:te,_currentTime:0,_startTime:I,_delay:+ee,_updateDuration:ce,_changeDuration:ce,_absoluteStartTime:oe,_absoluteUpdateStartTime:se,_absoluteEndTime:qw(k+_,12),_hasFromValue:F||re?1:0,_tweenType:a,_setter:R,_valueType:hE.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:le,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==VC.none&&VT(pe,m);let me=pe._valueType;if(me===zC.COMPLEX)pe._value=ST(pe,1,-1);else if(me===zC.UNIT)pe._value=`${te(pe._toNumber)}${pe._unit}`;else if(me===zC.COLOR){let e=hE.d;pe._value=`rgba(${qw(e[0],0)},${qw(e[1],0)},${qw(e[2],0)},${e[3]})`}else pe._value=te(pe._toNumber);isNaN(g)&&(g=pe._startTime),h=pe,M++,tT(this,pe)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===RC.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;$w(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===VC.blend&&$w(kT.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),j?($w(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=qC,this.iterationCount=0),this.targets=s,this.id=Tw(d)?CE:d,this.duration=A===1e-11?qC:Yw((A+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=j,this.iterationDuration=A,!this._autoplay&&N&&this.onRender(this)}stretch(e){let t=this.duration;if(t===Xw(e))return this;let n=e/t;return $w(this,e=>{e._updateDuration=Xw(e._updateDuration*n),e._changeDuration=Xw(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return $w(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(yT(n(),mE),mE.u!==e._unit&&e.target[UC]&&nE(e.target,mE,e._unit,!0),e._fromNumbers=Zw(mE.d),e._fromNumber=mE.n):t&&(yT(gT(e.target,e.property,e._tweenType),xT),e._fromNumbers=Zw(xT.d),e._fromNumber=xT.n),t&&(yT(t(),hE),e._toNumbers=Zw(hE.d),e._strings=Zw(hE.s),e._toNumber=hE.o?_T(e._fromNumber,hE.n,hE.o):hE.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),DT(this)}then(e){return super.then(e)}},OE=(e,t)=>hw.editor?hw.editor.addAnimation(e,t):new DE(e,t,null,0,!1).init(),kE=YC*10,AE=class{constructor(e={}){let t=!Tw(e.bounce)||!Tw(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/YC,this.maxIterations=this.maxDuration/this.timeStep/YC,this.bn=Kw(dT(e.bounce,.5),-1,1),this.pd=Kw(dT(e.duration,628),10*hw.timeScale,kE*hw.timeScale),this.m=Kw(dT(e.mass,1),1,kE),this.s=Kw(dT(e.stiffness,100),qC,kE),this.d=Kw(dT(e.damping,10),qC,kE),this.v=Kw(dT(e.velocity,0),-kE,kE),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=e.onComplete||ew,t&&this.calculateSDFromBD(),this.compute(),this.ease=e=>{let t=e*this.settlingDuration,n=this.completed,r=this.pd;return t>=r&&!n&&(this.completed=!0,this.onComplete(this.parent)),t<r&&n&&(this.completed=!1),e===0||e===1?e:this.solve(e*this.solverDuration)}}solve(e){let{zeta:t,w0:n,wd:r,b:i}=this,a=e;return a=t<1?Bw(-a*t*n)*(1*Rw(r*a)+i*Lw(r*a)):t===1?(1+i*a)*Bw(-a*n):((1+i)*Bw((-t*n+r)*a)+(1-i)*Bw((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=hw.timeScale===1?this.pd/YC:this.pd;this.m=1,this.v=0,this.s=Fw(2*Ww/e,2),this.d=this.bn>=0?(1-this.bn)*4*Ww/e:4*Ww/(e*(1+this.bn)),this.s=qw(Kw(this.s,qC,kE),3),this.d=qw(Kw(this.d,qC,300),3)}calculateBDFromSD(){let e=2*Ww/Iw(this.s);this.pd=e*(hw.timeScale===1?YC:1),this.bn=this.d/(2*Iw(this.s))<=1?1-this.d*e/(4*Ww):4*Ww/(this.d*e)-1,this.bn=qw(Kw(this.bn,-1,1),3),this.pd=qw(Kw(this.pd,10*hw.timeScale,kE*hw.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=Kw(Iw(o/i),qC,YC),l=this.zeta=a/(2*Iw(o*i));l<1?(this.wd=c*Iw(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*Iw(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)zw(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=qw(this.solverDuration*YC,0)*hw.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=Kw(dT(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=Kw(dT(e,1),10*hw.timeScale,kE*hw.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=Kw(dT(e,100),qC,kE),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=Kw(dT(e,10),qC,kE),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=Kw(dT(e,1),1,kE),this.compute()}get velocity(){return this.v}set velocity(e){this.v=Kw(dT(e,0),-kE,kE),this.compute()}},jE=e=>new AE(e),ME=(e=10,t)=>{let n=t?Vw:Hw;return t=>n(Kw(t,0,1)*e)*(1/e)},NE=(0,q.forwardRef)(function({id:e,transform:t},n){return(0,X.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function PE({id:e}){return(0,X.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,X.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function FE({id:e}){return(0,X.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,X.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,X.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,X.jsxs)(`feMerge`,{children:[(0,X.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,X.jsx)(`feMergeNode`,{in:`shade`}),(0,X.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var IE=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function LE({id:e,values:t=mx}){return(0,X.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,X.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,X.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function RE(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function zE(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function BE(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function VE(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=zE(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=zE((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+BE(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=BE(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var HE={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800};function UE({variant:e}){let t=`caps-loader-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(null),i=CC(r),{reduced:a}=i,o=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,q.useLayoutEffect)(()=>{if(a||!n.current||!r.current)return;let t=[...n.current.querySelectorAll(`ellipse`)].map((t,n)=>OE(t,{keyframes:Array.from({length:48},(t,r)=>({...VE(e,n,(r+1)/48),duration:wC(i,HE[e])/48})),ease:`linear`,loop:!0})),o=RE(r.current,e=>{for(let n of t)e?n.resume():n.pause()});return()=>{o();for(let e of t)e.revert()}},[e,a,i]),(0,X.jsxs)(`svg`,{ref:r,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(LE,{id:t,values:IE}),(0,X.jsx)(NE,{id:`${t}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,X.jsx)(PE,{id:`${t}-shadow`}),(0,X.jsx)(`mask`,{id:`${t}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,X.jsx)(`g`,{ref:n,fill:`currentColor`,filter:`url(#${t})`,children:Array.from({length:o},(t,n)=>(0,X.jsx)(`ellipse`,{...VE(e,n,0)},n))})})]}),(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${t}-surface)`,mask:`url(#${t}-mask)`})})]})}var WE={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},GE={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`},KE=(0,q.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,tone:s=`neutral`,...c},l){let u=`${(0,q.useId)()}-label`,d=!r&&e===void 0&&t===void 0;return(0,X.jsxs)(`span`,{...c,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?u:void 0),className:Q(`caps-loader`,WE[a],GE[s],n),"data-variant":o,role:r?void 0:`status`,ref:l,children:[(0,X.jsx)(UE,{variant:o}),d?(0,X.jsx)(PC,{id:u,children:i}):null]})}),qE=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,JE=bx(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${qE}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${qE}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),YE=(0,q.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=Q(JE({size:c,variant:l}),n),p=(0,q.useRef)(a).current,m=(0,q.useRef)(null);return(0,q.useImperativeHandle)(d,()=>m.current),XE(m,i,a),e?(0,X.jsx)(cC,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,X.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(KE,{className:`size-3`,decorative:!0,size:`sm`}):null,t]}):(0,X.jsx)(tD,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function XE(e,t,n){let r=(0,q.useRef)(null),i=(0,q.useRef)(null),a=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!OC(o))return;let f=SC(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:DC(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var ZE=1100;function QE(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:DC(t,`ease-out`)})}function $E(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:DC(t,`linear`)})}function eD(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:DC(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:DC(n,n.ease),fill:`backwards`})]}function tD({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,q.useRef)(null),s=NC(),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);c&&!u&&d(!0);let f=(0,q.useRef)(a),p=(0,q.useRef)(r);(0,q.useEffect)(()=>{p.current=r},[r]),(0,q.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},ZE);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!OC(t))return;let n=SC(t);if(n.shake<=0)return;let r=$E(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,q.useRef)(c);return(0,q.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!OC(e)){c||d(!1);return}let r=SC(e),i=c?eD(t,n,r):eD(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(QE(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:DC(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,X.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,X.jsx)(KE,{className:`size-3`,decorative:!0,size:`sm`}):null,e]}),u?(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,X.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var nD={...q},rD={};function iD(e,t){let n=q.useRef(rD);return n.current===rD&&(n.current=e(t)),n}var aD=nD.useInsertionEffect,oD=aD&&aD!==nD.useLayoutEffect?aD:e=>e();function sD(e){let t=iD(cD).current;return t.next=e,oD(t.effect),t.trampoline}function cD(){let e={next:void 0,callback:lD,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function lD(){}function uD(){}var dD=Object.freeze([]),fD=Object.freeze({});function pD(e){q.useEffect(e,dD)}var mD=0,hD=class e{static create(){return new e}currentId=mD;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=mD,t()},e)}isStarted(){return this.currentId!==mD}clear=()=>{this.currentId!==mD&&(clearTimeout(this.currentId),this.currentId=mD)};disposeEffect=()=>this.clear};function gD(){let e=iD(hD.create).current;return pD(e.disposeEffect),e}function _D(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var vD=_D(`https://base-ui.com/production-error`,`Base UI`),yD=q.createContext(void 0);function bD(){let e=q.useContext(yD);if(e===void 0)throw Error(vD(53));return e}function xD(e,t,n,r){let i=iD(CD).current;return wD(i,e,t,n,r)&&ED(i,[e,t,n,r]),i.callback}function SD(e){let t=iD(CD).current;return TD(t,e)&&ED(t,e),t.callback}function CD(){return{callback:null,cleanup:null,refs:[]}}function wD(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function TD(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function ED(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var DD=18;function OD(e){return DD>=e}function kD(e){if(!q.isValidElement(e))return null;let t=e,n=t.props;return(OD(19)?n?.ref:t.ref)??null}function AD(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function jD(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function MD(e,t){return typeof e==`function`?e(t):e}function ND(e,t){return typeof e==`function`?e(t):e}var PD={};function FD(e,t,n,r,i){if(!n&&!r&&!i&&!e)return LD(t);let a=LD(e);return t&&(a=RD(a,t)),n&&(a=RD(a,n)),r&&(a=RD(a,r)),i&&(a=RD(a,i)),a}function ID(e){if(e.length===0)return PD;if(e.length===1)return LD(e[0]);let t=LD(e[0]);for(let n=1;n<e.length;n+=1)t=RD(t,e[n]);return t}function LD(e){return HD(e)?{...e(PD)}:zD(e)}function RD(e,t){return HD(t)?t(e):BD(e,t)}function zD(e){let t={...e};for(let e in t){let n=t[e];VD(e,n)&&(t[e]=WD(n))}return t}function BD(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=AD(e.style,r);break;case`className`:e[n]=KD(e.className,r);break;default:e[n]=VD(n,r)?UD(e[n],r):r}}return e}function VD(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function HD(e){return typeof e==`function`}function UD(e,t){return t?e?(...n)=>{let r=n[0];if(qD(r)){let i=r;GD(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:WD(t):e}function WD(e){return e&&((...t)=>{let n=t[0];return qD(n)&&GD(n),e(...t)})}function GD(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function KD(e,t){return t?e?t+` `+e:t:e}function qD(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function JD(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=QD(r));let i=YD(t,n,r);if(n.enabled===!1)return null;let a=n.state??fD;return $D(e,r,i,a)}function YD(e,t,n){let{className:r,style:i}=e,{state:a=fD,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?MD(r,a):void 0,d=l?ND(i,a):void 0,f=l?jD(a,c):fD,p=l&&s?XD(s):void 0,m=l?AD(f,p)??{}:fD;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?SD([m.ref,kD(n),...o]):xD(m.ref,kD(n),o):xD(null,null)),l?(u!==void 0&&(m.className=KD(m.className,u)),d!==void 0&&(m.style=AD(m.style,d)),m):fD}function XD(e){return Array.isArray(e)?ID(e):FD(void 0,e)}var ZD=Symbol.for(`react.lazy`);function QD(e){if(e?.$$typeof!==ZD)return e;let t=q.Children.toArray(e)[0];return q.isValidElement(t)?t:e}function $D(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=FD(n,t.props);return e.ref=n.ref,q.cloneElement(t,e)}return eO(e,n)}function eO(e,t){return e===`button`?(0,q.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,q.createElement)(`img`,{alt:``,...t,key:t.key}):q.createElement(e,t)}function tO(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var nO=`base-ui-disable-scrollbar`,rO={className:nO,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:nO,precedence:`base-ui:low`,children:`.${nO}{scrollbar-width:none}.${nO}::-webkit-scrollbar{display:none}`})}};function iO(){let[,e]=q.useState({});return q.useCallback(()=>{e({})},[])}var aO=0;function oO(e,t=`mui`){let n=q.useRef(void 0),r=iO(),i=e??n.current;return q.useEffect(()=>{n.current??(aO+=1,n.current=`${t}-${aO}`,e??r())},[e,t,r]),i}var sO=nD.useId;function cO(e,t){if(sO!==void 0){let n=sO();return e??(t?`${t}-${n}`:n)}return oO(e,t)}function lO(e){return cO(e,`base-ui`)}var uO=`data-has-overflow-x`,dO=`data-has-overflow-y`,fO=`data-overflow-x-start`,pO=`data-overflow-x-end`,mO=`data-overflow-y-start`,hO=`data-overflow-y-end`,gO=e=>t=>t?{[e]:``}:null,_O={hasOverflowX:gO(uO),hasOverflowY:gO(dO),overflowXStart:gO(fO),overflowXEnd:gO(pO),overflowYStart:gO(mO),overflowYEnd:gO(hO),cornerHidden:()=>null};function vO(){return typeof window<`u`}function yO(e){return SO(e)?(e.nodeName||``).toLowerCase():`#document`}function bO(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xO(e){return((SO(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function SO(e){return vO()?e instanceof Node||e instanceof bO(e).Node:!1}function CO(e){return vO()?e instanceof Element||e instanceof bO(e).Element:!1}function wO(e){return vO()?e instanceof HTMLElement||e instanceof bO(e).HTMLElement:!1}function TO(e){return!vO()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof bO(e).ShadowRoot}function EO(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=LO(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function DO(e){return/^(table|td|th)$/.test(yO(e))}function OO(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var kO=/transform|translate|scale|rotate|perspective|filter/,AO=/paint|layout|strict|content/,jO=e=>!!e&&e!==`none`,MO;function NO(e){let t=CO(e)?LO(e):e;return jO(t.transform)||jO(t.translate)||jO(t.scale)||jO(t.rotate)||jO(t.perspective)||!FO()&&(jO(t.backdropFilter)||jO(t.filter))||kO.test(t.willChange||``)||AO.test(t.contain||``)}function PO(e){let t=zO(e);for(;wO(t)&&!IO(t);){if(NO(t))return t;if(OO(t))return null;t=zO(t)}return null}function FO(){return MO??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),MO}function IO(e){return/^(html|body|#document)$/.test(yO(e))}function LO(e){return bO(e).getComputedStyle(e)}function RO(e){return CO(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zO(e){if(yO(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||TO(e)&&e.host||xO(e);return TO(t)?t.host:t}function BO(e){let t=zO(e);return IO(t)?(e.ownerDocument||e).body:wO(t)&&EO(t)?t:BO(t)}function VO(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=BO(e),i=r===e.ownerDocument?.body,a=bO(r);if(i){let e=HO(a);return t.concat(a,a.visualViewport||[],EO(r)?r:[],e&&n?VO(e):[])}return t.concat(r,VO(r,[],n))}function HO(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function UO(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:WO,platform:GO,maxTouchPoints:KO}=UO(),qO=WO.toLowerCase(),JO=GO.toLowerCase(),YO=/^i(os$|p)/.test(JO)||JO===`macintel`&&KO>1,XO=`android`,ZO=JO===XO||qO.includes(XO),QO=!YO&&JO.startsWith(`mac`);JO.startsWith(`win`),!ZO&&/^(linux|chrome os)/.test(JO);var $O=QO||YO,ek=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!ek&&qO.includes(`firefox`),!ek&&qO.includes(`chrom`);var tk=$O,nk=/jsdom|happydom/.test(qO);function rk(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function ik(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&TO(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ak(e,t){let n=e;for(;n;){if(CO(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(TO(n)?n.host:null)}return null}function ok(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var sk=`data-base-ui-focusable`,ck=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,lk=`data-starting-style`,uk=`data-ending-style`,dk={[lk]:``},fk={[uk]:``},pk={transitionStatus(e){return e===`starting`?dk:e===`ending`?fk:null}},mk=`data-open`,hk=`data-closed`,gk=`data-anchor-hidden`,_k=`data-popup-open`,vk=`data-pressed`,yk={[_k]:``},bk={[_k]:``,[vk]:``},xk={[mk]:``},Sk={[hk]:``},Ck={[gk]:``},wk={open(e){return e?yk:null}},Tk={open(e){return e?bk:null}},Ek={open(e){return e?xk:Sk},anchorHidden(e){return e?Ck:null}},Dk={...Ek,...pk},Ok=`data-trigger-disabled`;function kk(e,t){if(!CO(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Ok);for(let[,e]of t.entries())if(ik(e,n))return!e.hasAttribute(Ok);return!1}function Ak(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function jk(e){return e.matches(`html,body`)}function Mk(e){return wO(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Nk(e){return ak(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ck}`)!=null}function Pk(e){return e?e.getAttribute(`role`)===`combobox`&&Mk(e):!1}function Fk(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Ik(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Ik(e,t.id,n)])}function Lk(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Rk(e){e.preventDefault(),e.stopPropagation()}function zk(e){return`nativeEvent`in e}function Bk(e){return e.pointerType===``&&e.isTrusted?!0:ZO&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Vk(e){return nk?!1:!ZO&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(ZO||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Hk(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Uk(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var Wk=Math.min,Gk=Math.max,Kk=Math.round,qk=Math.floor,Jk=e=>({x:e,y:e}),Yk={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Xk(e,t,n){return Gk(e,Wk(t,n))}function Zk(e,t){return typeof e==`function`?e(t):e}function Qk(e){return e.split(`-`)[0]}function $k(e){return e.split(`-`)[1]}function eA(e){return e===`x`?`y`:`x`}function tA(e){return e===`y`?`height`:`width`}function nA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function rA(e){return eA(nA(e))}function iA(e,t,n){n===void 0&&(n=!1);let r=$k(e),i=rA(e),a=tA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pA(o)),[o,pA(o)]}function aA(e){let t=pA(e);return[oA(e),t,oA(t)]}function oA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var sA=[`left`,`right`],cA=[`right`,`left`],lA=[`top`,`bottom`],uA=[`bottom`,`top`];function dA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?cA:sA:t?sA:cA;case`left`:case`right`:return t?lA:uA;default:return[]}}function fA(e,t,n,r){let i=$k(e),a=dA(Qk(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oA)))),a}function pA(e){let t=Qk(e);return Yk[t]+e.slice(t.length)}function mA(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function hA(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mA(e)}function gA(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _A(e){return e.visibility===`hidden`||e.visibility===`collapse`}function vA(e,t=e?LO(e):null){return!e||!e.isConnected||!t||_A(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function yA(e){return e?.ownerDocument||document}var bA=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function xA(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return TO(n)?n.host:null}function SA(e){for(let t of Array.from(e.children))if(yO(t)===`summary`)return t;return null}function CA(e,t){let n=SA(t);return!!n&&(e===n||ik(n,e))}function wA(e){let t=e?yO(e):``;return e!=null&&e.matches(bA)&&(t!==`summary`||e.parentElement!=null&&yO(e.parentElement)===`details`&&SA(e.parentElement)===e)&&(t!==`details`||SA(e)==null)&&(t!==`input`||e.type!==`hidden`)}function TA(e){if(!wA(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=xA(t)){let n=t!==e,r=yO(t)===`slot`;if(t.hasAttribute(`inert`)||n&&yO(t)===`details`&&!t.open&&!CA(e,t)||t.hasAttribute(`hidden`)||!r&&!EA(t,n))return!1}return!0}function EA(e,t){let n=LO(e);return t?n.display!==`none`:vA(e,n)}function DA(e){let t=e.tabIndex;if(t<0){let t=yO(e);if(t===`details`||t===`audio`||t===`video`||wO(e)&&e.isContentEditable)return 0}return t}function OA(e){if(yO(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function kA(e,t){let n=OA(e);if(!n)return!0;let r=t.find(e=>{let t=OA(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=OA(e);return t?.name===n.name&&t.form===n.form})===n}function AA(e){if(wO(e)&&yO(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return wO(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function jA(e,t){AA(e).forEach(e=>{wA(e)&&t.push(e),jA(e,t)})}function MA(e,t,n){AA(e).forEach(e=>{wO(e)&&e.matches(t)&&n.push(e),MA(e,t,n)})}function NA(e){return TA(e)&&DA(e)>=0}function PA(e){let t=[];return jA(e,t),t.filter(TA)}function FA(e){let t=PA(e);return t.filter(e=>DA(e)>=0&&kA(e,t))}function IA(e,t){let n=FA(e),r=n.length;if(r===0)return;let i=rk(yA(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function LA(e){return IA(yA(e).body,1)||e}function RA(e){return IA(yA(e).body,-1)||e}function zA(e,t,n){if(!e)return null;let r=[];jA(yA(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(TA);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!ik(n,o)&&NA(o)&&kA(o,a))return o}return r[i]}function BA(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!ik(n,r)}function VA(e){FA(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function HA(e){let t=[];MA(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var UA=q.createContext(void 0),WA={disableStyleElements:!1};function GA(){return q.useContext(UA)??WA}var KA=`--scroll-area-corner-height`,qA=`--scroll-area-corner-width`,JA=`data-orientation`,YA={x:0,y:0},XA={width:0,height:0},ZA={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},QA={x:!0,y:!0,corner:!0},$A=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ej(i),d=lO(),f=gD(),p=gD(),{nonce:m,disableStyleElements:h}=GA(),[g,_]=q.useState(!1),[v,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(!1),[E,D]=q.useState(XA),[O,k]=q.useState(XA),[A,j]=q.useState(ZA),[M,N]=q.useState(QA),P=q.useRef(null),ee=q.useRef(null),te=q.useRef(null),F=q.useRef(null),ne=q.useRef(null),re=q.useRef(null),ie=q.useRef(null),ae=q.useRef(null),I=q.useRef(0),oe=q.useRef(0),se=q.useRef(0),L=q.useRef(0),ce=q.useRef(`vertical`),le=q.useRef(YA),R=q.useRef(null);function ue(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let de=sD(e=>{let t=e.x-le.current.x,n=e.y-le.current.y;le.current=e,n!==0&&ue(!0),t!==0&&ue(!1)}),fe=sD(()=>{let e=ee.current;e&&R.current===null&&(R.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),pe=sD(e=>{if(e.button!==0||ae.current!==null&&(ce.current===`vertical`?ne.current:re.current)?.hasPointerCapture(ae.current))return;ae.current=e.pointerId,I.current=e.clientY,oe.current=e.clientX,ce.current=e.currentTarget.getAttribute(JA);let t=ee.current;t&&(se.current=t.scrollTop,L.current=t.scrollLeft,fe()),(ce.current===`vertical`?ne.current:re.current)?.setPointerCapture(e.pointerId)}),me=sD(e=>{if(e.pointerId!==ae.current)return;ae.current=null,(ce.current===`vertical`?x:y)(!1),R.current!==null&&(ee.current&&(ee.current.style.scrollSnapType=R.current),R.current=null);let t=ce.current===`vertical`?ne.current:re.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),he=sD(e=>{if(e.pointerId!==ae.current)return;if(e.buttons%2==0){me(e);return}let t=ee.current;if(!t)return;let n=ce.current===`vertical`,r=n?ne.current:re.current,i=n?te.current:F.current;if(!r||!i)return;let a=n?`y`:`x`,o=tO(i,`padding`,a),s=tO(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-I.current:e.clientX-oe.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?se.current:L.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ue(n)});function ge(e){C(e.pointerType===`touch`)}function _e(e){if(ge(e),e.pointerType!==`touch`){let t=ik(P.current,e.target);_(t)}}let ve=q.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),ye={role:`presentation`,onPointerEnter:_e,onPointerMove:_e,onPointerDown:ge,onPointerLeave(){_(!1)},style:{position:`relative`,[KA]:`${E.height}px`,[qA]:`${E.width}px`}},be=JD(`div`,e,{state:ve,ref:[t,P],props:[ye,o],stateAttributesMapping:_O}),xe=q.useMemo(()=>({handlePointerDown:pe,handlePointerMove:he,handlePointerUp:me,handleScroll:de,disableViewportSnap:fe,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ie,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:ee,scrollbarYRef:te,scrollbarXRef:F,thumbYRef:ne,thumbXRef:re,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:ve,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[pe,he,me,de,fe,E,O,w,S,v,b,g,d,M,A,ve,s,c,l,u]);return(0,X.jsxs)(yD.Provider,{value:xe,children:[!h&&rO.getElement(m),be]})});function ej(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var tj=typeof document<`u`?q.useLayoutEffect:()=>{};function nj(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var rj=q.createContext(void 0);function ij(){let e=q.useContext(rj);if(e===void 0)throw Error(vD(55));return e}var aj=q.createContext(void 0);function oj(){return q.useContext(aj)?.direction??`ltr`}function sj(e,t){if(t<=0)return 0;let n=nj(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function cj(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var lj=`--scroll-area-overflow-x-start`,uj=`--scroll-area-overflow-x-end`,dj=`--scroll-area-overflow-y-start`,fj=`--scroll-area-overflow-y-end`,pj=`--scroll-area-thumb-height`,mj=`--scroll-area-thumb-width`,hj=[lj,uj,dj,fj],gj=!1;function _j(){gj||ek||(typeof CSS<`u`&&`registerProperty`in CSS&&hj.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),gj=!0)}var vj=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=bD(),T=oj(),E=q.useRef(!0),D=q.useRef([NaN,NaN,NaN,NaN]),O=gD(),k=gD(),A=sD(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=yj(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),ee=Math.max(0,h-y),te=0,F=0;j||(te=sj(T===`rtl`?-w:w,P),F=P-te);let ne=A?0:sj(x,ee),re=A?0:ee-ne,ie=j?0:b,ae=A?0:y,I=0,oe=0;!j&&!A&&(I=t?.offsetWidth||0,oe=n?.offsetHeight||0);let se=f.width===0&&f.height===0,L=se?I:0,ce=se?oe:0,le=tO(n,`padding`,`x`),R=tO(t,`padding`,`y`),ue=tO(i,`margin`,`x`),de=tO(r,`margin`,`y`),fe=ie-le-ue,pe=ae-R-de,me=n?Math.min(n.offsetWidth-L,fe):fe,he=t?Math.min(t.offsetHeight-ce,pe):pe,ge=Math.max(16,me*M),_e=Math.max(16,he*N);if(m(e=>bj(e,{width:ge,height:_e})),t&&r){let e=xj(r,pj,x,ee,h,_e,t.offsetHeight-_e-R-de);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-ge-le-ue,t=xj(i,mj,T===`rtl`?-w:w,P,_,ge,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let ve=[te,F,ne,re];hj.forEach((t,n)=>{e.style.setProperty(t,`${ve[n]}px`)}),a&&p(e=>bj(e,{width:I,height:oe})),g(e=>bj(e,k));let ye={xStart:!j&&te>C.xStart,xEnd:!j&&F>C.xEnd,yStart:!A&&ne>C.yStart,yEnd:!A&&re>C.yEnd};S(e=>bj(e,ye))});tj(()=>{_j()},[]),tj(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),tj(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),tj(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=cj(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(uD))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:rO.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=JD(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:_O}),P=q.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)(rj.Provider,{value:P,children:N})});function yj(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function bj(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function xj(e,t,n,r,i,a,o){let s=nj(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}function Sj(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var Cj=q.createContext(void 0);function wj(){let e=q.useContext(Cj);if(e===void 0)throw Error(vD(54));return e}var Tj=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=bD(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=oj(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;q.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return Sj(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=ok(e.nativeEvent),n=T?h.current:g.current;if(n&&ik(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=tO(n,`margin`,a),s=tO(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${KA})`,insetInlineEnd:0,[pj]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${qA})`,bottom:0,[mj]:`${S.width}px`}}},M=JD(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:_O});return A?(0,X.jsx)(Cj.Provider,{value:i,children:M}):null}),Ej=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=ij(),{hasMeasuredScrollbar:s,viewportState:c}=bD(),l=q.useRef(null),u=q.useRef(s);return tj(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),JD(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:_O,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),Dj=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=bD(),m=wj(),h=m===`vertical`;return JD(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),Oj=Object.freeze({ease:`linear`,duration:0});function kj(e,t){let n=EC(e,t.duration);return n<=0?Oj:e.steps>0?{ease:ME(e.steps),duration:n}:{ease:jE({bounce:TC(e,t.bounce),duration:n}),duration:n}}function Aj(e,t){let n=wC(e,t.duration);return{ease:e.steps>0?ME(e.steps):t.ease,duration:n}}function jj(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function Mj(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var Nj=(0,q.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,X.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Q(`caps-surface`,e)})}),Pj=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-screen`,e)})}),Fj=(0,q.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,X.jsx)(Nj,{...a,className:Q(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,X.jsx)(`div`,{className:Q(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,X.jsx)(Pj,{className:Q(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})});(0,q.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,X.jsxs)(`header`,{...i,className:Q(`caps-screen-header`,e),ref:a,children:[t?(0,X.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,X.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,q.forwardRef)(function({appearance:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,q.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,X.jsxs)(`div`,{...s,className:Q(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,X.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,X.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,X.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,X.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var Ij=(0,q.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=NC();(0,q.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=SC(t),i=Aj(r,{ease:`outQuad`,duration:45}),a=kj(r,{bounce:.18,duration:180});n=OE(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=jj(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=Mj(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,X.jsx)(vj,{render:a?(0,X.jsx)(Pj,{}):(0,X.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,X.jsx)(Ej,{style:{minWidth:0},children:e})});return(0,X.jsxs)($A,{render:n?(0,X.jsx)(Nj,{size:r??`md`,depth:i??`shallow`}):(0,X.jsx)(`div`,{}),ref:c,className:Q(`caps-scroll-area`,t),children:[a?(0,X.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,X.jsx)(Nj,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,X.jsx)(Tj,{className:`caps-scroll-track`,children:(0,X.jsx)(Dj,{className:`caps-scroll-thumb`,children:(0,X.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})});function Lj(e){let t=`${e.provider}/`;return e.model.startsWith(t)?e.model:`${t}${e.model}`}function Rj(e){return e<1e3?String(e):e<1e6?`${String(Math.round(e/1e3))}K`:`${String(Math.round(e/1e5)/10)}M`}function zj(e){return e.window===null?Rj(e.tokens):`${Rj(e.tokens)}/${Rj(e.window)}`}var Bj=()=>void 0;function Vj(e){let t=new Map;for(let{id:n,name:r}of e){let e=t.get(r)??new Set;e.add(n),t.set(r,e)}return new Map(e.map(({id:e,name:n})=>[e,(t.get(n)?.size??0)>1?`${n} · ${e.slice(-6)}`:n]))}var Hj=pn.mapFields(({extensionId:e,correlation:t})=>({extensionId:e,correlation:t})),Uj=U({requestId:An(V),meta:An(Xr),data:An(ir),origin:An(Hj),id:V,sequence:cn.check(Qr(0)),commandId:wn(V),value:jr}),Wj=Sr([`manual`,`threshold`,`overflow`]),Gj=U({queue:xn([U({state:B(`idle`)}),U({state:B(`queued`),commandId:fn,runningWork:wn(xn([U({kind:B(`session`),sessionId:fn,commandId:fn}),U({kind:B(`host`),lane:fn,jobId:fn})]))}),U({state:B(`running`),commandId:fn})]),cancellationRequested:$r,retry:wn(U({attempt:cn.check(Qr(0)),maxAttempts:cn.check(Qr(0)),delayMs:cn.check(sn(0)),errorMessage:V,scheduledAt:cn.check(sn(0))})),activeTool:wn(V),lastModelChoiceSequence:wn(cn.check(Qr(0))),compaction:wn(U({trigger:Wj}))}),Kj=V,qj=xn([U({status:B(`running`),revision:Kj,value:ir,catalog:An(ir)}),U({status:B(`stopped`),revision:Kj,reason:V})]),Jj=ai(V,qj),Yj=U({id:V,version:V,revision:Kj,status:Sr([`running`,`stopped`]),reason:wn(V),stoppedAt:wn(Pn)}),Xj=U({commandId:V,outcome:Sr([`completed`,`cancelled`,`failed`,`interrupted`]),sequence:cn.check(Qr(0)),diagnostic:wn(V),meta:An(Xr)}),Zj=U({id:V,sequence:cn.check(Qr(0)),at:cn.check(sn(0)),tokensBefore:Pn,tokensAfter:wn(Pn),trigger:wn(Wj)}),Qj=U({id:V,sequence:cn.check(Qr(0)),at:cn.check(sn(0)),trigger:Wj,result:Sr([`nothing_to_compact`,`failed`,`stale`,`insufficient`]),diagnostic:wn(V)}),$j=U({messageId:V,revision:cn.check(sn(0)),text:V,thinking:V,textTruncated:$r,thinkingTruncated:$r}),eM=U({commandId:V,requestId:V,meta:An(Xr),origin:An(Hj),text:V,images:An(H(Nn)),delivery:Sr([`steer`,`followUp`])}),tM=U({toolCallId:V,revision:cn.check(sn(0)),tail:V.check(Gn(e=>new TextEncoder().encode(e).byteLength<=8192&&e.split(`
32
+ `).length<=200)),droppedBytes:cn.check(sn(0)),totalBytes:cn.check(sn(0))}),nM=H(tM).check(K(4)),rM=U({total:cn.check(sn(0)),prompts:H(eM),hasMore:$r}),iM=U({tokens:cn.check(sn(0)),window:wn(cn.check(Qr(0)))}),aM=U({sessionId:V,cursor:wn(V),hasMore:$r,oldestCursor:An(wn(V)),messages:H(Uj),terminals:H(Xj),sandboxFailures:An(H(In)),compactions:An(H(Zj)),compactionNotices:An(H(Qj)),pending:rM,activity:Gj,progress:wn($j),toolOutput:nM,extensions:Jj,attention:jn,context:An(iM)}),oM=xn([U({kind:B(`tool_output`),toolOutput:nM,activity:Gj}),U({kind:B(`update`),delivery:Sr([`replay`,`live`]),cursor:wn(V),messages:H(Uj),terminals:H(Xj),sandboxFailures:An(H(In)),compactions:An(H(Zj)),compactionNotices:An(H(Qj)),pending:rM,activity:Gj,extensions:Jj,attention:jn,context:An(iM)}),U({kind:B(`progress`),progress:$j,activity:Gj}),U({kind:B(`reset`),reason:B(`history_unavailable`),cursor:wn(V),baseline:aM})]),sM=U({status:B(`accepted`),commandId:V}),cM=U({status:B(`unknown`)}),lM=xn([sM,cM]),uM=Pr(dr(lM));function dM(e){return uM(e)}var fM=xn([sM,cM,U({status:B(`too_late`),commandId:V})]),pM=U({sessionId:V}),mM=Pr(dr(aM),{onExcessProperty:`error`}),hM=Pr(dr(oM),{onExcessProperty:`error`}),gM=Pr(dr(sM)),_M=Pr(dr(fM)),vM=Pr(dr(pM)),yM=Pr(dr(bn)),bM=Pr(dr(Yj)),xM=Pr(dr(H(Yj))),SM=Pr(dr(ir));function CM(e){return bM(e)}function wM(e){return xM(e)}function TM(e){return SM(e)}function EM(e){return gM(e)}function DM(e){return _M(e)}function OM(e){return Pr(dr(wn(eM)))(e)}function kM(e){return vM(e)}function AM(e){return mM(e)}function jM(e){return hM(e)}function MM(e){let t=yM(e);return new Br(t.boundary,t.cause,t.message,t.requestId)}var NM=Pr(dr(U({sessions:H(xn([U({sessionId:fn,createdAt:Pn,lastActivityAt:Pn,settledAt:An(Pn),title:V,state:Sr([`needs_you`,`running`,`errored`,`done`])}),U({sessionId:fn,state:B(`unavailable`)})])),next:W(fn)})));function PM(e){let t=NM(e);return{sessions:t.sessions,next:t.next}}var FM=Pr(dr(U({sessionId:fn}))),IM=Pr(dr(U({deleted:$r})));function LM(e){return IM(e).deleted}function RM(e){return FM(e).sessionId}function zM(e){let t={modules:e.modules??[],sources:e.sources??[],sandbox:an(e.sandbox),access:e.access??{}};return e.execution===void 0?t:{...t,execution:e.execution}}function BM(e){return Dt(e).then(e=>{if(Vn(e))return e.value;let t=we(yn(e.cause))??Xn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))})}function VM(e){let t=vt(e);if(Vn(t))return t.value;let n=we(yn(t.cause))??Xn(t.cause);throw n instanceof Error?n:Error(String(n))}function HM(e){let t=Tr(e);return Object.freeze({[Symbol.asyncIterator]:()=>{let e=t[Symbol.asyncIterator]();return{next:()=>e.next(),return:()=>e.return?.()??Promise.resolve({done:!0,value:void 0})}}})}function UM(e,t){function n(e){return BM(t.command(e))}return Object.freeze({address:e,command:n,withdraw:e=>BM(t.withdraw(e)),abort:()=>BM(t.abort),send:(e,n)=>BM(t.send(e,n)),cancel:e=>BM(t.cancel(e)),latestPending:()=>BM(t.latestPending),modelPreference:Object.freeze({read:()=>BM(t.modelPreference.read),set:e=>BM(t.modelPreference.set(e))}),extension:e=>{let n=t.extension(e);return Object.freeze({call:(e,t)=>BM(n.call(e,t))})},read:e=>BM(t.read(e)),subscribe:e=>HM(t.subscribe(e)),watch:e=>BM(t.watch(e)).then(e=>Object.freeze({snapshot:e.snapshot,changes:HM(e.changes),close:()=>BM(e.close)}))})}function WM(e,t){let n=t??`local:${ar()}`;return Object.freeze({createSession:t=>BM(e.createSession(t)),deleteSession:t=>BM(e.deleteSession(t)),listSessions:t=>BM(e.listSessions(t)),extensions:Object.freeze({list:()=>BM(e.extensions.list),resume:t=>BM(e.extensions.resume(t)),call:(t,n,r)=>BM(e.extensions.call(t,n,r))}),session:t=>UM(`${n}/sessions/${encodeURIComponent(t)}`,e.session(t)),close:()=>BM(e.close)})}function GM(e){let t=`local:${ar()}`;return Object.freeze({...WM(e,t),prepareConfiguration:async t=>{let n={extensions:t.extensions};t.tools!==void 0&&Object.assign(n,{tools:zM(t.tools)});let r=await BM(e.prepareConfiguration(n));return{commit:()=>{VM(r.commit)},discard:()=>BM(r.discard)}},grants:Object.freeze({deliver:(t,n)=>VM(e.grants.deliver(t,n)),read:t=>VM(e.grants.read(t))}),withMeta:n=>WM(e.withMeta(n),t)})}function KM(e=`Remote Shiitake operation is unavailable`){return new Br(`runtime`,`unavailable`,e)}function qM(e){return new Br(`runtime`,`invalid`,e)}function JM(){return new Br(`runtime`,`closed`,`Shiitake client is closed`)}var YM=2,XM=Pr(V);function ZM(e){if(!(e instanceof MessageEvent))throw qM(`Session stream event is invalid`);return XM(e.data)}function QM(e){return e.kind===`source-error`?Je(KM(`Session stream is unavailable`)):e.kind===`snapshot`?Jt({try:()=>({kind:`snapshot`,value:AM(ZM(e.event))}),catch:()=>qM(`Session snapshot is invalid`)}):e.kind===`frame`?Jt({try:()=>({kind:`frame`,value:jM(ZM(e.event))}),catch:()=>qM(`Session frame is invalid`)}):Jt({try:()=>MM(ZM(e.event)),catch:()=>qM(`Session runtime error is invalid`)}).pipe(Wt(Je))}function $M(e,t){return xt(()=>{e.closed||(e.closed=!0,t.delete(e),e.source.close())})}function eN(e,t,n,r){return lr(t=>At(Jt({try:()=>{let i={source:new(r??EventSource)(e),closed:!1},a=(e,n)=>{Zr(t,{kind:e,event:n})};return i.source.addEventListener(`snapshot`,e=>{a(`snapshot`,e)}),i.source.addEventListener(`frame`,e=>{a(`frame`,e)}),i.source.addEventListener(`runtime-error`,e=>{a(`runtime-error`,e)}),i.source.addEventListener(`error`,e=>{i.source.readyState===YM&&a(`source-error`,e)}),n.add(i),i},catch:()=>KM(`Session stream could not open`)}),e=>$M(e,n))).pipe(Fr(QM),nr(t.await))}function tN(e,t){return`${e}/sessions/${encodeURIComponent(t)}`}function nN(e,t,n=!1){let r=new URLSearchParams({mode:`subscribe`});return t!==void 0&&r.set(`after`,t),n&&r.set(`includeSandboxFailures`,`true`),`${e}?${r.toString()}`}function rN(e,t,n,r){return eN(e,t,n,r).pipe(Fr(e=>e.kind===`frame`?Be(e.value):Je(qM(`Session subscription received a snapshot`))))}function iN(e,t,n,r,i,a){return tt(function*(){yield*n;let o=yield*cr(!1),s=yield*Tn();yield*xt(()=>t.add(s)),yield*$t(s,xt(()=>{t.delete(s)}));let c=yield*Xe(eN(e,r,i,a).pipe(sr(M_()),kn(s)));if(en(c))return yield*br(s,c),yield*Te(c.cause);let[l,u]=c.value;if(F(l)||l.value.kind!==`snapshot`){let e=qM(`Session stream did not begin with a snapshot`);return yield*br(s,ii(e)),yield*Je(e)}let d=u.pipe(Fr(e=>e.kind===`frame`?Be(e.value):Be({kind:`reset`,reason:`history_unavailable`,cursor:e.value.cursor,baseline:e.value})),nr(o.await),Gr(e=>o.isOpen()&&Jn(e)?Mr:yr(e)));return Object.freeze({snapshot:l.value.value,changes:d,close:o.open.pipe(De(br(s,Ln)))})})}function aN(e,t,n){return Lt({try:async t=>{let n=await e(t);return{response:n,body:await n.text()}},catch:()=>KM(`${n} request failed`)}).pipe(Wt(({response:e,body:r})=>e.ok?Jt({try:()=>t(r),catch:()=>qM(`${n} response is invalid`)}):Jt({try:()=>MM(r),catch:()=>qM(`${n} error response is invalid`)}).pipe(Wt(Je))))}function oN(e){let t=e.baseUrl.replace(/\/+$/u,``),n=e.fetch??globalThis.fetch,i=new Set,a=new Set,o=fr(!1),s=!1,c=qe(()=>s?Je(JM()):I),l=(e,t,n)=>r(aN(e,t,n),o.await.pipe(De(Je(JM())))),u=(e,t)=>c.pipe(De(l(r=>n(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:r}),TM,`Extension command`)));return Object.freeze({createSession:e=>c.pipe(Wt(()=>{let r=zn({requestId:e});return l(e=>n(`${t}/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({requestId:r}),signal:e}),RM,`Session creation`)})),deleteSession:e=>c.pipe(Wt(()=>{let r=Un(e);return l(e=>n(`${t}/sessions/${encodeURIComponent(r)}`,{method:`DELETE`,signal:e}),LM,`Session deletion`)})),listSessions:e=>c.pipe(Wt(()=>{let r=new URLSearchParams;e!==void 0&&r.set(`after`,tn(e));let i=r.size===0?``:`?${r.toString()}`;return l(e=>n(`${t}/sessions${i}`,{signal:e}),PM,`Session discovery`)})),extensions:Object.freeze({list:c.pipe(De(l(e=>n(`${t}/extensions`,{signal:e}),wM,`Extension list`))),resume:e=>c.pipe(De(l(r=>n(`${t}/extensions/${encodeURIComponent(e)}/resume`,{method:`POST`,signal:r}),CM,`Extension resume`))),call:(e,n,r)=>u(`${t}/extensions/${encodeURIComponent(e)}/commands/${encodeURIComponent(n)}`,r)}),session:r=>{let s=Un(r),d=tN(t,s),f=`${d}/events`;function p(e){return c.pipe(De(l(t=>n(`${d}/command`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:e}),signal:t}),e.type===`prompt`||e.type===`compact`?EM:e.type===`cancel`?DM:e.type===`fork`?kM:()=>void 0,`Command`)))}return Object.freeze({command:p,withdraw:e=>c.pipe(De(l(t=>n(`${d}/withdraw`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({requestId:e}),signal:t}),dM,`Request withdrawal`))),abort:p({type:`abort`}),send:(e,t)=>xt(()=>t?.requestId??ar()).pipe(Wt(n=>{let r={type:`prompt`,delivery:t?.delivery??`steer`,requestId:n,text:e};return p(t?.images===void 0?r:{...r,images:t.images}).pipe(ne(e=>e.requestId===n?e:new Br(e.boundary,e.cause,e.message,n)))})),cancel:e=>p({type:`cancel`,...e}),latestPending:c.pipe(De(l(e=>n(`${d}/pending/latest`,{signal:e}),OM,`Newest pending prompt`))),modelPreference:Object.freeze({read:c.pipe(De(l(e=>n(`${d}/model-preference`,{signal:e}),Kn,`Model preference read`))),set:e=>c.pipe(De(l(t=>n(`${d}/model-preference`,{signal:t,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),()=>void 0,`Model preference set`)))}),extension:e=>Object.freeze({call:(t,n)=>u(`${d}/extensions/${encodeURIComponent(e)}/commands/${encodeURIComponent(t)}`,n)}),read:e=>c.pipe(De(Jt({try:()=>Hn(e),catch:e=>e instanceof Br?e:qM(`Read options are invalid`)})),Wt(({limit:e,before:t,includeSandboxFailures:r})=>{let i=new URLSearchParams({limit:String(e)});return t!==void 0&&i.set(`before`,t),r===!0&&i.set(`includeSandboxFailures`,`true`),l(e=>n(`${d}?${i.toString()}`,{signal:e}),AM,`Session read`)})),subscribe:t=>Jr(c.pipe(De(Jt({try:()=>hn(t),catch:e=>e instanceof Br?e:qM(`Subscribe options are invalid`)})),x(({after:t,includeSandboxFailures:n})=>rN(nN(f,t,n===!0),o,a,e.eventSource)))),watch:t=>iN(t?.includeSandboxFailures===!0?`${f}?includeSandboxFailures=true`:f,i,c,o,a,e.eventSource)})},close:qe(()=>s?I:(s=!0,o.open.pipe(De(Rt([...i],e=>br(e,Ln),{discard:!0})),De(Rt([...a],e=>$M(e,a),{discard:!0})))))})}function sN(e){return WM(oN(e),e.baseUrl.replace(/\/+$/u,``))}tr(ir);function cN(e,t){if(t===void 0)return{status:`unavailable`};if(t.status===`stopped`)return{status:`stopped`,reason:t.reason};if(t.value===null||e.projection===null)return{status:`running`,value:null};let n=tr(e.projection.schema)(t.value);return n._tag===`Success`?{status:`running`,value:n.success}:{status:`stopped`,reason:`Extension projection does not match this client`}}var lN=cn.check(sn(0)),uN=cn.check(Qr(0)),dN=ai(V,On),fN=U({id:lv,label:cv,input:W(dN)}),pN=U({...dv.fields,actions:W(H(fN).check(K(8)))}),mN=dv.check(Gn(e=>e.open===void 0,{message:`Client chips are display only`})),hN=U({...pN.fields,inspection:An(U({commandId:lv,title:cv,rows:H(mN).check(K(200))}))}),gN=U({id:lv,order:Pn.check(rn()),row:mN,compact:W(cv)}),_N=U({id:lv,sequence:uN,at:lN,commandId:wn(V),afterSequence:An(lN),rows:H(pN).check(K(200))}).check(Gn(e=>e.id===String(e.sequence),{message:`Client event identity must equal its sequence`}),Gn(e=>e.afterSequence===void 0||e.commandId===null,{message:`A client event cannot have both command and position anchors`})),vN=e=>new Set(e).size===e.length,yN=U({chips:H(gN).check(K(4)),panel:H(hN).check(K(16)),timeline:U({cells:H(_N).check(K(32)),omitted:lN}),waiting:wn(U({summary:cv,cancel:fN}))}).check(Gn(e=>e.chips.length+e.panel.reduce((e,t)=>e+1+(t.inspection?.rows.length??0),0)+e.timeline.cells.reduce((e,t)=>e+t.rows.length,0)<=200,{message:`Client contribution exceeds 200 rows`}),Gn(e=>vN(e.chips.map(e=>e.id))&&vN(e.panel.map(e=>e.id))&&e.panel.every(e=>vN((e.inspection?.rows??[]).map(e=>e.id)))&&vN(e.timeline.cells.map(e=>e.id))&&e.timeline.cells.every(e=>vN(e.rows.map(e=>e.id))),{message:`Client contribution contains duplicate identities`})),bN=U({protocol:B(`shiitake.client/v1`),id:_r,promptPresentation:An(B(`footer`)),attach:An(Mn(e=>st(e))),contribute:An(Mn(e=>st(e)))}).check(Gn(e=>e.attach!==void 0||e.contribute!==void 0,{message:`Client entry requires attach or contribute`})),xN=Pr(bN,{onExcessProperty:`error`});function SN(e,t){if(t.contribute!==void 0&&e.projection===null)throw Error(`Client contribution requires a projection`);let n={protocol:`shiitake.client/v1`,id:e.id};t.promptPresentation!==void 0&&Object.assign(n,{promptPresentation:t.promptPresentation});let r=t.attach,i=t.contribute;return r!==void 0&&Object.assign(n,{attach:e=>kr(()=>r(e))}),i!==void 0&&Object.assign(n,{contribute:t=>i(cN(e,t))}),Object.freeze(xN(n))}var CN=`whistle.catalog/v1`,wN=128,TN=16,EN=ot({protocol:Oe(CN),commands:_e(Ra).max(wN)}).strict().transform(e=>{let t=new Set;for(let n of e.commands){if(t.has(n.id))throw Error(`Catalog command ${n.id} is repeated`);t.add(n.id)}return Object.freeze({protocol:CN,commands:Object.freeze(e.commands)})}),DN=e=>EN.parse(e),ON=jt(`type`,[ot({type:Oe(`done`),notice:Ka.optional(),result:Ca.optional()}).strict(),ot({type:Oe(`prompt`),prompt:Ga,notice:Ka.optional(),next:ot({arguments:wa,answer:z().min(1).max(120)}).strict()}).strict()]).transform(e=>Object.freeze(e)),kN=e=>ON.parse(e);function AN(e,t){if(t.arguments!==void 0)try{return Ea(t.arguments)}catch{throw new vi(`invalid_arguments`,`${e.title}: arguments must be an object`)}let n=e.action?.presentation,r=t.interaction;if(r===void 0||n===void 0)return{};if(n.type===`choice`){let t=n.options;return r.prompt({type:`choice`,message:e.title,options:t.map((e,t)=>{let n={value:String(t),label:e.label};return e.description===void 0?n:{...n,description:e.description}})}).then(e=>Ea(t[Number(e)]?.value))}if(n.type===`confirmation`){let e={type:`confirmation`,message:n.message};return n.confirmLabel!==void 0&&(e.confirmLabel=n.confirmLabel),n.cancelLabel!==void 0&&(e.cancelLabel=n.cancelLabel),r.prompt(e).then(e=>e?{}:void 0)}return{}}function jN(e,t){return e.commands.map(e=>{let{availability:n,...r}=e,i={id:r.id,title:r.title,category:r.category,handler:async n=>{let r=n.signal??new AbortController().signal,i=n.interaction,a=await AN(e,n);if(a===void 0)return{cancelled:!0};let o=new Map;for(let n=0;n<TN;n+=1){r.throwIfAborted();let n=a,s=o,c=async()=>{let a={...n};try{if(i!==void 0)for(let[e,t]of s)Object.defineProperty(a,e,{value:await i.prompt(t),enumerable:!0,configurable:!0});let n=kN(await t(e.id,a,r)),o=new Map;if(n.type===`done`)return{reply:n,secrets:o};let c={...n.next.arguments};for(let[e,t]of s)e!==n.next.answer&&Object.hasOwn(c,e)&&o.set(e,t),Reflect.deleteProperty(c,e);return n.prompt.type===`text`&&n.prompt.secret===!0&&(o.set(n.next.answer,n.prompt),Reflect.deleteProperty(c,n.next.answer)),{reply:{...n,next:{...n.next,arguments:c}},secrets:o}}finally{for(let e of s.keys())Reflect.deleteProperty(a,e)}},{reply:l,secrets:u}=i===void 0?await c():await i.run(c);if(l.notice!==void 0&&i?.notify(l.notice),l.type===`done`)return l.result;if(i===void 0)throw new vi(`interaction_required`,`${e.title} needs a person to answer: ${l.prompt.message}`);if(o=u,l.prompt.type===`text`&&l.prompt.secret===!0){a=l.next.arguments;continue}let d=await i.prompt(l.prompt);a={...l.next.arguments,[l.next.answer]:d}}throw new vi(`flow_too_long`,`${e.title} asked too many questions.`)}};return r.description!==void 0&&(i.description=r.description),r.projections!==void 0&&(i.projections=r.projections),r.action!==void 0&&(i.action=r.action),n!==void 0&&(i.availability=()=>n),i})}var MN=Pr(yN,{onExcessProperty:`error`});function NN(e){return[...e.panel.flatMap(e=>e.actions??[]),...e.timeline.cells.flatMap(e=>e.rows.flatMap(e=>e.actions??[])),...e.waiting===null?[]:[e.waiting.cancel]]}function PN(e,t){let n=NN(e),r=e.panel.flatMap(e=>e.inspection===void 0?[]:[e.inspection]);if(n.length===0&&r.length===0)return;if(t?.status!==`running`||t.catalog===void 0)throw Error(`Client row actions require a running advertised catalog`);let i=DN(t.catalog),a=new Set(i.commands.map(e=>e.id));for(let e of r)if(!a.has(e.commandId))throw Error(`Client inspection ${e.commandId} is not advertised by its entry`);for(let e of n)if(!a.has(e.id))throw Error(`Client row action ${e.id} is not advertised by its entry`)}function FN(e,t){try{let n=MN(e(t));return PN(n,t),{status:`admitted`,value:n}}catch(e){return{status:`failed`,error:e instanceof Error?e:Error(`Client contribution failed`,{cause:e})}}}function IN(e,t){let n=e.map(e=>xN(e));if(new Set(n.map(e=>e.id)).size!==n.length)throw Error(`Duplicate client contribution entry`);let r=new Map,i=new Map,a=new Map,o=new Set,s=[],c=!1;return{snapshot:()=>s,subscribe:e=>c?()=>void 0:(o.add(e),()=>{o.delete(e)}),update:e=>{if(c)return;let l=!1;for(let o of n){if(o.contribute===void 0)continue;let n=e[o.id];if(r.has(o.id)&&r.get(o.id)===n)continue;r.set(o.id,n),i.delete(o.id),l=!0;let s=FN(o.contribute,n);if(s.status===`admitted`)i.set(o.id,{entryId:o.id,value:s.value}),a.delete(o.id);else{let{error:e}=s,n=`${e.name}: ${e.message}`;a.get(o.id)!==n&&t(o.id,e),a.set(o.id,n)}}if(l){s=n.flatMap(e=>{let t=i.get(e.id);return t===void 0?[]:[t]});for(let e of o)e()}},dispose:()=>{c=!0,r.clear(),a.clear(),i.clear(),s=[];for(let e of o)e();o.clear()}}}function LN(e){let t=new Set,n={title:e.title,status:`working`,links:[],retryable:!1},r,i,a=0,o,s=e=>{n={...n,...e};for(let e of t)e()},c=()=>n.message?.type===`progress`?n.message:{type:`progress`,message:e.title},l=t=>{i=void 0,o=void 0,t.status===`failed`?s({status:`failed`,failure:t.message,prompt:void 0,retryable:!1}):s({status:t.status===`handled`?`done`:`cancelled`,prompt:void 0,retryable:!1}),e.onEnd?.(t)};return{snapshot:()=>n,subscribe:e=>(t.add(e),()=>{t.delete(e)}),begin:()=>{r?.abort();let t=new AbortController;r=t;let u=t.signal;i=void 0,o=void 0,n={title:e.title,status:`working`,links:[],retryable:!1},s({});let d=()=>r===t&&!u.aborted,f=!1;return{interaction:{signal:u,run:async e=>{for(;;){u.throwIfAborted();try{return await e()}catch(e){if(!d()||!f)throw e;await new Promise((t,n)=>{let r=()=>{o=void 0,n(Error(`Interaction cancelled`,{cause:u.reason}))},i=()=>{!d()||o!==i||(o=void 0,u.removeEventListener(`abort`,r),s({status:`working`,message:c(),failure:void 0,retryable:!1,handoff:void 0}),t())};u.addEventListener(`abort`,r,{once:!0}),o=i,s({status:`failed`,failure:e instanceof Error?e.message:`Operation failed`,prompt:void 0,retryable:!0})})}}},prompt:(e,t)=>{let n=t?.signal===void 0?u:AbortSignal.any([u,t.signal]);n.throwIfAborted();let r=qa(e);f=!0;let o=Xa(e),c=Promise.withResolvers(),l=++a,p=()=>{i?.sequence===l&&(i=void 0,d()&&s({status:`working`,prompt:void 0})),c.reject(n.reason)};return n.addEventListener(`abort`,p,{once:!0}),i={sequence:l,request:r,resolve:e=>{let t=o(e);return t.kind!==`invalid`&&(n.removeEventListener(`abort`,p),c.resolve(t.value),!0)}},s({status:`prompting`,prompt:{sequence:l,request:r}}),c.promise},notify:e=>{if(r!==t)return;let i=Ja(e);if(u.aborted){(i.type===`info`||i.type===`success`)&&s({closing:i});return}(i.type===`handoff`||i.type===`progress`)&&(f=!0),i.type===`handoff`?s({handoff:i}):s({message:i,links:i.type===`info`?i.links??[]:n.links})}},settle:e=>{r===t&&(r=void 0,l(u.aborted?{status:`cancelled`}:e))}}},retry:()=>o?.(),answer:(e,t)=>{let n=i;return n?.sequence!==e||!n.resolve(t)?!1:(i=void 0,s({status:`working`,message:c(),prompt:void 0}),!0)},cancel:()=>{if(r!==void 0){s({prompt:void 0}),r.abort(Error(`Interaction cancelled`));return}n.status===`failed`&&l({status:`cancelled`})}}}function RN(){let e={},t=0,n,r=new Set,i=new Set,a=e=>{for(let t of i)t(e)},o=e=>{e.type===`info`&&a({variant:`info`,message:e.message})},s=t=>{e=t;for(let e of r)e()},c=t=>{e.open?.key===t&&s({...e,open:void 0})},l=({title:r})=>{let i=++t,a=!1,l=!1,u=LN({title:r,onEnd:t=>{n=t.status;let r=u.snapshot().message;if(!a){t.status===`failed`?s({...e,notice:{tone:`error`,message:t.message}}):r!==void 0&&o(r);return}if(t.status===`handled`&&l&&r!==void 0&&r.type!==`progress`)return;let d=u.snapshot().closing;t.status===`cancelled`&&d!==void 0&&o(d),t.status===`handled`&&r!==void 0&&o(r),t.status!==`failed`&&c(i)}}),d=u.subscribe(()=>{let t=u.snapshot();if(t.retryable&&(l=!0),a||t.prompt===void 0&&t.handoff===void 0&&t.message?.type!==`progress`)return;a=!0;let n=e.open;s({...e,open:{key:i,host:u},notice:void 0}),n?.host.cancel()}),f=u.begin();return{interaction:f.interaction,settle:e=>{d(),f.settle(e)}}};return{snapshot:()=>e,subscribe:e=>(r.add(e),()=>{r.delete(e)}),close:()=>{let t=e.open;t!==void 0&&(s({...e,open:void 0}),t.host.cancel())},inspect:t=>{s({...e,inspection:t})},report:t=>{n=void 0,s({...e,notice:t})},toast:a,subscribeToasts:e=>(i.add(e),()=>{i.delete(e)}),attach:e=>e(l),lastEnd:()=>n}}function zN(e){return`init`in e}function BN(e){return typeof e.write==`function`}function VN(e){return!!e.onMount}function HN(e){return`v`in e||`e`in e}function UN(e){if(`e`in e)throw e.e;return e.v}function WN(e){return typeof e?.then==`function`}function GN(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function KN(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function qN(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function JN(e){return!!e.INTERNAL_onInit}var YN=(e,t,n,...r)=>n.read(...r),XN=(e,t,n,...r)=>n.write(...r),ZN=(e,t,n)=>n.INTERNAL_onInit(t),QN=(e,t,n,r)=>n.onMount?.call(n,r),$N=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),JN(n)&&s(e,t,n)}return a},eP=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},tP=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of qN(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},nP=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(HN(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!HN(n)){if(zN(r))g(e,t,r,r.init);else throw Error(`no atom init`)}return UN(n)}let o=p(e,t,r);try{return UN(o)}finally{S.delete(r),y.d.set(r,o.n),WN(y.v)&&KN(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,O={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&BN(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},k=y.n,A=o.get(n)===k;try{let i=l(e,t,n,T,O);if(g(e,t,n,i),WN(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(GN(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==k&&A&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},rP=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of qN(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},iP=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>UN(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!zN(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},aP=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},oP=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),BN(n)&&VN(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},sP=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},cP=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(WN(r))for(let a of o.d.keys())KN(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,WN(c)&&a(e,t,c))},lP=(e,t,n)=>{let r=e[14];return UN(r(e,t,n))},uP=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},dP=(e,t,n,r)=>{let i=e[12],a=e[13],o=e[18],s=e[19],c=o(e,t,n).l;return c.add(r),a(e,t),i(e,t),()=>{c.delete(r),s(e,t,n),a(e,t),i(e,t)}},fP=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},pP=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},mP=new WeakMap;function hP(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,void 0,new WeakMap,fP,pP,[0]].map((t,n)=>e[n]||t);mP.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var gP=0;function $(e,t){let n=`atom${++gP}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=_P,r.write=vP),t&&(r.write=t),r}function _P(e){return e(this)}function vP(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}function yP(){return hP()}var bP=$(new ws),xP=(e,t,n)=>e?.suspense&&SP(t),SP=(e,t)=>e.isPending&&!0,CP=({result:e,throwOnError:t,query:n})=>e.isError&&!e.isFetching&&wP(t,[e.error,n]);function wP(e,t){return typeof e==`function`?e(...t):!!e}var TP=e=>e.suspense&&typeof e.staleTime!=`number`?{...e,staleTime:1e3}:e;function EP(e,t,n=e=>e(bP)){let r=$(0),i=$(n),a=$(()=>new WeakMap),o=$(t=>{let n=t(i),r=e(t),o=n.defaultQueryOptions(r),s=t(a).get(n);return o._optimisticResults=`optimistic`,s&&s.setOptions(o),TP(o)}),s=$(e=>{let n=e(i),r=e(o),s=e(a),c=s.get(n);if(c)return c;let l=new t(n,r);return s.set(n,l),l}),c=$(e=>{let t=e(s),n=e(o),r=$(t.getOptimisticResult(n));return r.onMount=e=>{let n=t.subscribe(qo.batchCalls(e));return()=>{t.getCurrentResult().isError&&t.getCurrentQuery().reset(),n()}},r});return $(e=>{e(r);let t=e(s),n=e(o),i=e(e(c));if(xP(n,i))return t.fetchOptimistic(n);if(CP({result:i,query:t.getCurrentQuery(),throwOnError:n.throwOnError}))throw i.error;return i},(e,t)=>{t(r,e=>e+1)})}function DP(e,t=e=>e(bP)){return EP(e,ls,t)}function OP(e,t=e=>e(bP)){return EP(e,hs,t)}function kP(e,t=e=>e(bP)){let n=Symbol(),r=$(n=>{let r=t(n),i=e(n);return r.defaultMutationOptions(i)}),i=$(()=>new WeakMap),a=$(e=>{let a=e(r),o=t(e),s=e(i),c=s.get(o);if(c)return c[n]=!0,c.setOptions(a),delete c[n],c;let l=new bs(o,a);return s.set(o,l),l}),o=$(e=>{let t=e(a),n=$(t.getCurrentResult());return n.onMount=e=>(t.subscribe(qo.batchCalls(e)),()=>{t.reset()}),n}),s=$(e=>{let t=e(a);return(e,n)=>{t.mutate(e,n).catch(AP)}});return $(e=>{let t=e(a),n=e(e(o)),r=e(s);if(n.isError&&wP(t.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:r,mutateAsync:n.mutate}})}function AP(){}var jP=160,MP=200;function NP(e,t){return e.replace(/\s+/gu,` `).trim().slice(0,t)}function PP({activity:e,terminals:t}){let n;for(let e of t)(n===void 0||e.sequence>n.sequence)&&(n=e);return n===void 0?{kind:`idle`}:e.lastModelChoiceSequence!==null&&e.lastModelChoiceSequence>n.sequence?{kind:`waiting_for_you`}:n.outcome===`failed`||n.outcome===`interrupted`?{kind:`error`,cause:NP(n.diagnostic??(n.outcome===`interrupted`?`Run was interrupted`:`Run failed without a diagnostic`),MP)}:{kind:`waiting_for_you`}}function FP(e){let{activity:t,progress:n}=e,{queue:r}=t;return r.state===`idle`?PP(e):t.cancellationRequested?{kind:`cancelling`}:r.state===`queued`?{kind:`queued`,queuedCommandId:r.commandId,runningWork:r.runningWork}:t.compaction===null?t.retry===null?t.activeTool===null?{kind:n===null||n.text===``?`thinking`:`responding`}:{kind:`running_tool`,tool:t.activeTool}:{kind:`retrying`,attempt:t.retry.attempt,maxAttempts:t.retry.maxAttempts,cause:NP(t.retry.errorMessage,jP),nextRetryAt:t.retry.scheduledAt+t.retry.delayMs}:{kind:`compacting`,trigger:t.compaction.trigger}}function IP(e,t){return e===null||t===null?e===t:e.kind===`session`&&t.kind===`session`?e.sessionId===t.sessionId&&e.commandId===t.commandId:e.kind===`host`&&t.kind===`host`&&e.lane===t.lane&&e.jobId===t.jobId}function LP(e){let t=e.runningWork;return t===null?`Queued for host`:t.kind===`session`?`Waiting for Session ${NP(t.sessionId,256)}`:`Waiting for host job ${NP(t.lane,256)} · ${NP(t.jobId,256)}`}function RP(e,t){return e.kind===t.kind?e.kind===`queued`&&t.kind===`queued`?e.queuedCommandId===t.queuedCommandId&&IP(e.runningWork,t.runningWork):e.kind===`running_tool`&&t.kind===`running_tool`?e.tool===t.tool:e.kind===`compacting`&&t.kind===`compacting`?e.trigger===t.trigger:e.kind===`retrying`&&t.kind===`retrying`?e.attempt===t.attempt&&e.maxAttempts===t.maxAttempts&&e.cause===t.cause&&e.nextRetryAt===t.nextRetryAt:e.kind===`error`&&t.kind===`error`?e.cause===t.cause:!0:!1}function zP(e){switch(e.kind){case`cancelling`:case`queued`:case`retrying`:return e.kind;case`responding`:return`streaming`;case`thinking`:case`running_tool`:case`compacting`:return`thinking`;case`idle`:case`waiting_for_you`:case`error`:return`idle`}}var BP=new WeakMap;function VP(e){let t=BP.get(e);if(t!==void 0)return t;let n=new Set(e.map(({id:e})=>e));return BP.set(e,n),n}function HP(e,t){if(t.length===0)return e;let n=new Set(e.map(({id:e})=>e)),r=t.filter(({id:e})=>!n.has(e));return r.length===0?e:[...e,...r].sort((e,t)=>e.sequence-t.sequence)}function UP(e,t){return HP(e,t)}function WP(e,t){return e===null||VP(t).has(e.messageId)?null:e}function GP(e,t){let n=[],r=new Map;for(let i of[...e,...t])r.get(i.commandId)===void 0&&(r.set(i.commandId,n.length),n.push(i));return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function KP(e,t){return HP(e,t)}function qP(e,t){return HP(e,t)}function JP(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.extensionId===r?.extensionId&&e.id===r.id&&e.kind===r.kind&&e.summary===r.summary&&e.since===r.since&&e.expiresAt===r.expiresAt})}function YP(e,t){return e.total===t.total&&e.hasMore===t.hasMore&&e.prompts.length===t.prompts.length&&e.prompts.every((e,n)=>{let r=t.prompts[n];return r!==void 0&&e.commandId===r.commandId&&e.delivery===r.delivery&&e.text===r.text})}function XP(e,t){return e===t||e.queue.state===t.queue.state&&(e.queue.state===`idle`||t.queue.state===`idle`||e.queue.commandId===t.queue.commandId&&(e.queue.state!==`queued`||t.queue.state!==`queued`||IP(e.queue.runningWork,t.queue.runningWork)))&&e.cancellationRequested===t.cancellationRequested&&e.activeTool===t.activeTool&&e.lastModelChoiceSequence===t.lastModelChoiceSequence&&(e.retry===t.retry||e.retry!==null&&t.retry!==null&&e.retry.attempt===t.retry.attempt&&e.retry.maxAttempts===t.retry.maxAttempts&&e.retry.delayMs===t.retry.delayMs&&e.retry.errorMessage===t.retry.errorMessage&&e.retry.scheduledAt===t.retry.scheduledAt)&&(e.compaction===t.compaction||e.compaction!==null&&t.compaction!==null&&e.compaction.trigger===t.compaction.trigger)}function ZP(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function QP(e,t){if(t.kind===`reset`)return{...t.baseline,terminals:GP([],t.baseline.terminals),compactions:KP([],t.baseline.compactions??[]),compactionNotices:qP([],t.baseline.compactionNotices??[])};if(t.kind===`tool_output`){let n=new Set(e.messages.flatMap(e=>e.value.role===`toolResult`?[e.value.toolCallId]:[])),r=t.toolOutput.filter(e=>!n.has(e.toolCallId)).map(t=>{let n=e.toolOutput.find(e=>e.toolCallId===t.toolCallId);return n!==void 0&&n.revision>t.revision?n:t});return{...e,activity:t.activity,toolOutput:r}}if(t.kind===`progress`){let n=VP(e.messages).has(t.progress.messageId),r=e.progress,i=r!==null&&r.messageId===t.progress.messageId,a=i&&r.revision>t.progress.revision;if(n||a)return e;let o=XP(e.activity,t.activity)?e.activity:t.activity;return i&&r.revision===t.progress.revision?o===e.activity?e:{...e,activity:o}:{...e,progress:t.progress,activity:o}}let n=YP(e.pending,t.pending)?e.pending:t.pending,r=UP(e.messages,t.messages),i=new Set(r.flatMap(e=>e.value.role===`toolResult`?[e.value.toolCallId]:[])),a=e.toolOutput.filter(e=>t.activity.queue.state!==`idle`&&!i.has(e.toolCallId)),o=GP(e.terminals,t.terminals),s=e.compactions??[],c=KP(s,t.compactions??[]),l=e.compactionNotices??[],u=qP(l,t.compactionNotices??[]),d=t.activity.queue.state===`idle`?null:WP(e.progress,r),f=t.context===void 0||e.context?.tokens===t.context.tokens&&e.context.window===t.context.window?e.context:t.context;if(r===e.messages&&o===e.terminals&&c===s&&u===l&&d===e.progress&&a.length===e.toolOutput.length&&n===e.pending&&ZP(t.extensions,e.extensions)&&JP(t.attention,e.attention)&&t.cursor===e.cursor&&XP(t.activity,e.activity)&&f===e.context)return e;let p={...e,cursor:t.cursor,messages:r,terminals:o,compactions:c,compactionNotices:u,progress:d,toolOutput:a,activity:XP(e.activity,t.activity)?e.activity:t.activity,pending:n,attention:JP(t.attention,e.attention)?e.attention:t.attention,extensions:ZP(t.extensions,e.extensions)?e.extensions:t.extensions};return f===void 0?p:{...p,context:f}}var $P=Re(z(),wt());function eF(e){return e.text.trim()!==``||(e.thinking?.trim()??``)!==``}var tF=[[`*** Add File: `,`add`],[`*** Delete File: `,`delete`],[`*** Update File: `,`update`]],nF=/^\*\*\* Move to: (.+)$/u;function rF(e){if(e.startsWith(`+`))return{kind:`add`,text:e.slice(1)};if(e.startsWith(`-`))return{kind:`remove`,text:e.slice(1)};if(e.startsWith(` `))return{kind:`context`,text:e.slice(1)}}function iF(e){let t=[],n;for(let r of e.split(`
33
+ `)){let e=tF.find(([e])=>r.startsWith(e));if(e!==void 0){let[i,a]=e;n={operation:a,path:r.slice(i.length).trim(),hunks:[]},t.push(n);continue}if(n===void 0)continue;let i=nF.exec(r);if(i!==null){n.moveTo=(i[1]??``).trim();continue}if(r.startsWith(`@@`)){let e=r.slice(2).trim();n.hunks.push(e===``?{lines:[]}:{context:e,lines:[]});continue}let a=rF(r);if(a===void 0)continue;let o=n.hunks.at(-1)??{lines:[]};n.hunks.length===0&&n.hunks.push(o),o.lines.push(a)}return t}var aF=131072,oF=524288,sF=new TextEncoder,cF=Qe(()=>z().min(1).max(4096).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`));function lF(e=0){return z().min(e).refine(e=>sF.encode(e).byteLength<=aF,`Text exceeds the ${String(aF)}-byte Files bound`)}Qe(()=>yt({path:cF,offset:Fe().int().min(0).default(0),limit:Fe().int().min(4).max(aF).default(aF)}));var uF=Qe(()=>yt({computerId:z().min(1).max(256),path:cF.refine(e=>e.startsWith(`/`),`Computer file paths must be absolute`)})),dF=me([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),fF=Qe(()=>yt({path:cF,image:yt({mimeType:dF,data:Ce(),bytes:Fe().int().min(1).max(oF)}),file:uF.exactOptional()})),pF=Qe(()=>yt({path:cF,content:lF(),offset:Fe().int().min(0),nextOffset:Fe().int().min(0).nullable(),truncated:a(),file:uF.exactOptional()})),mF=Qe(()=>yt({path:cF,image:yt({ref:z().min(1).max(32),mimeType:dF,bytes:Fe().int().min(1).max(oF)})}));Qe(()=>Ee([pF,mF]));var hF=Qe(()=>Ee([pF,fF])),gF=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends gF{};function _F(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function vF(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function yF(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function bF(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function xF(e,t){return yF(e,t,``)}function SF(e,t){return bF(e,t,``)}function CF(e,t){return t.slice(0,wF(e,t))}function wF(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function TF(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function EF(e,t){if(t)return OF(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function DF(e,t){if(t)return OF(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function OF(e,t){if(!t)return[DF(e),EF(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=TF(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var kF=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,AF=RegExp(`[${kF}]+|\\s+|[^${kF}]`,`ug`);new class extends gF{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=TF(e,r)}else n=e.match(AF)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&jF(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&jF(n,i,r,null,t.intlSegmenter),e}};function jF(e,t,n,r,i){if(t&&n){let[a,o]=OF(t.value,i),[s,c]=OF(n.value,i);if(e){let r=_F(a,s);e.value=bF(e.value,s,r),t.value=xF(t.value,r),n.value=xF(n.value,r)}if(r){let e=vF(o,c);r.value=yF(r.value,c,e),t.value=SF(t.value,e),n.value=SF(n.value,e)}}else if(n){if(e){let e=DF(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=DF(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=DF(r.value,i),[a,o]=OF(t.value,i),s=_F(n,a);t.value=xF(t.value,s);let c=vF(xF(n,s),o);t.value=SF(t.value,c),r.value=yF(r.value,n,c),e.value=bF(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=DF(r.value,i),n=CF(EF(t.value,i),e);t.value=SF(t.value,n)}else if(e){let n=CF(EF(e.value,i),DF(t.value,i));t.value=xF(t.value,n)}}new class extends gF{tokenize(e){let t=RegExp(`(\\r?\\n)|[${kF}]+|[^\\S\\n\\r]+|[^${kF}]`,`ug`);return e.match(t)||[]}};var MF=new class extends gF{constructor(){super(...arguments),this.tokenize=PF}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
34
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
35
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
36
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
37
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function NF(e,t,n){return MF.diff(e,t,n)}function PF(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
38
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function FF(e){return e==`.`||e==`!`||e==`?`}new class extends gF{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(FF(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends gF{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends gF{constructor(){super(...arguments),this.tokenize=PF}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(IF(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function IF(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=IF(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=IF(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends gF{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function LF(e){let t=e.split(/\n/),n=[],r=0;function i(){let e={};for(n.push(e);r<t.length;){let n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;let i=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(n);i&&(e.index=n.substring(i[0].length).trim()),r++}for(a(e),a(e),e.hunks=[];r<t.length;){let n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(o());else if(n)throw Error(`Unknown line `+(r+1)+` `+JSON.stringify(n));else r++}}function a(e){let n=/^(---|\+\+\+)\s+/.exec(t[r]);if(n){let i=n[1],a=t[r].substring(3).trim().split(` `,2),o=(a[1]||``).trim(),s=a[0].replace(/\\\\/g,`\\`);s.startsWith(`"`)&&s.endsWith(`"`)&&(s=s.substr(1,s.length-2)),i===`---`?(e.oldFileName=s,e.oldHeader=o):(e.newFileName=s,e.newHeader=o),r++}}function o(){let e=r,n=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+n[1],oldLines:n[2]===void 0?1:+n[2],newStart:+n[3],newLines:n[4]===void 0?1:+n[4],lines:[]};i.oldLines===0&&(i.oldStart+=1),i.newLines===0&&(i.newStart+=1);let a=0,o=0;for(;r<t.length&&(o<i.oldLines||a<i.newLines||t[r]?.startsWith(`\\`));r++){let n=t[r].length==0&&r!=t.length-1?` `:t[r][0];if(n===`+`||n===`-`||n===` `||n===`\\`)i.lines.push(t[r]),n===`+`?a++:n===`-`?o++:n===` `&&(a++,o++);else throw Error(`Hunk at line ${e+1} contained invalid line ${t[r]}`)}if(!a&&i.newLines===1&&(i.newLines=0),!o&&i.oldLines===1&&(i.oldLines=0),a!==i.newLines)throw Error(`Added line count did not match for hunk at line `+(e+1));if(o!==i.oldLines)throw Error(`Removed line count did not match for hunk at line `+(e+1));return i}for(;r<t.length;)i();return n}var RF={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function zF(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;NF(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(NF(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||VF(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
39
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function BF(e,t){if(t||=RF,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>BF(e,t)).join(`
40
+ `)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t];r.oldLines===0&&--r.oldStart,r.newLines===0&&--r.newStart,n.push(`@@ -`+r.oldStart+`,`+r.oldLines+` +`+r.newStart+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
41
+ `)+`
42
+ `}function VF(e){let t=e.endsWith(`
43
+ `),n=e.split(`
44
+ `).map(e=>e+`
45
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var HF=512,UF=256,WF=100;`${String(oF/1024)}`,new TextEncoder;var GF=Fe().int().min(1).max(UF).default(WF),KF=z().min(1).max(HF);Qe(()=>yt({path:cF.default(`.`),limit:GF})),Qe(()=>yt({path:cF.default(`.`),pattern:KF,limit:GF})),Qe(()=>yt({path:cF.default(`.`),pattern:KF,include:KF.optional(),regex:a().default(!1),ignoreCase:a().default(!1),limit:GF}));var qF=Qe(()=>yt({path:cF,type:me([`file`,`directory`,`symlink`]).exactOptional(),line:Fe().int().positive().exactOptional(),text:z().exactOptional()}));Qe(()=>yt({path:cF,results:_e(qF).max(UF),truncated:me([`limit`,`scan`]).nullable()})),Qe(()=>yt({path:cF,oldText:lF(1),newText:lF()}));var JF=Qe(()=>yt({path:cF,bytes:Fe().int().nonnegative(),diff:z(),firstChangedLine:Fe().int().positive().nullable(),unifiedPatch:z().nullable(),unifiedPatchBytes:Fe().int().nonnegative(),unifiedPatchAddedLines:Fe().int().nonnegative(),unifiedPatchRemovedLines:Fe().int().nonnegative(),unifiedPatchTruncated:a()})),YF=Qe(()=>yt({status:Oe(`failed`),error:yt({kind:me([`not-found`,`ambiguous`,`file-too-large`,`partial-character`,`not-text`,`unchanged`,`conflict`]),path:cF,message:z()})}));Ee([JF,YF]),new Intl.Segmenter(void 0,{granularity:`grapheme`});var XF=`Search skips .git and gitignored paths.`;`${XF}`,`${XF}`,`${XF}`;function ZF({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}var QF=ZF();function $F(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(QF,``)}function eI(e,t){console.error(JSON.stringify({event:`parakeet_operation_failed`,operation:e,causeKind:t instanceof Error?`error`:`non_error`}),on(t))}function tI(e){return e===`error`?`error`:e===`unknown`?`neutral`:e===`running`?`info`:`success`}var nI={code:`computer`,command:`run`,edit:`write`,other:`working`,read:`read`,search:`search`},rI=40,iI=6,aI=400,oI=72,sI=new Map([[`apply_patch`,`edit`],[`bash`,`command`],[`edit`,`edit`],[`execute`,`code`],[`glob`,`search`],[`grep`,`search`],[`list`,`search`],[`ls`,`search`],[`read`,`read`],[`write`,`edit`]]),cI={code:[`Ran script`,`Running script`],command:[`Ran`,`Running`],edit:[`Updated`,`Updating`],other:[`Called`,`Calling`],read:[`Read`,`Reading`],search:[`Searched`,`Searching`]},lI=ht({path:z()}),uI=ht({file_path:z()}),dI=ht({command:z()}),fI=ht({code:z()}),pI=ht({patch:z()}),mI=ht({pattern:z()}),hI=ht({oldText:z(),newText:z()}),gI=ht({content:z()}),_I=z(),vI=ht({content:z(),offset:Fe().int().min(0).optional()}),yI=ht({matches:_e(ht({path:z(),line:Fe().int(),text:z()}))}),bI=ht({stdout:z().optional(),stderr:z().optional(),exitCode:Fe().int().nullable().optional()}).refine(e=>e.stdout!==void 0||e.stderr!==void 0||e.exitCode!==void 0),xI=yt({path:z(),bytes:Fe().int().nonnegative(),diff:z(),firstChangedLine:Fe().int().positive().nullable(),unifiedPatch:z().nullable(),unifiedPatchBytes:Fe().int().nonnegative(),unifiedPatchAddedLines:Fe().int().nonnegative(),unifiedPatchRemovedLines:Fe().int().nonnegative(),unifiedPatchTruncated:a()}),SI=/^(.+?:\d+)[:-]\s?(.*)$/u;function CI(e){return sI.get(e)??`other`}function wI(e){let t=e.split(`
46
+ `).map(e=>e.trim()).find(e=>e!==``)??``;return t.length>oI?`${t.slice(0,71)}…`:t}function TI(e){return e.slice(0,aI)}function EI(e){return TI($F(e).replace(/\n$/u,``).split(`
47
+ `))}function DI(e){let t=lI.safeParse(e);if(t.success)return t.data.path;let n=uI.safeParse(e);return n.success?n.data.file_path:void 0}function OI(e){try{return{kind:`parsed`,value:JSON.parse(e)}}catch(e){return{kind:`invalid`,cause:e}}}function kI(e){if(e===void 0)return{kind:`none`};let t=e.content.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
48
+ `);if(t.trim()===``)return{kind:`none`};let n=OI(t);if(n.kind===`invalid`)return{kind:`text`,text:t};let r=n.value,i=_I.safeParse(r);if(i.success)return{kind:`text`,text:i.data};let a=wt().safeParse(r);return a.success?{kind:`json`,value:a.data}:{kind:`text`,text:t}}function AI(e,t){let n=t===void 0||t===0;return{kind:`excerpt`,lines:EI(e).map((e,t)=>n?{number:t+1,text:e}:{text:e}),preview:12}}function jI(e){return{kind:`matches`,matches:EI(e).filter(e=>e.trim()!==``).map(e=>{let t=SI.exec(e);return t===null?{location:``,text:e}:{location:t[1]??``,text:t[2]??``}}),preview:12}}function MI(e,t){let n=[];if(e!==void 0&&e.trim()!==``)for(let t of EI(e))n.push({stream:`stdout`,text:t});if(t!==void 0&&t.trim()!==``)for(let e of EI(t))n.push({stream:`stderr`,text:e});return n.length===0?void 0:{kind:`output`,lines:TI(n),preview:12}}function NI(e,t){return{kind:`text`,label:t,language:`json`,lines:EI(JSON.stringify(e,null,2)),preview:12}}function PI(e,t){if(e.kind===`none`)return{sections:[]};if(e.kind===`text`){if(t===`read`)return{sections:[AI(e.text,void 0)]};if(t===`search`)return{sections:[jI(e.text)]};if(t===`command`){let t=MI(e.text,void 0);return{failure:wI(e.text),sections:t===void 0?[]:[t]}}return{failure:wI(e.text),sections:[{kind:`text`,lines:EI(e.text),preview:12}]}}let n=vI.safeParse(e.value);if(n.success)return{sections:[AI(n.data.content,n.data.offset)]};let r=yI.safeParse(e.value);if(r.success)return{sections:[{kind:`matches`,matches:TI(r.data.matches).map(e=>({location:`${e.path}:${String(e.line)}`,text:$F(e.text)})),preview:12}]};let i=YF.safeParse(e.value);if(i.success)return{failure:i.data.error.message,sections:[{kind:`text`,lines:[i.data.error.message],preview:12}]};let a=xI.safeParse(e.value);if(a.success){let{unifiedPatch:e,unifiedPatchBytes:t,unifiedPatchTruncated:n}=a.data;if(n&&e===null)return{sections:[{kind:`text`,lines:[`Diff omitted (${String(t)} bytes, ${String(a.data.unifiedPatchAddedLines)} added, ${String(a.data.unifiedPatchRemovedLines)} removed).`],preview:12}]};if(!n&&e!==null&&t<=65536&&new TextEncoder().encode(e).byteLength===t)try{let t=LF(e),n=t[0];if(t.length===1&&n?.oldFileName===a.data.path&&n.newFileName===a.data.path)return{sections:[LI([{operation:`update`,path:a.data.path,moveTo:void 0,lineNumbers:!0,unified:e,hunks:n.hunks.map(e=>({header:`-${String(e.oldStart)},${String(e.oldLines)} +${String(e.newStart)},${String(e.newLines)}`,lines:e.lines.flatMap(e=>{let t=BI.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})}))}])]}}catch(e){eI(`render tool patch`,e)}}let o=bI.safeParse(e.value);if(o.success){let{stdout:e,stderr:t,exitCode:n}=o.data,r=MI(e,t),i=n!=null&&n!==0;return{exitCode:i?n:void 0,failure:t!==void 0&&t.trim()!==``?wI($F(t)):i?`Exited with code ${String(n)}`:void 0,sections:r===void 0?[]:[r]}}return{sections:[NI(e.value)]}}var FI={add:`Add`,delete:`Delete`,update:`Update`};function II(e){let t=e.length>1;return e.flatMap(e=>[...t?[{kind:`file`,text:`${FI[e.operation]} ${e.path??``}${e.moveTo===void 0?``:` → ${e.moveTo}`}`}]:[],...e.hunks.flatMap(e=>[...e.header===void 0?[]:[{kind:`hunk`,text:e.header}],...e.lines])])}function LI(e){return{kind:`diff`,files:e,lines:TI(II(e)),preview:rI}}var RI={add:`+`,context:` `,remove:`-`};function zI(e){return e.map(e=>{let t=1,n=1,r=e.hunks.map(e=>{let r=t=>e.lines.filter(e=>e.kind===t).length,i=r(`context`)+r(`remove`),a=r(`context`)+r(`add`),o={oldStart:t,oldLines:i,newStart:n,newLines:a,lines:e.lines.map(e=>`${RI[e.kind]}${e.text}`)};return t+=i,n+=a,o}),i={oldFileName:e.path,newFileName:e.moveTo??e.path,oldHeader:void 0,newHeader:void 0,hunks:r};return{hunks:e.hunks.map(e=>({header:e.context,lines:e.lines})),lineNumbers:!1,moveTo:e.moveTo,operation:e.operation,path:e.path,unified:i.hunks.length===0?``:BF(i)}})}var BI=new Map([[`+`,`add`],[`-`,`remove`],[` `,`context`]]);function VI(e,t,n){let r=e??`file`,i=zF(r,r,t,n,``,``,{context:3});return{lineNumbers:!0,unified:BF(i),hunks:i.hunks.map(e=>({header:`-${String(e.oldStart)},${String(e.oldLines)} +${String(e.newStart)},${String(e.newLines)}`,lines:e.lines.flatMap(e=>{let t=BI.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})})),operation:t===``?`add`:`update`,path:e}}function HI(e,t){let n=pI.safeParse(e.args);if(n.success){let t=iF(n.data.patch),r=[...new Set(t.flatMap(e=>e.path?[e.path]:[]))];return{get input(){return[LI(zI(t))]},label:r.length<=1?r[0]??e.name:`${r[0]??``} +${String(r.length-1)}`,paths:r}}let r={label:t??e.name,paths:t===void 0?[]:[t]},i=hI.safeParse(e.args);if(i.success)return{...r,get input(){return[LI([VI(t,i.data.oldText,i.data.newText)])]}};let a=gI.safeParse(e.args);return{...r,get input(){return a.success?[LI([VI(t,``,a.data.content)])]:[]}}}function UI(e){return{get input(){return Object.keys(e.args).length===0?[]:[NI(e.args,`Arguments`)]},label:e.name,paths:[]}}function WI(e,t){let n=DI(e.args);switch(t){case`code`:{let t=fI.safeParse(e.args);return t.success?{get input(){return[{kind:`script`,lines:EI(t.data.code),preview:iI}]},label:wI(t.data.code),paths:[]}:UI(e)}case`command`:{let t=dI.safeParse(e.args);return t.success?{get input(){return[{kind:`command`,lines:EI(t.data.command),preview:iI}]},label:wI(t.data.command),paths:[]}:UI(e)}case`edit`:return HI(e,n);case`read`:return{input:[],label:n??e.name,paths:n===void 0?[]:[n]};case`search`:{let t=mI.safeParse(e.args);return{input:[],label:wI(t.success?n===void 0?t.data.pattern:`${t.data.pattern} in ${n}`:n??`.`),paths:[]}}case`other`:return UI(e)}}function GI(e){let t=CI(e.name),n=WI(e,t),[r,i]=cI[t],a=e.status===`completed`?kI(e.result):void 0,o=a?.kind===`json`&&YF.safeParse(a.value).success,s,c=()=>{if(s!==void 0)return s;let r=PI(kI(e.result),t),i=e.status===`error`||o,a=i?r.failure??`The tool reported an error.`:void 0,c=r.sections.some(e=>e.kind===`diff`),l=(t===`edit`&&!i&&!c?[]:r.sections).filter(e=>e.kind!==`text`||e.lines.length!==1||e.lines[0]!==a);return s={error:a,exitCode:r.exitCode,sections:[...t===`edit`&&c?[]:n.input,...l]},s},l=e.status===`error`||o;return{activeVerb:i,durationMs:e.startedAt===void 0||e.result===void 0?void 0:Math.max(0,e.result.timestamp-e.startedAt),get error(){return l?c().error:void 0},get exitCode(){return c().exitCode},id:e.id,kind:t,label:n.label,name:e.name,paths:n.paths,get sections(){return c().sections},status:l?`error`:e.status,verb:r}}function KI(e){if(e<1e3)return`${String(Math.round(e))}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return`${String(Math.floor(t/60))}m ${String(t%60)}s`}var qI={code:[`ran`,`script`,`scripts`],command:[`ran`,`command`,`commands`],edit:[`edited`,`file`,`files`],other:[`called`,`tool`,`tools`],read:[`read`,`file`,`files`],search:[`searched`,`pattern`,`patterns`]};function JI(e){let t=new Map;for(let n of e){let e=t.get(n.kind)??{calls:0,paths:new Set};e.calls+=1;for(let t of n.paths)e.paths.add(t);t.set(n.kind,e)}let n=[...t].map(([e,t])=>{let[n,r,i]=qI[e],a=(e===`read`||e===`edit`)&&t.paths.size>0?t.paths.size:t.calls;return`${n} ${String(a)} ${a===1?r:i}`}).join(`, `);return n.charAt(0).toUpperCase()+n.slice(1)}function YI(e){return e.some(e=>e.status===`running`)?`running`:e.some(e=>e.status===`error`)?`error`:e.some(e=>e.status===`unknown`)?`unknown`:`completed`}function XI(e){let t,n;for(let r of e)r.startedAt!==void 0&&(t=Math.min(t??r.startedAt,r.startedAt)),r.result!==void 0&&(n=Math.max(n??r.result.timestamp,r.result.timestamp));return t===void 0||n===void 0?void 0:Math.max(0,n-t)}function ZI(e){let t=e.map(GI),n=YI(t);return{active:[...t].reverse().find(e=>e.status===`running`),calls:t,durationMs:n===`running`?void 0:XI(e),failedCount:t.filter(e=>e.status===`error`).length,id:`tools:${e[0].id}`,kind:`tool_group`,status:n,summary:t.length===1&&t[0]!==void 0?`${t[0].verb} ${t[0].label}`:JI(t),tools:e}}function QI(e,t=new Set){let n=[],r=[],i=[],a=()=>{let[e,...t]=r;e!==void 0&&n.push(ZI([e,...t])),n.push(...i),r=[],i=[]};for(let o of e){if(t.has(o.id)&&a(),o.kind===`tool`){r.push(o);continue}if(o.kind===`assistant_message`&&!eF(o)&&r.length>0){i.push(o);continue}a(),n.push(o)}return a(),n}var $I=Object.freeze({mode:`default`,overrides:new Map});function eL(e){return e.status!==`completed`}function tL(e,t){return t?e.calls:e.calls.slice(-3)}function nL(e){return e.status===`error`}function rL(e,t,n){let r=e.overrides.get(t);return r===void 0?e.mode==="default"?n:e.mode===`expanded`:r}function iL(e,t,n){let r=new Map(e.overrides);return r.set(t,!rL(e,t,n)),{...e,overrides:r}}function aL(e,t,n){return[...e.map(e=>({sequence:e.sequence,tie:1,kind:`message`,message:e})),...t.map(e=>({sequence:e.sequence,tie:0,kind:`marker`,marker:e})),...n.map(e=>({sequence:e.sequence,tie:2,kind:`notice`,notice:e}))].sort((e,t)=>e.sequence-t.sequence||e.tie-t.tie)}var oL=()=>void 0;function sL(e,t){return t===void 0?e:{...e,requestId:t}}function cL(e){return Array.isArray(e)?e.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
49
+ `):e}function lL(e,t){return{args:$P.parse(e.arguments),id:e.id,kind:`tool`,name:e.name,startedAt:t,status:`unknown`}}function uL(e){let t={id:e.messageId,kind:`assistant_message`,pending:!0,text:e.text};return e.thinking===``?t:{...t,thinking:e.thinking}}function dL(e){let t=[],n=[],r=[];for(let i of e.content)i.type===`text`&&t.push(i.text),i.type===`thinking`&&n.push(i.thinking),i.type===`toolCall`&&r.push(lL(i,e.timestamp));return{text:t,thinking:n,tools:r}}function fL(e,t,n){if(n.text.length===0&&n.thinking.length===0&&n.tools.length>0)return;let r={id:e,isError:t.stopReason===`error`||t.stopReason===`aborted`,kind:`assistant_message`,pending:!1,at:t.timestamp,text:n.text.length===0?t.stopReason===`error`?`This run couldn’t finish.`:t.stopReason===`aborted`?`The run was cancelled.`:``:n.text.join(``),usage:{cost:t.usage.cost.total,tokens:t.usage.totalTokens}};return n.thinking.length===0?r:{...r,thinking:n.thinking.join(`
50
+ `)}}function pL(e,t,n){let r=dL(t),i=fL(e,t,r);return{items:i===void 0?r.tools:[{...i,author:n},...r.tools],model:{model:t.model,provider:t.provider},usage:{cost:t.usage.cost.total,tokens:t.usage.totalTokens}}}function mL(e,t,n){for(let r of n.items)r.kind===`tool`&&t.set(r.id,e.length),e.push(r)}function hL(e,t,n,r){let i=t.get(n.toolCallId);if(i===void 0)return;let a=e[i];a?.kind===`tool`&&(e[i]={...a,result:n,data:r,status:n.isError?`error`:`completed`})}function gL(e,t=[],n,r=Bj,i=oL,a=[],o=[],s=()=>!0){let c=[],l=new Map,u=new Set,d=new Map,f=new Map,p,m=0,h=0;for(let n of aL(e,t,a)){if(n.kind===`marker`){d.set(n.marker.id,n.sequence),c.push({id:n.marker.id,kind:`compaction_divider`,at:n.marker.at,tokensBefore:n.marker.tokensBefore,tokensAfter:n.marker.tokensAfter});continue}if(n.kind===`notice`){d.set(n.notice.id,n.sequence),c.push({id:n.notice.id,kind:`compaction_notice`,at:n.notice.at,trigger:n.notice.trigger,result:n.notice.result,diagnostic:n.notice.diagnostic});continue}let e=n.message,t=e.value;e.commandId!==null&&u.add(e.commandId);let a=c.length;switch(t.role){case`user`:{let n=e.commandId??e.id,a={id:e.id,kind:`user_message`,commandId:n,status:`confirmed`,at:t.timestamp,text:cL(t.content),author:r(e.meta),origin:e.origin};c.push(sL(a,e.requestId??i(n)));break}case`assistant`:{let n=pL(e.id,t,r(e.meta));p=n.model,m+=n.usage.tokens,h+=n.usage.cost,mL(c,l,n);break}case`toolResult`:if(hL(c,l,t,e.data),e.commandId!==null){let n=f.get(t.toolCallId)??new Set;n.add(e.commandId),f.set(t.toolCallId,n)}}for(let e of c.slice(a))d.set(e.id,n.sequence);if(e.commandId!==null)for(let t of c.slice(a))f.set(t.id,new Set([e.commandId]))}let g=n?.queue;if(g?.state===`running`&&n?.activeTool!==null){let e=!1,t=-1;for(let r=0;r<c.length;r++){let i=c[r];i?.kind===`user_message`&&(e=i.commandId===g.commandId,e&&(t=-1)),e&&i?.kind===`tool`&&i.status===`unknown`&&i.name===n?.activeTool&&(t=r)}let r=c[t];r?.kind===`tool`&&(c[t]={...r,status:`running`})}let _=new Set,v=0;for(let e of c){let t=d.get(e.id);t!==void 0&&(o.some(e=>v<=e&&e<t)&&_.add(e.id),v=t)}let y=QI(c,_),b=new Map;for(let e of y){if(e.kind===`assistant_message`&&!eF(e))continue;let t=e.kind===`tool_group`?e.tools:[e];for(let n of t)for(let t of f.get(n.id)??[])b.set(t,e.id)}let x=new Map;for(let e of o){let t=null;for(let n of y)s(n)&&(n.kind===`assistant_message`&&!eF(n)||(n.kind===`tool_group`?n.tools:[n]).some(t=>{let n=d.get(t.id);return n!==void 0&&n<=e})&&(t=n.id));x.set(e,t)}let S={commandAnchors:b,positionAnchors:x,completedMessageIds:VP(e),items:y,commandIds:u,requestIds:new Set(e.flatMap(e=>e.requestId===void 0?[]:[e.requestId]))};return p===void 0?S:{...S,model:p,usage:{cost:h,tokens:m}}}function _L(e,t,n,r=[],i=Bj){let a=t===null||e.completedMessageIds.has(t.messageId)||t.text===``&&t.thinking===``?void 0:t;if(r.length===0&&a===void 0&&n.length===0)return[];let o=[],s=new Set(n.map(({commandId:e})=>e));for(let t of n){if(e.commandIds.has(t.commandId))continue;let n={id:t.commandId,kind:`user_message`,commandId:t.commandId,status:`queued`,delivery:t.delivery,text:t.text,origin:t.origin,author:i(t.meta)};o.push(sL(n,t.requestId))}for(let t of r){if(e.requestIds.has(t.requestId)||n.some(e=>e.requestId===t.requestId)||t.commandId!==void 0&&(s.has(t.commandId)||e.commandIds.has(t.commandId)))continue;let r={id:t.requestId,kind:`user_message`,requestId:t.requestId,status:t.status===`failed`?`failed`:t.status===`accepted`?`accepted`:`pending`,delivery:t.delivery,text:t.content},i=t.commandId===void 0?r:{...r,commandId:t.commandId},a=t.error===void 0?i:{...i,error:t.error};o.push(a)}return[...a===void 0?[]:[uL(a)],...o.filter(e=>e.status!==`failed`&&e.delivery===`steer`),...o.filter(e=>e.status!==`failed`&&e.delivery===`followUp`),...o.filter(e=>e.status===`failed`)]}var vL=Object.freeze({observation:`connecting`,snapshot:void 0,latestPrompt:void 0}),yL=200,bL=400;function xL(e,t){for(let t of e.slice().reverse()){if(t.value.role!==`user`||t.commandId===null)continue;let e=t.value.content,n=Array.isArray(e)?e.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
51
+ `):e,r=Array.isArray(e)?e.filter(e=>e.type===`image`):[];return{commandId:t.commandId,text:n,images:r.length===0?void 0:r}}return t}async function*SL(e,t){yield{kind:`opening`};let n=await e.watch({limit:yL}),r,i=()=>(r??=n.close(),r),a=()=>{i().catch(e=>{eI(`close aborted Session watch`,e)})};t.addEventListener(`abort`,a,{once:!0});try{if(t.aborted)return;let r=n.snapshot;yield{kind:`snapshot`,value:r};for await(let t of n.changes)r=QP(r,t),r.messages.length>bL?(r=await e.read({limit:yL}),yield{kind:`snapshot`,value:r}):yield{kind:`frame`,value:t};throw Error(`Session watch ended; current activity is unavailable`)}catch(e){if(!t.aborted)throw e}finally{t.removeEventListener(`abort`,a),await i()}}function CL(e,t){if(t.kind===`opening`)return{...e,observation:`connecting`};if(t.kind===`snapshot`)return{observation:`live`,snapshot:t.value,latestPrompt:xL(t.value.messages,e.latestPrompt)};if(e.snapshot===void 0)return t.value.kind===`reset`?{observation:`live`,snapshot:t.value.baseline,latestPrompt:xL(t.value.baseline.messages)}:e;let n=QP(e.snapshot,t.value);return{observation:`live`,snapshot:n,latestPrompt:xL(n.messages,e.latestPrompt)}}function wL(e){return Bs({queryKey:[`shiitake-session`,e.address],queryFn:Ts({streamFn:({signal:t})=>SL(e,t),reducer:CL,initialValue:vL,refetchMode:`append`}),refetchOnMount:`always`,retry:!1,staleTime:1/0})}function TL(e,t,n){e.setQueryData(wL(t).queryKey,{observation:`connecting`,snapshot:n,latestPrompt:xL(n.messages)})}function EL(e,t=null){let n={before:t,newerBefore:[],newerOverflow:!1};return Vs({queryKey:[`shiitake-session-history`,e.address],initialPageParam:n,queryFn:async({pageParam:t,signal:n})=>{if(t.before===null)throw Error(`Session has no older history cursor`);let r=await e.read({before:t.before,limit:100});return n.throwIfAborted(),r},getNextPageParam:(e,t,n)=>{if(e.oldestCursor===null||e.oldestCursor===void 0)return;let r=n.before===null?n.newerBefore:[...n.newerBefore,n.before];return{before:e.oldestCursor,newerBefore:r.slice(-2048),newerOverflow:n.newerOverflow||r.length>2048}},getPreviousPageParam:(e,t,n)=>{let r=n.newerBefore.at(-1);return r===void 0?void 0:{before:r,newerBefore:n.newerBefore.slice(0,-1),newerOverflow:n.newerOverflow}},select:e=>({pages:e.pages,newerOverflow:e.pageParams[0]?.newerOverflow??!1}),maxPages:4,enabled:!1,retry:!1,staleTime:1/0})}function DL(e,t=/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)){return e.startsWith(`<leader>`)?`Ctrl K ${e.slice(8)}`:e.split(` `).map(e=>e.split(`+`).map(e=>e===`mod`?t?`⌘`:`Ctrl`:e===`escape`?`Esc`:e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)).join(e===`ctrl+k`||e===`mod+k`?` `:`+`)).join(` `)}function OL(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],DL(n.binding)]);return e.slash.map(e=>({alias:e.alias,commandId:e.commandId,title:e.title,description:e.description,category:e.category,order:e.order,grammar:e.arguments,consumesDraft:e.consumesDraft,keys:t.get(e.commandId)??[],availability:e.availability}))}function kL(e){let t=new Map;for(let n of e.bindings){let e=t.get(n.commandId);t.set(n.commandId,{commandId:n.commandId,keys:e===void 0?DL(n.binding):`${e.keys}, ${DL(n.binding)}`,title:n.title,order:e?.order??n.order})}return[...t.values()]}function AL(e){let t=e.grammar?.words?.map(({word:e})=>e)??[];return e.grammar===void 0?`/${e.alias} takes no arguments.`:e.grammar.text===void 0?`Use /${e.alias} ${t.join(` or `)}.`:`Use /${e.alias} ${e.grammar.hint}.`}function jL(e,t){if(!t.startsWith(`/`))return{kind:`prompt`};let n=/^\/(\S*)(?:\s+([\s\S]*))?$/u.exec(t.trimEnd()),r=n?.[1]??``,i=(n?.[2]??``).trim(),a=e.find(e=>e.alias===r);if(a===void 0)return{kind:`invalid`,message:`Unsupported command: /${r}. Use /help for available commands.`};if(i.length===0)return{kind:`command`,command:a};let o=a.grammar,s=o?.words?.find(e=>e.word===i);return s===void 0?o?.text===void 0?{kind:`invalid`,message:AL(a)}:{kind:`command`,command:a,arguments:{...o.text.arguments,[o.text.field]:i},requestIdField:o.text.requestIdField}:{kind:`command`,command:a,arguments:s.arguments}}function ML(e,t){let n=e.toLocaleLowerCase(),r=t.toLocaleLowerCase();if(r.length===0)return{tier:0,spread:0,indices:[]};let i=e=>Array.from({length:r.length},(t,n)=>e+n);if(n.startsWith(r))return{tier:0,spread:n.length-r.length,indices:i(0)};let a=n.search(RegExp(`[-_\\s]${r.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}`,`u`));if(a>=0)return{tier:1,spread:a,indices:i(a+1)};let o=n.indexOf(r);if(o>=0)return{tier:2,spread:o,indices:i(o)};let s=[],c=0;for(let e of r){let t=n.indexOf(e,c);if(t<0)return;s.push(t),c=t+1}let l=s[0]??0;return{tier:3,spread:(s.at(-1)??0)-l-r.length+1,indices:s}}function NL(e,t,n,r){return e.map(e=>({entry:e,match:ML(t(e),n)})).filter(e=>e.match!==void 0).sort((e,n)=>e.match.tier-n.match.tier||e.match.spread-n.match.spread||r(e.entry)-r(n.entry)||t(e.entry).localeCompare(t(n.entry))).map(({entry:e,match:t})=>({entry:e,indices:t.indices}))}var PL=[`help`,`login`,`model`];function FL(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
52
+ `))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:NL(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||PL.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=PL.indexOf(e.alias);return r.length===0&&t>=0?t-PL.length:e.order}).map(({entry:e,indices:t})=>({command:e,label:`/${e.alias}`,matches:t.map(e=>e+1),insert:e.grammar===void 0?`/${e.alias}`:`/${e.alias} `}))}}let i=t.slice(1,r),a=e.find(e=>e.alias===i);if(a?.grammar===void 0||a.availability.status!==`available`)return{kind:`none`};let o=t.slice(r).trimStart(),s=(o.includes(` `)?[]:a.grammar.words??[]).filter(e=>e.word.toLocaleLowerCase().startsWith(o.toLocaleLowerCase())).map(e=>({word:e,label:e.word,matches:Array.from({length:o.length},(e,t)=>t),insert:`/${i} ${e.word}`}));return{kind:`arguments`,command:a,query:o,hint:`/${i} ${a.grammar.hint}`,items:s}}var IL=new WeakMap;function LL(e){return e.status===`handled`&&ht({cancelled:Oe(!0)}).safeParse(e.result).success}async function RL(e,t,n,r,i){let a=jL(OL(t.snapshot()),e);if(a.kind===`prompt`){n();return}if(a.kind===`invalid`)return{status:`failed`,error:{code:`invalid_arguments`,message:a.message}};let{command:o,requestIdField:s}=a;if(o.consumesDraft&&o.availability.status===`available`&&i?.(),a.arguments===void 0)return t.execute(o.commandId,{origin:r});if(s===void 0)return t.execute(o.commandId,{origin:r,arguments:a.arguments});let c=IL.get(t)??new Map;IL.set(t,c);let l=c.get(o.commandId);if(l?.draft===e&&l.running!==void 0)return l.running;let u={draft:e,requestId:l?.draft===e?l.requestId:ar()};c.set(o.commandId,u);let d=t.execute(o.commandId,{origin:r,arguments:{...a.arguments,[s]:u.requestId}}).then(e=>c.get(o.commandId)===u?(u.running=void 0,e.status===`handled`&&!LL(e)&&c.delete(o.commandId),e):e);return u.running=d,d}var zL=5e3,BL=`Too late: that message already started`;function VL(e){return e instanceof Error?e.message:`Could not recall queued message`}function HL(e){let t={kind:`idle`},n=e.recovery===void 0?void 0:{prompt:e.recovery},r=!1,i=()=>r,a,o,s=n=>{t=n,e.onState(n)};async function c(t,r){if(n===void 0){let a=await e.session.latestPending();if(!r.active||i()||e.emptyDraftRevision()!==t)return{kind:`ignored`};if(a===null)return{kind:`empty`};e.reserve(a),n={prompt:a}}let a=n,o=a.result??await e.session.cancel({commandId:a.prompt.commandId,onlyIfPending:!0});return!i()&&n===a&&(a.result=o),{kind:`decided`,target:a,result:o}}async function l(){let r=e.emptyDraftRevision();if(i()||t.kind===`recalling`||r===void 0)return`ignored`;if(o!==void 0)return`uncertain`;s({kind:`recalling`});let l={active:!0},u=new Promise(e=>{a=()=>{e({kind:`ignored`})}}),d,f=new Promise(e=>{d=setTimeout(()=>{l.active=!1,e({kind:`uncertain`,message:`Recall is unconfirmed. Press Up on an empty composer to retry.`})},zL)});o=c(r,l).catch(e=>({kind:`uncertain`,message:VL(e)})).finally(()=>{o=void 0});let p=await Promise.race([o,f,u]);if(l.active=!1,clearTimeout(d),a=void 0,i())return`ignored`;if(p.kind===`ignored`||p.kind===`empty`)return s({kind:`idle`}),p.kind;if(p.kind===`uncertain`)return s(p),`uncertain`;if(p.result.status===`too_late`){try{e.forget()}catch(e){return s({kind:`uncertain`,message:VL(e)}),`uncertain`}return n=void 0,s({kind:`too_late`,message:BL}),`too_late`}try{if(e.restore(p.target.prompt,r))return n=void 0,s({kind:`restored`}),`restored`;s({kind:`uncertain`,message:`Message recalled. Clear the composer and press Up to restore it.`})}catch(e){s({kind:`uncertain`,message:VL(e)})}return`uncertain`}return{get state(){return t},recall:l,dispose:()=>{r=!0,a?.()}}}var UL=_e(ot({type:Oe(`image`),data:z(),mimeType:z()})).readonly(),WL=me([`steer`,`followUp`]),GL=ot({commandId:z(),requestId:z(),text:z(),images:UL.optional(),delivery:WL}),KL=ot({requestId:z().min(1),content:z(),submittedDraft:z(),delivery:WL,images:UL.optional(),restoreDraft:a()}),qL=ot({draft:z(),images:UL.optional(),delivery:WL.optional(),recall:GL.optional(),pending:_e(KL).max(32)});function JL(e,t){let n=`fungi.parakeet.drafts.v1:${e}`;return{read(){if(t===void 0)return{draft:``,pending:[]};let e=t.getItem(n);return e===null?{draft:``,pending:[]}:qL.parse(JSON.parse(e))},write(e){if(t===void 0)throw Error(`Durable draft storage is unavailable`);t.setItem(n,JSON.stringify(e))}}}var YL=Object.freeze([]),XL=Object.freeze([]),ZL=Object.freeze([]),QL=Object.freeze([]),$L=Object.freeze([]),eR=Object.freeze({}),tR=Object.freeze({total:0,hasMore:!1,prompts:Object.freeze([])}),nR=Object.freeze({status:`connecting`}),rR=Object.freeze({status:`live`}),iR=32;function aR(e){return e instanceof Error&&e.message.trim().length>0?e.message:`Prompt admission failed`}function oR(e){let t,n=new Promise((e,n)=>{t=setTimeout(()=>{n(Error(`Request recovery timed out`))},1e4)});return Promise.race([e,n]).finally(()=>{clearTimeout(t)})}function sR(e){return(e instanceof Error&&e.message.trim().length>0?e.message.trim():`Session history is unavailable`).slice(0,500)}function cR(e,t,n){if(e===void 0)return`connecting`;let r=FP(e),i=zP(r);return i===`idle`?n!==void 0||r.kind===`error`?`error`:t.some(({status:e})=>e===`accepted`)?`queued`:t.some(({status:e})=>e===`admitting`)?`sending`:i:i}function lR(e){if(e===void 0)return;let t;for(let n of e)n.value.role===`user`&&n.commandId!==null&&(t===void 0||n.sequence>t.sequence)&&(t={commandId:n.commandId,sequence:n.sequence});return t?.commandId}function uR(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.data===n?.data&&e.mimeType===n.mimeType})}function dR(e){if(e!==void 0)return{status:`available`,storage:e};try{let e=globalThis.localStorage;return e===void 0?{status:`unavailable`}:{status:`available`,storage:e}}catch{return{status:`unavailable`}}}function fR(e,t,n,r,i,a,o,s){let c=JL(a,i.status===`available`?i.storage:void 0),l=c.read(),u=!1,d=new Map,f=new Map(l.pending.map(({requestId:e})=>[e,`Closed before confirmation`])),p=new Set,m=DP(()=>wL(e),()=>t),h=$(e=>e(m).data?.snapshot),g=$(void 0),_=$(e=>(e(g)??e(h))?.oldestCursor??null),v=OP(t=>EL(e,t(_)),()=>t),y=$(e=>{let t=e(v);return t.data===void 0?e(_)!==null:t.hasNextPage}),b=$(e=>e(v).isFetching),x=$(e=>{let t=e(v);return t.hasPreviousPage||t.data?.newerOverflow===!0}),S=$(null,e=>{!e(y)||e(b)||e(v).fetchNextPage({cancelRefetch:!1,throwOnError:!0}).catch(e=>{e instanceof Zo||eI(`read older Session history`,e)})}),C=$(null,(n,r)=>{r(g,void 0),t.resetQueries({queryKey:EL(e).queryKey,exact:!0})}),w=$(null,(e,t)=>{let n=e(v);if(!n.isFetching){if(!n.hasPreviousPage){e(x)&&t(C);return}n.fetchPreviousPage({cancelRefetch:!1,throwOnError:!0}).catch(e=>{e instanceof Zo||eI(`read newer Session history`,e)})}}),T=$(null,(e,t)=>{e(g)===void 0&&t(g,e(h))}),E=$(e=>{let t=e(v),n=e(h)?.messages??YL,r=t.data?.pages.flatMap(e=>e.messages)??YL,i=e(g)?.messages??YL;return r.length===0?i.length===0?n:UP(i,n):e(x)?r:UP(UP(r,i),n)}),D=$(e=>{let t=e(v),n=e(h)?.compactions??XL,r=t.data?.pages.flatMap(e=>e.compactions??XL)??XL,i=e(g)?.compactions??XL;return r.length===0?i.length===0?n:KP(i,n):e(x)?r:KP(KP(r,i),n)}),O=$(e=>{let t=e(v),n=e(h)?.compactionNotices??ZL,r=t.data?.pages.flatMap(e=>e.compactionNotices??ZL)??ZL,i=e(g)?.compactionNotices??ZL;return r.length===0?i.length===0?n:qP(i,n):e(x)?r:qP(qP(r,i),n)}),k=$(e=>e(m).data?.latestPrompt?.commandId??lR(e(E))),A=$(e=>e(h)?.pending??tR),j=$(new Set),M=$(void 0),N=$(e=>{let t=e(A),n=e(j),r=t.prompts.filter(({commandId:e})=>!n.has(e));return r.length===t.prompts.length?t:{...t,prompts:r,total:t.total-(t.prompts.length-r.length)}}),P=$(null,(e,t)=>{let n=e(j),r=new Set(e(A).prompts.map(({commandId:e})=>e)),i=new Set([...n].filter(t=>t===e(M)||r.has(t)));i.size!==n.size&&t(j,i)}),ee=$(e=>e(h)?.extensions??eR),te,F=$(e=>{let t=e(m),n=e(h)?.activity;if(t.isError||t.data?.observation!==`live`||n?.queue.state!==`running`||n.activeTool===null){te=void 0;return}return te?.queue.state===`running`&&te.queue.commandId===n.queue.commandId&&te.activeTool===n.activeTool||(te=n),te}),ne=$(new Map),re=$(e=>{let t=e(ne);return e=>t.get(e)}),ie=$(e=>{let t=e(E),r=e(D),i=e(O),a=[...t.map(e=>e.sequence),...r.map(e=>e.sequence),...i.map(e=>e.sequence)],c=Math.min(...a),l=Math.max(...a),u=e(o).flatMap(({value:t})=>t.timeline.cells.flatMap(({afterSequence:t})=>t===void 0||e(y)&&t<c||e(x)&&t>l?[]:[t]));return gL(t,r,e(F),n,e(re),i,u,s)}),ae=$(l.draft),I=$(l.images),oe=$(l.delivery),se=$(l.recall),L=$({kind:`idle`}),ce,le=$(0),R=$(l.pending.map(e=>({...e,status:`admitting`}))),ue=$(null,(e,t,n)=>{i.status!==`unavailable`&&c.write({draft:n?.draft??e(ae),images:n?.draftPayload===void 0?e(I):n.draftPayload.images,delivery:n?.draftPayload===void 0?e(oe):n.draftPayload.delivery,recall:n?.recall===null?void 0:n?.recall??e(se),pending:(n?.admissions??e(R)).filter(({status:e})=>e===`admitting`).map(({requestId:e,content:t,submittedDraft:n,delivery:r,images:i,restoreDraft:a})=>({requestId:e,content:t,submittedDraft:n,delivery:r,images:i,restoreDraft:a}))})}),de=$(null,(t,n)=>t(M)===void 0?(ce??=HL({session:{latestPending:()=>e.latestPending(),cancel:t=>e.command({type:`cancel`,...t})},recovery:t(se),emptyDraftRevision:()=>t(ae)===``&&(t(I)?.length??0)===0?t(le):void 0,reserve:e=>{n(ue,{recall:e}),n(se,e)},forget:()=>{n(ue,{recall:null}),n(se,void 0)},restore:(e,r)=>t(le)!==r||t(ae)!==``||(t(I)?.length??0)!==0?!1:(n(ue,{draft:e.text,draftPayload:{images:e.images,delivery:e.delivery},recall:null}),n(se,void 0),n(I,e.images),n(oe,e.delivery),n(ae,e.text),n(le,e=>e+1),!0),onState:e=>{n(L,e),(e.kind===`too_late`||e.kind===`uncertain`)&&r.toast({variant:`warning`,message:e.message})}}),ce.recall()):Promise.resolve(`ignored`)),fe=$(void 0),pe=$(null,(e,t)=>{if(!u)return{status:`failed`,reason:`Conversation is no longer mounted`};if(i.status===`unavailable`)return{status:`failed`,reason:`Durable draft storage is unavailable`};try{return t(ue),{status:`saved`}}catch(e){return{status:`failed`,reason:aR(e)}}}),me=$(e=>new Set([...e(ie).commandIds,...e(A).prompts.map(({commandId:e})=>e),...e(h)?.terminals.map(({commandId:e})=>e)??[]])),he=$(e=>{let t=e(me);return e(R).filter(e=>e.status===`failed`||e.commandId===void 0||!t.has(e.commandId))}),ge=$(null,(e,t)=>{let n=e(me),r=new Map([...e(E).flatMap(({id:e,requestId:t,commandId:n})=>t===void 0?[]:[[t,n??e]]),...e(A).prompts.map(({requestId:e,commandId:t})=>[e,t])]);for(let n of e(R)){let e=r.get(n.requestId);e!==void 0&&t(ne,t=>new Map(t).set(e,n.requestId))}t(R,e=>{let i=e.filter(({requestId:e,status:t,commandId:i})=>!r.has(e)&&(t!==`accepted`||i===void 0||!n.has(i)));if(i.length!==e.length)try{t(ue,{admissions:i})}catch(e){eI(`save reconciled draft`,e)}return i.length===e.length?e:i})}),_e=$(void 0),ve=$(null,(e,t,n)=>{try{t(ue,{draft:n})}catch(e){eI(`save current draft`,e),r.toast({variant:`error`,message:`Draft not saved: ${aR(e)}`})}e(ae)!==n&&t(le,e=>e+1),t(ae,n),t(_e,void 0)}),ye=$(null,(e,t,n)=>{e(le)===n.revision&&e(ae)===n.draft&&(t(ue,{draft:``}),t(ae,``))}),be=kP(()=>({mutationFn:t=>e.command({type:`cancel`,commandId:t})}),()=>t),xe,Se=$(null,(t,n,i)=>{if(!u||t(L).kind===`recalling`)return Promise.resolve();if(xe!==void 0)return xe;if(t(j).has(i)||!t(A).prompts.some(e=>e.commandId===i))return Promise.resolve();n(j,new Set(t(j)).add(i)),n(M,i);let a=()=>{let e=new Set(t(j));e.delete(i),n(j,e)},o=Promise.resolve().then(()=>e.command({type:`cancel`,commandId:i,onlyIfPending:!0})).then(e=>{u&&e.status===`too_late`&&(a(),r.toast({variant:`warning`,message:`Couldn't remove that message: it is no longer pending.`}))},()=>{u&&(a(),r.toast({variant:`warning`,message:`Cancellation unconfirmed. That message may still run. Try again or reconnect.`}))}).finally(()=>{xe=void 0,u&&(n(M,void 0),n(P))});return xe=o,o}),Ce=$(e=>{if(e(x))return[];let t=e(h),r=e(N);return _L(e(ie),t?.progress??null,r.prompts,e(he),n)}),we=$(e=>{let t=e(ie),n={pendingHasMore:e(A).hasMore,queued:e(N),cancellingQueued:e(M)!==void 0||e(L).kind===`recalling`,positionAnchors:t.positionAnchors,commandAnchors:t.commandAnchors,hasMoreHistory:e(y),hasNewerHistory:e(x),loadingOlderHistory:e(b),settled:t.items,tail:e(Ce)};return t.model===void 0||t.usage===void 0?n:{...n,model:t.model,usage:t.usage}}),Te=$(e=>{let t=e(he),n=e(h),r=e(A),i=e(R).find(({requestId:t})=>t===e(fe)),a=r.prompts.length>0||t.some(({status:e})=>e!==`failed`);if(i?.status===`failed`&&n!==void 0&&zP(FP(n))===`idle`&&!a)return`admission`;if(i?.status===`admitting`||i?.status===`accepted`&&!e(ie).commandIds.has(i.commandId??``)&&!r.prompts.some(({commandId:e})=>e===i.commandId)&&!n?.terminals.some(({commandId:e})=>e===i.commandId)||a)return;let o=e(k),s=n?.terminals.find(({commandId:e})=>e===o)?.outcome;return s===`completed`?void 0:s}),Ee=$(e=>{let t=e(m);return t.isError?{status:`unavailable`,reason:t.error instanceof Error&&t.error.message.trim().length>0?t.error.message:`Session history is unavailable`}:t.data?.observation===`live`?rR:nR}),De=$(e=>e(Ee).status===`unavailable`?`disconnected`:e(Ee).status===`connecting`?`connecting`:cR(e(h),e(he),e(Te))),Oe=$(e=>e(h)?.context),ke=$(e=>{let t=e(h)?.activity.queue;return t?.state===`idle`?void 0:t?.commandId}),Ae,je=$(e=>{let t=e(Ee);if(t.status===`unavailable`)return{kind:`disconnected`,cause:t.reason};if(t.status===`connecting`)return{kind:`connecting`};if(e(Te)===`admission`)return{kind:`error`,cause:([...e(R)].reverse().find(e=>e.status===`failed`)?.error??`Prompt admission failed`).slice(0,200)};let n=e(h);if(n===void 0)return{kind:`connecting`};let r=FP(n);return Ae!==void 0&&RP(Ae,r)?Ae:(Ae=r,r)}),Me=$(null,(t,n,{admission:i,consumeDraft:a})=>{try{n(ue,a?{draft:``,draftPayload:{}}:{draft:t(ae)})}catch(e){eI(`save pending draft before send`,e),n(R,e=>e.filter(({requestId:e})=>e!==i.requestId)),r.toast({variant:`error`,message:`Not sent: ${aR(e)}`});return}a&&(n(I,void 0),n(oe,void 0),n(ve,``));let o={type:`prompt`,text:i.content,requestId:i.requestId,delivery:i.delivery};e.command(i.images===void 0?o:{...o,images:i.images}).then(e=>{if(!(!u||!t(R).some(({requestId:e,status:t})=>e===i.requestId&&t===`admitting`))){if(e.status===`recorded`){n(R,e=>e.filter(e=>e.requestId!==i.requestId)),n(ue);return}n(ne,t=>new Map(t).set(e.commandId,i.requestId)),n(R,t=>t.map(t=>t.requestId===i.requestId?{requestId:t.requestId,content:t.content,images:t.images,submittedDraft:t.submittedDraft,restoreDraft:t.restoreDraft,delivery:t.delivery,commandId:e.commandId,status:`accepted`}:t)),n(ge),n(ue)}}).catch(e=>{u&&(f.set(i.requestId,aR(e)),n(Ne))})}),Ne=$(null,(t,n)=>{if(u)for(let i of t(R)){let a=f.get(i.requestId);i.status!==`admitting`||a===void 0||p.has(i.requestId)||(p.add(i.requestId),oR(e.withdraw(i.requestId)).then(e=>{if(!u||!t(R).some(({requestId:e,status:t})=>e===i.requestId&&t===`admitting`))return;if(e.status===`accepted`){n(ne,t=>new Map(t).set(e.commandId,i.requestId)),n(R,t=>t.map(t=>t.requestId===i.requestId?{...t,status:`accepted`,commandId:e.commandId}:t)),n(ue),n(ge);return}let o=t(ae),s=i.restoreDraft?o===``?i.submittedDraft:`${o}\n\n${i.submittedDraft}`:o,c=t(R).map(e=>e.requestId===i.requestId?{...e,status:`failed`,error:a}:e),l=i.restoreDraft?[...t(I)??[],...i.images??[]]:t(I);n(ue,{draft:s,draftPayload:{images:l,delivery:t(oe)},admissions:c}),n(I,l),n(R,c),n(ve,s),r.toast({variant:`error`,message:`Not sent: ${a}`})}).catch(e=>{u&&r.toast({variant:`error`,message:`Send outcome unconfirmed; draft saved: ${aR(e)}`})}).finally(()=>{p.delete(i.requestId)}))}}),Pe=$(null,(e,t)=>{let n=e(Ee).status,r=e(R);for(let[e,t]of d)r.some(({requestId:t,status:n})=>t===e&&n===`admitting`)||(clearTimeout(t),d.delete(e),f.delete(e));for(let e of r)e.status===`admitting`&&(n===`unavailable`&&f.set(e.requestId,`Disconnected`),d.has(e.requestId)||d.set(e.requestId,setTimeout(()=>{f.set(e.requestId,`Send confirmation timed out`),t(Ne)},3e4)));(n===`live`||n===`unavailable`)&&t(Ne)}),Fe=$(null,(e,t)=>(u=!0,t(L,{kind:`idle`}),t(Pe),()=>{u=!1,ce?.dispose(),ce=void 0;for(let e of d.values())clearTimeout(e);d.clear()})),Ie=$(null,(e,t,n=`steer`)=>{let r=e(ae),i=r;if(e(L).kind===`recalling`||i.trim()===``&&(e(I)?.length??0)===0)return;let a=e(he);if(a.filter(({status:e})=>e!==`failed`).length>=iR){t(_e,`queue_full`);return}let o={content:i,delivery:e(oe)??n,images:e(I),requestId:ar(),submittedDraft:r,restoreDraft:!0,status:`admitting`};t(R,[...a,o]),t(fe,o.requestId),t(_e,void 0),t(Me,{admission:o,consumeDraft:!0})}),Le=$(null,async(e,t,n)=>{let r={draft:e(ae),revision:e(le)},i=await n(r.draft,()=>{t(ye,r)});return i?.status===`handled`&&!LL(i)&&t(ye,r),i}),Re=$(null,(e,t)=>{let n=e(he);if(e(Te)===`interrupted`||e(Te)===`failed`){let r=e(h),i=e(k),a=e(m).data?.latestPrompt;if(r===void 0||a===void 0||a.commandId!==i)return;let o=a.text,s=e(ae)===o&&uR(e(I),a.images);if(n.filter(({status:e})=>e!==`failed`).length>=iR){t(_e,`queue_full`);return}let c={content:o,images:a.images,delivery:`followUp`,requestId:ar(),submittedDraft:o,restoreDraft:s,status:`admitting`};t(R,[...e(R),c]),t(fe,c.requestId),t(_e,void 0),t(Me,{admission:c,consumeDraft:s});return}let r=n.filter(e=>e.status===`failed`).at(-1);if(r===void 0)return;if(n.filter(({status:e})=>e!==`failed`).length>=iR){t(_e,`queue_full`);return}let i=e(ae)===r.submittedDraft&&uR(e(I),r.images),a={content:r.content,delivery:r.delivery,images:r.images,requestId:ar(),submittedDraft:r.submittedDraft,restoreDraft:i,status:`admitting`};t(R,e=>e.map(e=>e.requestId===r.requestId?a:e)),t(fe,a.requestId),t(_e,void 0),t(Me,{admission:a,consumeDraft:i})}),ze=$(null,(e,t,n)=>{let r=e(R),i=r.filter(e=>e.requestId!==n||e.status!==`failed`);i.length!==r.length&&(t(R,i),e(fe)===n&&t(fe,i.at(-1)?.requestId))}),Be,Ve=$(null,e=>{if(Be!==void 0)return Be;let t=e(h)?.activity.queue;if(t?.state!==`running`)return Promise.resolve();let n=e(be).mutateAsync(t.commandId).then(()=>void 0).finally(()=>{Be===n&&(Be=void 0)});return Be=n,n}),He;return{cancelQueuedAtom:Se,reconcileQueuedCancellationAtom:P,abortAtom:be,draftImagesAtom:I,recallStateAtom:L,recallAtom:de,commandIdAtom:ke,contextAtom:Oe,admissionErrorAtom:_e,admissionsAtom:he,cancelAtom:Ve,checkpointDraftAtom:pe,draftAtom:ae,dismissFailedAtom:ze,extensionsAtom:ee,failureAtom:Te,jumpToLatestAtom:C,loadOlderHistoryAtom:S,loadNewerHistoryAtom:w,observationAtom:Ee,observedCommandIdsAtom:me,rawAdmissionsAtom:R,maintainRecoveryAtom:Pe,mountRecoveryAtom:Fe,pinVisibleHistoryAtom:T,queryAtom:m,reconcileAdmissionsAtom:ge,reconnectAtom:$(null,n=>{let r=n(Ee);if(r.status!==`unavailable`)return Promise.resolve({kind:`nothing_to_reconnect`,state:r.status===`live`?`connected`:`connecting`});if(He!==void 0)return He;let i=t.getQueryCache().find({queryKey:wL(e).queryKey});if(i===void 0)return Promise.resolve({kind:`failed`,cause:`Session observation is unavailable`});let a=i.state.dataUpdateCount,o=i.state.errorUpdateCount;return He=new Promise(r=>{let s=()=>void 0,c=!1,l=e=>{c||(c=!0,s(),clearTimeout(d),r(e))},u=()=>{if(i.state.dataUpdateCount>a&&t.getQueryData(wL(e).queryKey)?.observation===`live`){l({kind:`reconnected`});return}i.state.errorUpdateCount>o&&l({kind:`failed`,cause:sR(i.state.error)})};s=t.getQueryCache().subscribe(e=>{e.query===i&&u()});let d=setTimeout(()=>{i.cancel({revert:!0}).then(()=>{let e=`Session history did not reopen within 10 seconds`;i.setState({status:`error`,error:Error(e)}),l({kind:`failed`,cause:e})})},1e4);n(m).refetch({cancelRefetch:!0}).catch(e=>{l({kind:`failed`,cause:sR(e)})}),u()}).finally(()=>{He=void 0}),He}),retryAtom:Re,setDraftAtom:ve,sendAtom:Ie,snapshotAtom:h,statusAtom:De,viewStateAtom:je,submitCommandAtom:Le,timelineAtom:we}}var pR=(0,q.createContext)(null);function mR(){let e=(0,q.useContext)(pR);if(e===null)throw Error(`Parakeet hooks require a ParakeetProvider`);return e}function hR(e){let{store:t}=mR(),n=(0,q.useCallback)(n=>t.sub(e,n),[e,t]),r=(0,q.useCallback)(()=>t.get(e),[e,t]);return(0,q.useSyncExternalStore)(n,r,r)}function gR(e){let{store:t}=mR();return(0,q.useCallback)((...n)=>t.set(e,...n),[e,t])}function _R({children:e,session:t,clients:n=QL,interactionStore:r,authorOf:i=Bj,onToast:a,draftStorage:o,draftIdentity:s}){let c=uo(),l=(0,q.useMemo)(()=>dR(o),[o]),u=s===void 0?t.address:JSON.stringify([s.agentId,s.sessionId]),d=(0,q.useMemo)(()=>new Set(n.filter(e=>e.promptPresentation===`footer`).map(e=>e.id)),[n]),f=(0,q.useMemo)(()=>{let e=r??RN(),n=$($L),a=e=>e.kind!==`user_message`||e.origin===void 0||!d.has(e.origin.extensionId);return{atoms:fR(t,c,i,e,l,u,n,a),session:t,store:yP(),contributions:n,interactions:e,shown:a}},[c,t,r,i,d,l,u]);return(0,q.useEffect)(()=>{let e=()=>{f.store.set(f.atoms.maintainRecoveryAtom)},t=f.store.sub(f.atoms.observationAtom,e),n=f.store.sub(f.atoms.rawAdmissionsAtom,e),r=f.store.set(f.atoms.mountRecoveryAtom);return()=>{r(),t(),n()}},[f]),(0,q.useEffect)(()=>{if(a!==void 0)return f.interactions.subscribeToasts(a)},[f,a]),(0,q.useEffect)(()=>{l.status===`unavailable`&&f.interactions.report({tone:`info`,message:`Drafts are session-only because browser storage is unavailable. They will be lost when this conversation closes.`})},[f,l]),(0,q.useEffect)(()=>{let e=()=>{f.store.set(f.atoms.reconcileQueuedCancellationAtom)},t=f.store.sub(f.atoms.snapshotAtom,e);return e(),t},[f]),(0,q.useEffect)(()=>{let e=()=>{f.store.set(f.atoms.reconcileAdmissionsAtom)},t=f.store.sub(f.atoms.observedCommandIdsAtom,e);return e(),()=>{t()}},[f]),(0,q.useEffect)(()=>{let e=IN(n,(e,t)=>{eI(`client contribution ${e}`,t),f.interactions.report({tone:`error`,message:t.message})}),t=e.subscribe(()=>{f.store.set(f.contributions,e.snapshot())}),r=()=>{e.update(f.store.get(f.atoms.extensionsAtom))},i=f.store.sub(f.atoms.extensionsAtom,r);return r(),()=>{i(),e.dispose(),t()}},[n,f]),(0,X.jsx)(pR.Provider,{value:f,children:e})}function vR(){let{atoms:e}=mR(),t=hR(e.timelineAtom),n=gR(e.loadOlderHistoryAtom),r=gR(e.loadNewerHistoryAtom),i=gR(e.jumpToLatestAtom),a=gR(e.pinVisibleHistoryAtom),o=gR(e.cancelQueuedAtom),{shown:s}=mR(),c=(0,q.useMemo)(()=>t.settled.filter(s),[t.settled,s]),l=(0,q.useMemo)(()=>t.tail.filter(s),[t.tail,s]),u=(0,q.useMemo)(()=>({...t,settled:c,tail:l}),[t,c,l]),d=u.settled.length+u.tail.length===0&&t.settled.length+t.tail.length>0&&t.hasMoreHistory&&!t.loadingOlderHistory,f=`${t.settled[0]?.id??``}:${String(t.settled.length)}`,p=(0,q.useRef)(void 0);return(0,q.useEffect)(()=>{!d||p.current===f||(p.current=f,n())},[d,f,n]),(0,q.useMemo)(()=>({...u,cancelQueued:o,jumpToLatest:i,loadNewerHistory:r,loadOlderHistory:n,pinVisibleHistory:a}),[u,o,i,r,n,a])}function yR(){let{atoms:e}=mR(),t=hR(e.draftAtom),n=hR(e.draftImagesAtom),r=hR(e.recallStateAtom),i=gR(e.recallAtom),a=hR(e.failureAtom),o=hR(e.admissionErrorAtom),s=gR(e.setDraftAtom),c=gR(e.checkpointDraftAtom),l=gR(e.sendAtom),u=gR(e.submitCommandAtom),d=gR(e.retryAtom),f=(0,q.useCallback)(()=>{d()},[d]),p=gR(e.dismissFailedAtom),m=gR(e.cancelAtom);return(0,q.useMemo)(()=>({admissionError:o,cancel:m,checkpointDraft:c,draft:t,images:n,recall:i,recallState:r,dismissFailed:p,failure:a,retry:f,send:l,setDraft:s,submitCommand:u}),[o,m,c,t,n,i,r,p,a,f,l,s,u])}function bR(){let{atoms:e}=mR();return gR(e.dismissFailedAtom)}function xR(){return mR().session}function SR(){return hR(mR().atoms.extensionsAtom)}function CR(){let{atoms:e}=mR(),t=hR(e.commandIdAtom),n=hR(e.statusAtom),r=hR(e.viewStateAtom),i=hR(e.observationAtom),a=gR(e.reconnectAtom),o=hR(e.contextAtom);return(0,q.useMemo)(()=>({commandId:t,context:o,observation:i,reconnect:a,status:n,viewState:r}),[t,o,i,a,n,r])}function wR(){return hR(mR().contributions)}function TR(){return mR().interactions}var ER=t(Ks(),1),DR=class extends Error{_tag=`WatchdogError`;cause;underlying;constructor(e,t){super(`Watchdog ${e.replaceAll(`_`,` `)}`),this.name=this._tag,this.cause=e,this.underlying=t}},OR=ri({family:`watchdog`,version:1,kinds:{claim:{prefix:`watchdog_claim`}}});function kR(e){if(Jn(e))return`execution_interrupted`;let t=yn(e);return t._tag===`Some`?t.value.cause:`execution_defect`}var AR=(e,t)=>{let n=`idle`,r,i=e=>t.ingest(e),a=e=>t.read(e).pipe(x(e=>e.status===`missing`?e:{status:`found`,job:e.job,cancellation:e.cancellation})),o=e=>t.readQueueHead(e),s=(e,n)=>t.readSettled(e,n),c=n=>t.recordCancellation(n).pipe(ft(t=>{if(t.status!==`recorded`&&t.status!==`replayed`)return I;let i=r;return i?.jobId===n.jobId?xt(()=>{i.fiber.interruptUnsafe()}):e.wake.recompute()})),l=n=>t.failLane(n).pipe(ft(t=>{let n=r,i=t.jobs.find(e=>e.jobId===n?.jobId);return n!==void 0&&i!==void 0&&(n.failed=i,n.fiber.interruptUnsafe()),t.jobs.length===0?I:e.wake.recompute()}),x(({jobs:e,more:t})=>({settled:e.length,more:t}))),u=e=>t.purgeQueued(e),d=()=>Jt({try:()=>OR.claim.generate(),catch:()=>new DR(`claim_unavailable`)}).pipe(Wt(e=>t.selectAndClaim(e))),p=()=>tt(function*(){let n=yield*t.nextRunningClaim();if(n===void 0)return{status:`none`};let r=yield*We(e.isAlive(n.job));if(r._tag===`Failure`)return{status:`liveness_unknown`,jobId:n.job.jobId,reason:r.failure.cause};if(r.success)return{status:`none`};let i=n.job.recovery!==void 0&&n.recoveryCount<n.job.recovery.maxRecoveries?`requeue`:`interrupted`,a=yield*t.reconcileDisappearedClaim({...n,disposition:i});switch(a.status){case`requeued`:return yield*e.wake.recompute(),{status:`none`};case`settled`:return yield*e.wake.recompute(),{status:`recovered`,job:a.job};case`conflict`:case`missing`:{let e=yield*t.read(n.job.jobId);return e.status===`found`&&(e.job.state!==`running`||e.claimToken!==n.claimToken||e.recoveryCount!==n.recoveryCount)?{status:`none`}:yield*Je(new DR(`settlement_rejected`))}}});return Object.freeze({hasPendingWork:t.hasPendingWork,ingest:i,read:a,readQueueHead:o,readSettled:s,tick:()=>qe(()=>n===`idle`?(n=`running`,p().pipe(Wt(e=>e.status===`recovered`?Be({status:`recovered`,job:e.job}):d().pipe(x(t=>t.status===`no_ready`&&e.status===`liveness_unknown`?e:t))),Wt(n=>n.status===`no_ready`?Be({status:`no_ready`}):n.status===`liveness_unknown`?Be(n):n.status===`claim_unavailable`?Je(new DR(`claim_unavailable`)):n.status===`cancelled`?e.wake.recompute().pipe(Ot({status:`settled`,job:n.job})):n.status===`recovered`?Be({status:`settled`,job:n.job}):tt(function*(){let i=yield*_n(),a=yield*f(un(i).pipe(De(e.executor.execute(n.job)))),o={jobId:n.job.jobId,fiber:a};r=o;let s=yield*t.read(n.job.jobId);s.status!==`found`||s.job.state!==`running`||s.cancellation.status===`present`?(s.status===`found`&&s.job.state===`settled`&&s.job.outcome===`failed`&&(o.failed=s.job),yield*Or(a)):yield*Cn(i,void 0);let c=yield*Rr(a).pipe(lt(xt(()=>{r?.fiber===a&&(r=void 0)})));if(o.failed!==void 0)return yield*e.wake.recompute().pipe(Ot({status:`settled`,job:o.failed}));let l=Vn(c)?c.value:{kind:`failed`,reason:kR(c.cause)},u=yield*t.settleExactClaim({jobId:n.job.jobId,claimToken:n.claimToken,decision:l});switch(u.status){case`settled`:case`replayed`:return yield*e.wake.recompute().pipe(Ot({status:`settled`,job:u.job}));case`conflict`:case`missing`:return yield*Je(new DR(`settlement_rejected`))}})),lt(xt(()=>{n=`idle`})))):Be({status:`busy`})),cancel:c,failLane:l,purge:u})},jR=V.check(Rn(1),K(512)),MR=V.check(Rn(1),K(256)),NR=cn.check(sn(-(2**53-1)),dn(2**53-1)),PR=cn.check(sn(0),dn(2**53-1)),FR=V.check(Rn(1),K(200)),IR=U({lane:jR,reason:FR});function LR(e){try{return Pr(IR,{onExcessProperty:`error`})(e)}catch(e){throw new DR(`store_invalid`,e)}}var RR=U({sequence:cn,job_id:MR,queue_name:MR,lane:jR,priority:NR,payload_json:V,recovery_max:wn(PR),state:Sr([`queued`,`running`,`settled`]),outcome:wn(Sr([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`])),claim_token:wn(MR),recovery_count:PR,cancellation_id:wn(MR),failure_reason:wn(FR)}),zR=dr(Yn),BR=Ur(RR,{onExcessProperty:`error`}),VR=Ur(zR),HR=qr(zR);function UR(e){return e===void 0?{predicate:`1 = 1`,values:[]}:{predicate:e.include?`lane = ?`:`lane <> ?`,values:[e.lane]}}var WR=`sequence, job_id, queue_name, lane, priority, payload_json,
53
+ recovery_max, state, outcome, claim_token, recovery_count,
54
+ cancellation_id, failure_reason`;function GR(e){return new DR(`store_unavailable`,e)}function KR(e){return Jt({try:e,catch:e=>e instanceof DR?e:GR(e)})}function qR(e){let t=HR(e);if(t._tag===`Failure`)throw GR(Xn(t.cause));return t.value}function JR(e){let t=BR(e);if(t._tag===`Failure`)throw GR(Xn(t.cause));let n=t.value,r=VR(n.payload_json);if(r._tag===`Failure`)throw GR(Xn(r.cause));let i=n.recovery_max===null?{jobId:n.job_id,queue:n.queue_name,lane:n.lane,priority:n.priority,payload:r.value}:{jobId:n.job_id,queue:n.queue_name,lane:n.lane,priority:n.priority,payload:r.value,recovery:{maxRecoveries:n.recovery_max}};if(n.state===`queued`)return{row:n,job:{...i,state:`queued`}};if(n.state===`running`){if(n.claim_token===null)throw GR();return{row:n,job:{...i,state:`running`}}}if(n.outcome===null)throw GR();let a={...i,state:`settled`,outcome:n.outcome};return{row:n,job:(n.outcome===`failed`||n.outcome===`interrupted`)&&n.failure_reason!==null?{...a,failureReason:n.failure_reason}:a}}function YR(e,t){let n=e.sql.exec(`SELECT ${WR}
55
+ FROM watchdog_jobs
56
+ WHERE job_id = ?`,t).toArray()[0];return n===void 0?void 0:JR(n)}function XR(e,t,n,r){let i=UR(r);return e.sql.exec(`SELECT ${WR} FROM watchdog_jobs NOT INDEXED WHERE state = 'settled' AND ${i.predicate} AND sequence > ?
57
+ AND sequence < COALESCE(
58
+ (SELECT MIN(sequence) FROM watchdog_jobs INDEXED BY idx_watchdog_ready
59
+ WHERE state IN ('queued', 'running') AND ${i.predicate}),
60
+ 9223372036854775807)
61
+ ORDER BY sequence ASC LIMIT ?`,...i.values,n??0,...i.values,t).toArray().map(e=>{let t=JR(e);if(t.job.state!==`settled`)throw GR();return{sequence:t.row.sequence,job:t.job}})}function ZR(e,t){let n=e.sql.exec(`SELECT ${WR}
62
+ FROM watchdog_jobs
63
+ WHERE queue_name = ? AND state IN ('running', 'queued')
64
+ ORDER BY CASE state WHEN 'running' THEN 0 ELSE 1 END,
65
+ priority DESC, sequence ASC
66
+ LIMIT 1`,t).toArray()[0];if(n===void 0)return{state:`idle`};let r=JR(n);if(r.job.state===`settled`)throw GR();return{state:r.job.state,jobId:r.job.jobId,cancellationRequested:r.row.cancellation_id!==null}}function QR(e,t){let n=e.sql.exec(`SELECT ${WR}
67
+ FROM watchdog_jobs
68
+ WHERE queue_name = ? AND state = 'settled'
69
+ ORDER BY sequence DESC
70
+ LIMIT 1`,t).toArray()[0];if(n===void 0)return;let r=JR(n);if(r.job.state!==`settled`)throw GR();return r.job}function $R(e,t,n,r){if(t===void 0)return;let i=ZR(e,n);t(r===void 0?{queue:n,head:i}:{queue:n,head:i,settled:r})}function ez(e){e.transactionSync(()=>{e.sql.exec(`
71
+ CREATE TABLE IF NOT EXISTS watchdog_jobs (
72
+ sequence INTEGER PRIMARY KEY AUTOINCREMENT,
73
+ job_id TEXT UNIQUE NOT NULL,
74
+ queue_name TEXT NOT NULL,
75
+ lane TEXT NOT NULL,
76
+ priority INTEGER NOT NULL,
77
+ payload_json TEXT NOT NULL,
78
+ recovery_max INTEGER,
79
+ state TEXT NOT NULL CHECK (state IN ('queued', 'running', 'settled')),
80
+ outcome TEXT CHECK (
81
+ outcome IS NULL OR outcome IN (
82
+ 'completed', 'failed', 'cancelled', 'outcome_unknown', 'interrupted'
83
+ )
84
+ ),
85
+ claim_token TEXT,
86
+ recovery_count INTEGER NOT NULL DEFAULT 0,
87
+ cancellation_id TEXT UNIQUE,
88
+ failure_reason TEXT,
89
+ CHECK (recovery_max IS NULL OR recovery_max >= 0),
90
+ CHECK (
91
+ (state = 'queued' AND outcome IS NULL AND claim_token IS NULL) OR
92
+ (state = 'running' AND outcome IS NULL AND claim_token IS NOT NULL) OR
93
+ (state = 'settled' AND outcome IS NOT NULL)
94
+ )
95
+ )
96
+ `),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_lane_failure
97
+ ON watchdog_jobs(lane, state DESC, sequence ASC)`),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_ready
98
+ ON watchdog_jobs(state, priority DESC, sequence ASC)`),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_queue_head
99
+ ON watchdog_jobs(queue_name, state, priority DESC, sequence ASC)`)})}function tz(e,t,n){let r=qR(n.payload),i=YR(e,n.jobId);if(i!==void 0){let e=i.job.recovery?.maxRecoveries,t=n.recovery?.maxRecoveries;if(i.job.queue!==n.queue||i.job.lane!==n.lane||i.job.priority!==n.priority||i.row.payload_json!==r||e!==t)throw GR();return!1}return e.sql.exec(`INSERT INTO watchdog_jobs
100
+ (job_id, queue_name, lane, priority, payload_json, recovery_max,
101
+ state, outcome, claim_token, recovery_count, cancellation_id)
102
+ VALUES (?, ?, ?, ?, ?, ?, 'queued', NULL, NULL, 0, NULL)`,n.jobId,n.queue,n.lane,n.priority,r,n.recovery?.maxRecoveries??null),$R(e,t,n.queue),!0}function nz(e,t,n){let r=YR(e,n.jobId);return r===void 0?{status:`missing`}:r.row.cancellation_id===null?n.onlyIfQueued===!0&&r.job.state!==`queued`?{status:`conflict`}:(e.sql.exec(`UPDATE watchdog_jobs
103
+ SET cancellation_id = ?
104
+ WHERE job_id = ? AND cancellation_id IS NULL`,n.cancellationId,n.jobId),$R(e,t,r.job.queue),{status:`recorded`,intent:n}):r.row.cancellation_id===n.cancellationId?{status:`replayed`,intent:n}:{status:`conflict`}}function rz(e,t,n,r){let i=UR(r);return e.transactionSync(()=>{let r=e.sql.exec(`SELECT ${WR}
105
+ FROM watchdog_jobs
106
+ WHERE state = 'queued' AND ${i.predicate}
107
+ AND (cancellation_id IS NOT NULL OR NOT EXISTS (
108
+ SELECT 1 FROM watchdog_jobs predecessor INDEXED BY idx_watchdog_queue_head
109
+ WHERE predecessor.queue_name = watchdog_jobs.queue_name
110
+ AND predecessor.state IN ('queued', 'running')
111
+ AND (predecessor.state = 'running' OR
112
+ (predecessor.state = 'queued' AND
113
+ (predecessor.priority > watchdog_jobs.priority OR
114
+ (predecessor.priority = watchdog_jobs.priority AND
115
+ predecessor.sequence < watchdog_jobs.sequence))))))
116
+ ORDER BY priority DESC, sequence ASC
117
+ LIMIT 1`,...i.values).toArray()[0];if(r===void 0)return{status:`no_ready`};let a=JR(r);if(a.job.state!==`queued`)return{status:`claim_unavailable`};if(a.row.cancellation_id!==null){e.sql.exec(`UPDATE watchdog_jobs
118
+ SET state = 'settled', outcome = 'cancelled'
119
+ WHERE job_id = ? AND state = 'queued' AND cancellation_id = ?`,a.job.jobId,a.row.cancellation_id);let n=YR(e,a.job.jobId)?.job;return n?.state!==`settled`||n.outcome!==`cancelled`?{status:`claim_unavailable`}:($R(e,t,n.queue,n),{status:`cancelled`,job:n})}e.sql.exec(`UPDATE watchdog_jobs
120
+ SET state = 'running', claim_token = ?
121
+ WHERE job_id = ? AND state = 'queued'`,n,a.job.jobId);let o=YR(e,a.job.jobId)?.job;return o?.state===`running`?($R(e,t,o.queue),{status:`claimed`,job:o,claimToken:n}):{status:`claim_unavailable`}})}function iz(e,t,n){return e.transactionSync(()=>{let r=YR(e,n.jobId);if(r===void 0)return{status:`missing`};let i=r.row.cancellation_id===null?n.decision.kind:`cancelled`;if(r.job.state===`settled`)return r.row.claim_token===n.claimToken&&r.job.outcome===i?{status:`replayed`,job:r.job}:{status:`conflict`};if(r.job.state!==`running`||r.row.claim_token!==n.claimToken)return{status:`conflict`};e.sql.exec(`UPDATE watchdog_jobs
122
+ SET state = 'settled', outcome = ?, failure_reason = ?
123
+ WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i,i===`failed`&&n.decision.kind===`failed`?n.decision.reason??null:null,n.jobId,n.claimToken);let a=YR(e,n.jobId)?.job;return a?.state===`settled`?($R(e,t,a.queue,a),{status:`settled`,job:a}):{status:`conflict`}})}function az(e,t,n){ez(e);let r=Object.freeze({readQueueHead:t=>ZR(e,t),readLatestSettledJob:t=>QR(e,t),enqueueAcceptedJob:n=>{tz(e,t,n)},recordCancellationIntent:n=>nz(e,t,n)}),i=n=>{let r=UR(n);return Object.freeze({hasPendingWork:KR(()=>e.sql.exec(`SELECT 1 FROM watchdog_jobs WHERE state IN ('queued', 'running') LIMIT 1`).toArray().length!==0),ingest:n=>KR(()=>e.transactionSync(()=>({status:tz(e,t,n)?`queued`:`duplicate`}))),read:t=>KR(()=>{let n=YR(e,t);return n===void 0?{status:`missing`}:{status:`found`,job:n.job,claimToken:n.row.claim_token,recoveryCount:n.row.recovery_count,cancellation:n.row.cancellation_id===null?{status:`absent`}:{status:`present`,cancellation:{jobId:t,cancellationId:n.row.cancellation_id}}}}),readQueueHead:t=>KR(()=>ZR(e,t)),readSettled:(t,r)=>KR(()=>XR(e,t,r,n)),selectAndClaim:r=>KR(()=>rz(e,t,r,n)),settleExactClaim:n=>KR(()=>iz(e,t,n)),recordCancellation:n=>KR(()=>e.transactionSync(()=>({status:nz(e,t,n).status}))),failLane:n=>KR(()=>{let r=LR(n);return e.transactionSync(()=>{let n=e.sql.exec(`SELECT ${WR} FROM watchdog_jobs
124
+ WHERE lane = ? AND state IN ('queued', 'running')
125
+ ORDER BY state DESC, sequence ASC LIMIT ?`,r.lane,256).toArray(),i=[];for(let a of n){let n=JR(a);e.sql.exec(`UPDATE watchdog_jobs SET state = 'settled', outcome = 'failed', failure_reason = ?, claim_token = NULL
126
+ WHERE job_id = ? AND state IN ('queued', 'running')`,r.reason,n.job.jobId);let o=YR(e,n.job.jobId)?.job;if(o?.state!==`settled`||o.outcome!==`failed`)throw GR();$R(e,t,o.queue,o),i.push(o)}return{jobs:i,more:e.sql.exec(`SELECT 1 FROM watchdog_jobs WHERE lane = ? AND state IN ('queued', 'running') LIMIT 1`,r.lane).toArray().length!==0}})}),purgeQueued:n=>KR(()=>{e.transactionSync(()=>{e.sql.exec(`DELETE FROM watchdog_jobs
127
+ WHERE queue_name = ? AND state = 'queued'`,n),$R(e,t,n)})}),nextRunningClaim:()=>KR(()=>{let t=e.sql.exec(`SELECT ${WR}
128
+ FROM watchdog_jobs
129
+ WHERE state = 'running' AND ${r.predicate}
130
+ ORDER BY sequence ASC
131
+ LIMIT 1`,...r.values).toArray()[0];if(t===void 0)return;let n=JR(t);if(n.job.state!==`running`||n.row.claim_token===null)throw GR();return{job:n.job,claimToken:n.row.claim_token,recoveryCount:n.row.recovery_count}}),reconcileDisappearedClaim:n=>KR(()=>e.transactionSync(()=>{let r=YR(e,n.job.jobId);if(r===void 0)return{status:`missing`};if(r.job.state!==`running`||r.row.claim_token!==n.claimToken||r.row.recovery_count!==n.recoveryCount)return{status:`conflict`};if(n.disposition===`requeue`&&r.row.cancellation_id===null)return e.sql.exec(`UPDATE watchdog_jobs
132
+ SET state = 'queued', claim_token = NULL,
133
+ recovery_count = recovery_count + 1
134
+ WHERE job_id = ? AND state = 'running' AND claim_token = ?`,n.job.jobId,n.claimToken),$R(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
135
+ SET state = 'settled', outcome = ?, failure_reason = ?
136
+ WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i?`cancelled`:`interrupted`,a,n.job.jobId,n.claimToken);let o=YR(e,n.job.jobId)?.job;return o?.state===`settled`?($R(e,t,o.queue,o),{status:`settled`,job:o}):{status:`conflict`}}))})};return Object.freeze({store:i(n),partition:i,transactional:r})}var oz=V.check(Rn(1),K(256)),sz=V.check(Rn(1),K(200)),cz=cn.check(sn(-(2**53-1)),dn(2**53-1)),lz=cn.check(sn(0),dn(2**53-1)),uz=U({maxRecoveries:lz}),dz={jobId:oz,queue:oz,lane:jR,priority:cz,payload:Yn,recovery:W(uz)},fz=U({...dz,state:B(`queued`)}),pz=U({...dz,state:B(`settled`),outcome:Sr([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`]),failureReason:An(sz)}),mz=U({...dz,state:B(`running`)}),hz=xn([fz,mz,pz]);xn([U({kind:B(`completed`)}),U({kind:B(`failed`),reason:An(sz)}),U({kind:B(`cancelled`)}),U({kind:B(`outcome_unknown`)})]);var gz=U({jobId:oz,cancellationId:oz,onlyIfQueued:W($r)}),_z=xn([U({status:B(`absent`)}),U({status:B(`present`),cancellation:gz})]);xn([U({status:B(`found`),job:hz,cancellation:_z}),U({status:B(`missing`)})]),xn([U({state:B(`idle`)}),U({state:Sr([`queued`,`running`]),jobId:oz,cancellationRequested:$r})]),xn([U({status:B(`queued`)}),U({status:B(`duplicate`)})]),xn([U({status:Sr([`recorded`,`replayed`])}),U({status:Sr([`conflict`,`missing`])})]);var vz=xn([Lr(ArrayBuffer),V,Pn,vn]);ai(V,vz);function yz(e){return Jt({try:()=>{let t=e.concurrentLane===void 0?void 0:Pr(jR)(e.concurrentLane),n=az(e.owner,e.project,t===void 0?void 0:{lane:t,include:!1}),r=AR(e,n.store),i={...r,transactional:n.transactional};if(t===void 0)return Object.freeze(i);let a=AR(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(Wt(n=>n.status===`found`&&n.job.lane===t?a.cancel(e):r.cancel(e)))})},catch:e=>new DR(`store_unavailable`,e)})}var bz=e=>({owner:e.owner,project:e.project,isAlive:t=>Lt({try:()=>e.isAlive(t),catch:e=>new DR(`liveness_unavailable`,e)}),executor:{execute:t=>Lt({try:n=>e.execute(t,n),catch:()=>new DR(`execution_failed`)})},wake:{recompute:()=>Lt({try:()=>e.wake.recompute(),catch:()=>new DR(`wake_unavailable`)})}}),xz=e=>Dt(e).then(e=>{if(Vn(e))return e.value;let t=we(yn(e.cause))??Xn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))});function Sz(e){let t=bz(e);return e.concurrentLane===void 0?xz(yz(t)).then(Cz):xz(yz({...t,concurrentLane:e.concurrentLane})).then(e=>Object.freeze({...Cz(e),tickConcurrent:()=>xz(e.tickConcurrent())}))}function Cz(e){return Object.freeze({hasPendingWork:()=>xz(e.hasPendingWork),ingest:t=>xz(e.ingest(t)),read:t=>xz(e.read(t)),readQueueHead:t=>xz(e.readQueueHead(t)),tick:()=>xz(e.tick()),cancel:t=>xz(e.cancel(t)),failLane:t=>xz(e.failLane(t)),purge:t=>xz(e.purge(t)),transactional:e.transactional})}Object.freeze({make:Sz});function wz(e){return he(()=>ui(()=>import(`./runtime-core-BHRx5Fxu.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]))).pipe(Wt(({openRuntimeCore:t})=>t(e)),x(({agent:e})=>e))}function Tz(e){return e instanceof Br?e:new Br(`model`,`rejected`,`Model acquisition failed`,void 0,e)}function Ez(e){return new Br(`model`,`rejected`,`Model release failed`,void 0,e)}function Dz(e){let t=Lt({try:()=>e.release(),catch:Ez}),n={model:e.model,release:t,retryable:e.retryable};return e.failureReason!==void 0&&(n={...n,failureReason:e.failureReason}),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 Oz(e){return at((t,n)=>{if(n.aborted)return;let r;try{r=Promise.resolve(e(n))}catch(e){t(Je(Tz(e)));return}let i=r.then(e=>{if(n.aborted)return Promise.resolve(e.release()).then(()=>void 0);t(Be(Dz(e)))},e=>{n.aborted?Qn(`late-model-acquisition`,e):t(Je(Tz(e)))});return Lt({try:()=>i,catch:Ez}).pipe(ye)})}function kz(e){let t,n=Ut(n=>Wt(n(e),e=>xt(()=>(t=e,e))));return At(n,()=>t===void 0?I:t.release.pipe(ye),{interruptible:!0})}function Az(e){let t=({sessionId:t,preference:n})=>Oz(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})=>Lt({try:r=>n({sessionId:e,preference:t,signal:r}),catch:Tz})})}function jz(e,t){return new Br(e,`rejected`,t)}var Mz=V.pipe(G(Rn(1)),G(K(256))),Nz=V.pipe(G(Rn(1)),G(Gn(e=>new TextEncoder().encode(e).byteLength<=32e3))),Pz=U({revision:Mz,text:Nz,modules:An(Mn(e=>Array.isArray(e)&&e.every(ut)))}),Fz=Mn(e=>st(e)),Iz=Mn(e=>st(e)),Lz=U({bind:Fz}),Rz=Mn(e=>st(e)),zz=U({commit:Rz,requestWake:Iz,close:Iz}),Bz=U({close:Iz}),Vz=tr(Pz),Hz=tr(Lz),Uz=tr(zz),Wz=tr(Bz);function Gz(e){return new Br(`runtime`,`invalid`,`Runtime host is invalid`,void 0,e)}function Kz(){return new Br(`runtime`,`unavailable`,`Runtime host is unavailable`)}function qz(e,t){return Jt({try:()=>t.call(e),catch:Kz}).pipe(Wt(e=>Lt({try:()=>Promise.resolve(e),catch:Kz})),Wt(e=>e===void 0?I:Je(Gz())))}function Jz(e,t,n){let r=Wz({close:t});return r._tag===`Failure`?Je(Gz(n)):Pe(qz(e,r.success.close)).pipe(R({onFailure:e=>Je(Gz({cause:n,cleanup:e})),onSuccess:()=>Je(Gz(n))}))}function Yz(e){return qe(()=>{if(!ut(e))return Je(Gz());let t=e,n;try{n=t.close}catch(e){return Je(Gz(e))}let r;try{r=t.requestWake}catch(e){return Jz(t,n,e)}let i=Uz({commit:t.commit,requestWake:r,close:n});return i._tag===`Failure`?Jz(t,n):Be(Object.freeze({commit:e=>Lt({try:()=>t.commit(()=>BM(e)),catch:e=>e instanceof Br?e:Kz()}),requestWake:qz(t,i.success.requestWake),close:qz(t,i.success.close)}))})}function Xz(e){return Jt({try:()=>{let t=e.runtime;if(!ut(t))throw Gz();let n=Hz(t);if(n._tag===`Failure`)throw Gz();return{receiver:t,bind:n.success.bind}},catch:Gz}).pipe(x(({receiver:e,bind:t})=>Object.freeze({bind:({reconcile:n,pendingWork:r})=>Jt({try:()=>t.call(e,{reconcile:()=>BM(n),pendingWork:()=>BM(r)}),catch:Kz}).pipe(Wt(e=>Lt({try:()=>Promise.resolve(e),catch:Kz})),Wt(Yz))})))}function Zz(e,t){let n={store:e.store,runtime:t,extensions:e.extensions,instructions:{load:({sessionId:t,commandId:n})=>Lt({try:r=>e.instructions.load({sessionId:t,commandId:n,signal:r}),catch:()=>jz(`instructions`,`Instruction acquisition failed`)}).pipe(Wt(e=>{let t=Vz(e);return t._tag===`Success`?Be(t.success):Je(new Br(`contract`,`invalid`,`Instruction revision is invalid`))}))},model:Az(e.model)};e.meta!==void 0&&Object.assign(n,{meta:e.meta}),e.storagePressure!==void 0&&Object.assign(n,{storagePressure:e.storagePressure}),e.compaction!==void 0&&Object.assign(n,{compaction:e.compaction});let r=e.tools;return r===void 0?n:{...n,tools:zM(r)}}function Qz(e,t){return BM(Xz(e).pipe(Wt(n=>t(Zz(e,n))))).then(GM)}Object.freeze({make:e=>Qz(e,wz)});var $z=200,eB=yt({action:Oe(`list`)}),tB=Re(z(),wt()).parse(structuredClone(ae(eB))),nB=120,rB=yt({title:z()}).optional().transform(e=>e?.title.trim().replaceAll(/\s+/gu,` `)??``),iB=4096,aB=yt({instructions:z()}).optional().transform(e=>e?.instructions.trim()??``);function oB(e,t){return e?.notify({type:`info`,message:t}),t}function sB(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 oB(e,`Session ${n.sessionId} is ${zP(FP(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:tB},handler:async({arguments:e,interaction:n})=>{if(!eB.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}`);oB(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(`
137
+ `))}},{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(zP(FP(a))!==`idle`)throw Error(`Wait for the current run to finish, then fork.`);let o=gL(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,$z),c=await e.prompt({type:`choice`,message:`Fork from message`,options:s.map(e=>({value:e.id,label:e.text.slice(0,100)||`(empty message)`}))}),l=await e.run(async()=>{try{return await t.command({type:`fork`,entryId:c})}catch(e){if(e instanceof Br){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(l.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=aB.safeParse(e);if(!n.success)throw Error(`Use /compact, or /compact <what to focus on>.`);let r=n.data;if(r.length>iB)throw Error(`Compaction instructions are at most ${String(iB)} characters.`);return await t.command(r.length===0?{type:`compact`,requestId:ar()}:{type:`compact`,requestId:ar(),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=rB.safeParse(e);if(!r.success)throw Error(`Use /name <title>, or /name to clear it.`);let i=r.data;if(Array.from(i).length>nB)throw Error(`A conversation title is at most ${String(nB)} 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 cB=new Set([`Esc`,`Ctrl+C`]);function lB(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=>cB.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 uB=` · `;function dB(e){return e.map(e=>`${e.keys} ${e.label}`).join(uB)}function fB(e,t,n){setTimeout(()=>{e.execute(t,{origin:n})},0)}function pB(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=OL(e.snapshot()).filter(e=>e.alias!==`help`);if(n.interaction===void 0)return r.map(e=>`/${e.alias}`);fB(e,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(`, `)}`}))}),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=kL(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}fB(e,await t.interaction.prompt({type:`choice`,message:`Key bindings`,options:n.map(e=>({value:e.commandId,label:e.title,description:e.keys}))}),t.origin)}},{id:`clear`,title:`Clear the composer`,category:`Advanced`,projections:{help:{order:-1},slash:{aliases:[`clear`],order:-1}},handler:()=>{t.clear()}}]}var mB=Dr(U({cancelled:B(!0)})),hB=Dr(Vr(ai(V,En)));function gB(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=DN(f.catalog),p=jN(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=jN(u,async(e,t)=>{let n=await l.call(e,t),r=kN(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`&&hB(t.arguments)&&!mB(_)&&!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 _B(e){if(e!==void 0&&e.status!==`handled`)return e.status===`failed`?e.error.message:e.status===`unavailable`?e.reason:`Command ${e.status}`}function vB(e){let{commands:t,origin:n}=e,r=e.enabled??!0,i=xR(),a=yR(),o=SR(),s=wR(),c=(0,q.useRef)(s);c.current=s;let l=TR(),u=(0,q.useMemo)(()=>e.interactionStore??l,[e.interactionStore,l]),d=(0,q.useSyncExternalStore)(u.subscribe,u.snapshot,u.snapshot);(0,q.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=(0,q.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),p=(0,q.useRef)(a);p.current=a;let m=(0,q.useRef)(e.showCommands);m.current=e.showCommands;let h=e.showCommands!==void 0;(0,q.useEffect)(()=>{if(r)return u.attach(t.present)},[t,r,u]),(0,q.useEffect)(()=>{if(!r)return;let e=t.contribute({sourceId:`parakeet`,namespace:`parakeet`,commands:pB(t,{showCommands:h?()=>m.current?.():void 0,clear:()=>{p.current.setDraft(``),u.report(void 0)}})});return()=>{e.dispose()}},[t,r,u,h]);let g=(0,q.useMemo)(()=>gB(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,q.useEffect)(()=>()=>{g.dispose()},[g]),(0,q.useEffect)(()=>{if(!r){g.dispose();return}let[e]=g.update(o);e!==void 0&&u.report({tone:`error`,message:`${e.extensionId} commands are unavailable: ${e.message}`})},[g,r,o,s,u]);let _=(0,q.useMemo)(()=>OL(f),[f]),[v,y]=(0,q.useState)(),[b,x]=(0,q.useState)({draft:``,index:0}),S=a.draft,C=!r||v===S||d.open!==void 0?{kind:`none`}:FL(_,S),w=C.kind===`none`?0:C.items.length,T=C.kind===`arguments`||C.kind===`commands`&&w>0,E=b.draft===S?Math.min(b.index,Math.max(0,w-1)):0,D=lB({completion:C,busy:e.busy,bindings:kL(f),keys:e.keys}),O=(0,q.useCallback)((e,i)=>{let a=p.current;if(!r){a.send(e);return}i!==void 0&&a.setDraft(i);let o=i??a.draft;u.report(void 0),y(o),a.submitCommand((r,i)=>RL(r,t,()=>{a.send(e)},n,i)).then(e=>{let t=_B(e);t!==void 0&&u.snapshot().open===void 0&&u.lastEnd()!==`cancelled`&&u.report({tone:`error`,message:`${o}: ${t}`})})},[t,r,n,u]),k=e=>{if(C.kind===`commands`||C.kind===`arguments`)return C.items[e]?.insert};return{completion:C,open:T,selected:E,hints:D,interactions:d,store:u,move:e=>w!==0&&(x({draft:S,index:(E+e+w)%w}),!0),highlight:e=>{x({draft:S,index:e})},complete:()=>{let e=k(E);return e!==void 0&&(a.setDraft(e),!0)},dismiss:()=>d.open===void 0?d.inspection===void 0?T?(y(S),!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=(C.kind===`commands`||C.kind===`arguments`&&C.query.length>0)&&w>0?k(E):void 0;O(t,n?.trimEnd())},choose:t=>{let n=k(t);n!==void 0&&O(e.busy?`followUp`:`steer`,n.trimEnd())}}}function yB(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
138
+ `)}function bB(e){return/^\s*$/.test(e)}function xB(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function SB(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=SB(n.children):n.type===`image`&&(t+=n.alt);return t}function CB(){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 wB(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 TB(e){return e.trim().toLowerCase()}function EB(e){return TB(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function DB(e,t={}){let n=qB(AB(e,t));for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var OB=32,kB=16;function AB(e,t,n={scans:Math.max(e.length*kB,1024),depth:0}){if(n.depth>=OB)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===`
139
+ `){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[\\`*_[\]{}()#+\-.!|~<>]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=IB(e,i,"`"),s=LB(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=MB(e,i+1,t,n);if(a){o(),r.push({type:`image`,src:wB(a.href),alt:KB(a.label,n),...a.title?{title:a.title}:{}}),i=a.end;continue}}if(s===`[`){let a=jB(e,i,t,n);if(a){o(),r.push(a.node),i=a.end;continue}let s=MB(e,i,t,n);if(s){let e=wB(s.href);o(),e?r.push({type:`link`,href:e,...s.title?{title:s.title}:{},children:AB(s.label,t,n)}):r.push(...AB(s.label,t,n)),i=s.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=RB(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:AB(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`*`&&c===`*`||s===`_`&&c===`_`){let l=s===`_`&&!HB(e,i,2,!0)?-1:RB(e,i+2,s+s,n);if(l!==-1){o(),r.push({type:`strong`,children:AB(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=IB(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`~`&&c===`~`){let s=RB(e,i+2,`~~`,n);if(s!==-1){o(),r.push({type:`strike`,children:AB(e.slice(i+2,s),t,n)}),i=s+2;continue}a+=`~~`,i+=2;continue}if(s===`~`){let a=zB(e,i+1,n);if(a!==-1){o(),r.push({type:`strike`,children:AB(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`*`||s===`_`){let a=s===`_`&&!HB(e,i,1,!0)?-1:RB(e,i+1,s,n);if(a!==-1){o(),r.push({type:`emphasis`,children:AB(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`<`&&t.allowHtml){let t=BB(e,i+1,`>`,n);if(t!==-1&&NB(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 jB(e,t,n,r){if(e[t+1]!==`^`)return;let i=BB(e,t+2,`]`,r);if(i===-1)return;let a=TB(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??(EB(o.label)||`footnote`),number:s+1,...c>1?{referenceIndex:c}:{}},end:i+1}}function MB(e,t,n,r){let i=FB(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i);if(e[i+1]===`(`){let t=FB(e,i+1,`(`,`)`,r);if(t===-1)return;let n=PB(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=FB(e,i+1,`[`,`]`,r);if(t===-1)return;let o=e.slice(i+2,t),s=n.references?.[TB(o||a)];return s?{label:a,href:s.href,...s.title?{title:s.title}:{},end:t+1}:void 0}let o=n.references?.[TB(a)];if(o)return{label:a,href:o.href,...o.title?{title:o.title}:{},end:i+1}}function NB(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 PB(e){let t=e.match(/^(\S+)(?:\s+["']([^"']*)["'])?$/);return t?{href:t[1].replace(/^<|>$/g,``),...t[2]?{title:t[2]}:{}}:{href:e}}function FB(e,t,n,r,i){let a=0;for(let o=t;o<e.length;o++){if(!VB(i))return-1;if(e[o-1]!==`\\`&&(e[o]===n&&a++,e[o]===r&&(a--,a===0)))return o}return-1}function IB(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&!VB(r));)i++;return i}function LB(e,t,n,r,i){for(let a=t;a<e.length;a++){if(!VB(i))return-1;if(e[a]===n&&IB(e,a,n,i)>=r)return a}return-1}function RB(e,t,n,r){for(let i=t;i<e.length;i++){if(!VB(r))return-1;if(e[i-1]!==`\\`&&(n!==`~~`||e[i-1]!==`~`&&e[i+2]!==`~`)&&!(n[0]===`_`&&!HB(e,i,n.length,!1))&&e.startsWith(n,i))return i}return-1}function zB(e,t,n){if(GB(e[t]??``)||/\d/.test(e[t]??``))return-1;for(let r=t;r<e.length;r++){if(!VB(n))return-1;if(e[r-1]!==`\\`&&e[r]===`~`&&e[r-1]!==`~`&&e[r+1]!==`~`)return GB(e[r-1]??``)?-1:r}return-1}function BB(e,t,n,r){for(let i=t;i<e.length;i++){if(!VB(r))return-1;if(e[i]===n)return i}return-1}function VB(e){return e.scans<=0?!1:(e.scans--,!0)}function HB(e,t,n,r){let i=e[t-1],a=e[t+n],o=!UB(a)&&(!WB(a)||UB(i)||WB(i)),s=!UB(i)&&(!WB(i)||UB(a)||WB(a));return r?o&&(!s||WB(i)):s&&(!o||WB(a))}function UB(e){return e===void 0||/\s/.test(e)}function WB(e){return e!==void 0&&/[^\p{L}\p{N}\s]/u.test(e)}function GB(e){return/\s/.test(e)}function KB(e,t){return AB(e,{},t).map(e=>e.type===`text`||e.type===`inlineCode`?e.value:``).join(``)}function qB(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 JB=64;function YB(e,t={}){let n=yB(e),r=t.frontmatter!==!1,i=n.split(`
140
+ `),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
141
+ `),i=i.slice(e+1))}let o=QB(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=new XB(i,d,CB()).parse();u&&s.length>0&&f.push($B(o.footnotes,s,d));let p=a===void 0?{type:`root`,children:f}:{type:`root`,frontmatter:a,children:f};for(let e of d.extensions??[])p=e.transformDocument?.(p,{options:d})??p;return p}var XB=class e{lines;options;slugger;budget;index=0;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=JB){let e=this.lines.slice(this.index).join(`
142
+ `);return this.index=this.lines.length,e?[{type:`paragraph`,children:DB(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(bB(this.current())){this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>DB(e,this.options),parseBlocks:t=>new e(yB(t).split(`
143
+ `),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[1],n=t[0],r=t.length,i=e[2].trim(),a=[];for(this.index++;this.index<this.lines.length;){let e=this.current(),t=e.match(/^ {0,3}(`{3,}|~{3,})\s*$/);if(t&&t[1][0]===n&&t[1].length>=r){this.index++;break}a.push(e),this.index++}return{type:`code`,value:a.join(`
144
+ `),...ZB(i)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=DB((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current();if(bB(e)){t.push(``),this.index++;continue}let n=e.match(/^ {0,3}>\s?(.*)$/);if(!n)break;t.push(n[1]),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=tV(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=r?t.number:void 0,o=!1;for(;this.index<this.lines.length;){let r=tV(this.current());if(!r||!nV(r,t)||r.indent!==i)break;let a=r.content,s=a.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(a=s[2]);let l=[a];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=tV(e);if(n&&n.indent===i)break;if(bB(e)){let e=this.index;for(;e<this.lines.length&&bB(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let a=tV(n);if(a?.indent===i){if(!nV(a,t))break;o=!0,this.index=e;break}if(rV(n)<r.contentIndent)break;o=!0,l.push(``),this.index=e;continue}if(rV(e)>=r.contentIndent){l.push(xB(e,r.contentIndent)),this.index++;continue}if(iV(e,this.next()))break;l.push(e.trimStart()),this.index++}let u={type:`listItem`,children:new e(l,this.options,this.slugger,this.budget).parse()};c!==void 0&&(u.checked=c),n.push(u)}return{type:`list`,ordered:r,...r&&a!==void 0?{start:a}:{},...o&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!aV(e,t))return;let n=oV(e),r=oV(t).map(sV),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(bB(e)||iV(e,this.next()))break;let t=oV(e);a.push(Array.from({length:i},(e,n)=>cV(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>cV(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
145
+ `)}}for(;this.index<this.lines.length&&!bB(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
146
+ `)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(bB(t)||e.length>0&&iV(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:DB(e.join(`
147
+ `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=SB(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 ZB(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=eV(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 QB(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=TB(t);if(!n[o]){let e=EB(t)||`footnote`,i=(r.get(e)??0)+1;r.set(e,i),n[o]={label:t,content:a.join(`
148
+ `),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[TB(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 $B(e,t,n){let r=[];for(let i=0;i<t.length;i++){let a=e[t[i]];a&&r.push({id:a.id??(EB(a.label)||`footnote`),number:i+1,children:new XB(yB(a.content).split(`
149
+ `),n,CB()).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 eV(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 tV(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 nV(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function rV(e){return e.match(/^ */)?.[0].length??0}function iV(e,t){let n=tV(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&&aV(e,t)}function aV(e,t){if(!e.includes(`|`))return!1;let n=oV(t);return n.length===oV(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function oV(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 sV(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function cV(e,t){return{type:`tableCell`,children:DB(e,t)}}function lV(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 uV(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 lV(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||!lV(l).includes(i)||s&&l.value.waiting?.cancel!==i)return;let u=o(r,i);if(a.get(u)?.pending)return;c(u,{pending:!0});let d={run:e=>e(),signal:t.signal,prompt:()=>Promise.reject(new vi(`client_waiting_prompt`,`A waiting cancellation cannot request an answer`)),notify:t=>{n()||t.type===`success`||e.interactions.toast({variant:`info`,message:t.type===`handoff`?t.message??t.url:t.message})}},f;try{let n={origin:`menu`,signal:t.signal};i.input!==void 0&&(n={...n,arguments:i.input}),s&&(n={...n,interaction:d}),f=await e.commands.execute(`${r}:${i.id}`,n)}catch(t){if(eI(`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 p=f.status===`handled`?void 0:f.status===`failed`?f.error.message:f.status===`unavailable`?f.reason:`Client row command ${f.status}`;c(u,p===void 0?{pending:!1}:{pending:!1,error:p}),p!==void 0&&e.interactions.report({tone:`error`,message:p})},dispose:()=>{t.abort(),i=new Map,a.clear(),r.clear()}}}var dV=new Map,fV=()=>dV,pV=()=>()=>void 0;function mV(e){let t=wR(),{observation:n}=CR(),r=TR(),i=xR(),[a,o]=(0,q.useState)(),s=(0,q.useRef)({contributions:t,observation:n});return s.current={contributions:t,observation:n},(0,q.useEffect)(()=>{let t=uV({commands:e,contributions:()=>s.current.contributions,online:()=>s.current.observation.status===`live`,interactions:r});return o(t),()=>{t.dispose()}},[e,r,i]),(0,q.useEffect)(()=>{a?.refresh()},[a,t]),{state:(0,q.useSyncExternalStore)(a?.subscribe??pV,a?.snapshot??fV,a?.snapshot??fV),enabled:a!==void 0&&n.status===`live`,execute:(e,t,n=!1)=>a?.execute(e,t,n)??Promise.resolve()}}function hV(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 gV(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:hV(i),after:new Map([...r].map(([e,t])=>[e,hV(t)])),unanchored:hV(a),omitted:e.flatMap(({entryId:e,value:t})=>t.timeline.omitted===0?[]:[{entryId:e,count:t.timeline.omitted}])}}var _V=q.createContext(void 0);function vV(e){let t=q.useContext(_V);if(!e&&t===void 0)throw Error(vD(27));return t}var yV=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=vV(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return JD(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Dk,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),bV=q.createContext(void 0);function xV(e=!1){let t=q.useContext(bV);if(t===void 0&&!e)throw Error(vD(16));return t}function SV(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:q.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 CV(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(bO(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 wV(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=q.useRef(null),s=xV(!0),c=a??s!==void 0,{props:l}=SV({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=q.useCallback(()=>{let e=o.current;TV(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return tj(u,[u]),{getButtonProps:q.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return FD({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(GD(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=TV(r),s=!i&&EV(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(),CV(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),CV(r,e)))},onKeyUp(e){if(!t){if(GD(e),a?.(e),e.target===e.currentTarget&&i&&c&&TV(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),CV(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:sD(e=>{o.current=e,u()})}}function TV(e){return wO(e)&&e.tagName===`BUTTON`}function EV(e){return wO(e)&&e.tagName===`A`&&!!e.href}function DV(e,t,n,r){let i=!1,a=!1,o=r??fD;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 OV=`none`,kV=`trigger-press`,AV=`trigger-hover`,jV=`outside-press`,MV=`close-press`,NV=`focus-out`,PV=`escape-key`,FV=`imperative-action`,IV=q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=vV(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=wV({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,DV(MV,e.nativeEvent))}return JD(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),LV=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=vV(),c=lO(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),JD(`p`,e,{ref:t,props:[{id:c},o]})});function RV(e,t){return t!=null&&!Hk(t)?0:typeof e==`function`?e():e}function zV(e,t,n){let r=RV(e,n);return typeof r==`number`?r:r?.[t]}function BV(e){return typeof e==`function`?e():e}function VV(e,t){return t||e===`click`||e===`mousedown`}function HV(e){return e?.includes(`mouse`)&&e!==`mousedown`}function UV(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function WV(e){let t=iD(GV,e).current;return t.next=e,tj(t.effect),t}function GV(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var KV=null;globalThis.requestAnimationFrame;var qV=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)}},JV=class e{static create(){return new e}static request(e){return qV.request(e)}static cancel(e){return qV.cancel(e)}currentId=KV;request(e){this.cancel(),this.currentId=qV.request(()=>{this.currentId=KV,e()})}cancel=()=>{this.currentId!==KV&&(qV.cancel(this.currentId),this.currentId=KV)};disposeEffect=()=>this.cancel};function YV(){let e=iD(JV.create).current;return pD(e.disposeEffect),e}var XV={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ZV={...XV,position:`fixed`,margin:0,top:0,left:0};({...XV});var QV=q.forwardRef(function(e,t){let[n,r]=q.useState();tj(()=>{tk&&ek&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:ZV,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function $V(e){return`data-base-ui-${e}`}var eH=0;function tH(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(eH);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),uD;let o=requestAnimationFrame(a);return eH=o,()=>{eH===o&&(cancelAnimationFrame(o),eH=0)}}var nH=`data-base-ui-inert`,rH=new WeakMap,iH=new WeakSet,aH=new WeakMap,oH=0;function sH(e){return e?TO(e)?e.host:sH(e.parentNode):null}var cH=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=sH(t);return e.contains(n)?n:null}).filter(e=>e!=null),lH=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},uH=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{yO(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function dH(e,t,n,{mark:r=!0}){let i=cH(t,e),a=r?uH(t,lH(i),new Set(i)):[],o=[],s=[];if(n){let e=cH(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);uH(t,lH(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(rH.get(e)||0)+1;rH.set(e,r),o.push(e),r===1&&n&&iH.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(aH.get(e)||0)+1;aH.set(e,t),s.push(e),t===1&&e.setAttribute(nH,``)}),oH+=1,()=>{o.forEach(e=>{let t=(rH.get(e)||0)-1;rH.set(e,t),t||(iH.has(e)||e.removeAttribute(`aria-hidden`),iH.delete(e))}),r&&s.forEach(e=>{let t=(aH.get(e)||0)-1;aH.set(e,t),t||e.removeAttribute(nH)}),--oH,oH||(rH=new WeakMap,iH=new WeakSet,aH=new WeakMap)}}function fH(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=yA(e[0]).body;return dH(e,i,n,{mark:r})}var pH={style:{transition:`none`}},mH=`data-base-ui-click-trigger`,hH={fallbackAxisSide:`end`},gH={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},_H=q.createContext(null),vH=()=>q.useContext(_H),yH=$V(`portal`);function bH(e={}){let{ref:t,container:n,componentProps:r=fD,elementProps:i}=e,a=cO(),o=vH()?.portalNode,[s,c]=q.useState(null),[l,u]=q.useState(null),d=sD(e=>{e!==null&&u(e)}),f=q.useRef(null);tj(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(SO(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=JD(`div`,r,{ref:[t,d],props:[{id:a,[yH]:``},i]}),m=s&&p?ER.createPortal(p,s):null;return{node:l,nodeId:q.isValidElement(p)?p.props.id:void 0,subtree:m}}var xH=q.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}=bH({container:o,ref:t,componentProps:e,elementProps:c}),f=q.useRef(null),p=q.useRef(null),m=q.useRef(null),h=q.useRef(null),[g,_]=q.useState(null),v=q.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;q.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&BA(e)&&(e.type===`focusin`?v.current&&=(HA(l),!1):(VA(l),v.current=!0))}return UV(Sj(l,`focusin`,e,!0),Sj(l,`focusout`,e,!0))},[l,y]),tj(()=>{!l||b!==!0||!v.current||(HA(l),v.current=!1)},[b,l]);let S=q.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,X.jsxs)(q.Fragment,{children:[d,(0,X.jsxs)(_H.Provider,{value:S,children:[x&&l&&(0,X.jsx)(QV,{"data-type":`outside`,ref:f,onFocus:e=>{BA(e,l)?m.current?.focus():RA(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:gH}),l&&ER.createPortal(a,l),x&&l&&(0,X.jsx)(QV,{"data-type":`outside`,ref:p,onFocus:e=>{BA(e,l)?h.current?.focus():(LA(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,DV(`focus-out`,e.nativeEvent)))}})]})]})});function SH(){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 CH=class{nodesRef={current:[]};events=SH();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)}},wH=q.createContext(null),TH=q.createContext(null),EH=()=>q.useContext(wH)?.id||null,DH=e=>{let t=q.useContext(TH);return e??t};function OH(e){let t=cO(),n=DH(e),r=EH();return tj(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function kH(e){let{children:t,id:n}=e,r=EH();return(0,X.jsx)(wH.Provider,{value:q.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function AH(e){let{children:t,externalTree:n}=e,r=iD(()=>n??new CH).current;return(0,X.jsx)(TH.Provider,{value:r,children:t})}function jH(e){return e==null?e:`current`in e?e.current:e}function MH(e,t){let n=bO(ok(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(Bk(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var NH=20,PH=[];function FH(){PH=PH.filter(e=>e.deref()?.isConnected)}function IH(e){FH(),e&&yO(e)!==`body`&&(PH.push(new WeakRef(e)),PH.length>NH&&(PH=PH.slice(-20)))}function LH(){return FH(),PH[PH.length-1]?.deref()}function RH(e){return e?NA(e)?e:FA(e)[0]||e:null}function zH(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=PA(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return NA(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 BH(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=sD(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Pk(_)&&S,w=WV(i),T=WV(a),E=WV(o),D=WV(u),O=WV(g),k=DH(m),A=vH(),j=q.useRef(!1),M=q.useRef(!1),N=q.useRef(!1),P=q.useRef(null),ee=q.useRef(``),te=q.useRef(``),F=q.useRef(null),ne=q.useRef(null),re=xD(F,p,A?.beforeInsideRef),ie=xD(ne,A?.afterInsideRef),ae=gD(),I=gD(),oe=YV(),se=A!=null,L=Fk(v),ce=sD((e=L)=>e?FA(e):[]),le=sD(()=>h?.().filter(e=>e!=null)??[]);q.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&ik(L,rk(yA(L)))&&ce().length===0&&!C&&Rk(e)}return Sj(yA(L),`keydown`,e)},[r,L,c,C,ce]),q.useEffect(()=>{if(r||!g)return;let e=yA(L);function t(){N.current=!1}function n(e){let t=ok(e),n=le(),r=ik(v,t)||ik(_,t)||ik(A?.portalNode,t)||n.some(e=>e===t||ik(e,t));N.current=!r,te.current=e.pointerType||`keyboard`,ak(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,I.start(0,()=>{M.current=!1}))}function i(){te.current=`keyboard`}return UV(Sj(e,`pointerdown`,n,!0),Sj(e,`pointerup`,t,!0),Sj(e,`pointercancel`,t,!0),Sj(e,`keydown`,i,!0),t)},[r,v,_,L,g,A,I,le]),q.useEffect(()=>{if(r||!l)return;let e=yA(L);function n(){M.current=!0,I.start(0,()=>{M.current=!1})}function i(e){let t=ok(e);NA(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=ok(n);c&&r==null&&a!=null&&ik(v,a)&&IH(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=le(),p=r?.hasAttribute($V(`focus-guard`))&&[F.current,ne.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,jH(f),jH(d)].includes(r),m=!(ik(_,r)||ik(v,r)||ik(r,v)||ik(A?.portalNode,r)||u.some(e=>e===r||ik(e,r))||l.hasMatchingElement(e=>ik(e,r))||p||k&&(Ik(k.nodesRef.current,o).find(e=>ik(e.context?.elements.floating,r)||ik(e.context?.elements.domReference,r))||Lk(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,Fk(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&L&&zH(L),s&&i!==_&&!vA(a)&&rk(e)===e.body){if(wO(L)&&(L.focus(),s===`popup`)){oe.request(()=>{L.focus()});return}let e=ce(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||L;wO(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==LH())&&(j.current=!0,t.setOpen(!1,DV(NV,n)))})}function o(){N.current||(b.current.insideReactTree=!0,ae.start(0,()=>{b.current.insideReactTree=!1}))}let u=wO(_)?_:null;if(!(!v&&!u))return UV(u&&Sj(u,`focusout`,a),u&&Sj(u,`pointerdown`,n),v&&Sj(v,`focusin`,i),v&&Sj(v,`focusout`,a),v&&A&&Sj(v,`focusout`,o,!0))},[r,_,v,L,c,k,A,t,l,s,ce,C,x,b,ae,I,oe,d,f,le]),q.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${$V(`portal`)}]`)||[]),t=(k?Lk(k.nodesRef.current,x()):[]).find(e=>Pk(e.context?.elements.domReference||null))?.context?.elements.domReference,n=fH([v,...e,F.current,ne.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...le(),t,jH(f),jH(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=fH([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,le]),tj(()=>{if(!g||r||!wO(L))return;ee.current=``,te.current=``;let e=yA(L),t=rk(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||ik(L,t))return;let i=null,a=()=>(i??=ce(L),i[0]||L),o;o=r===!0||r===null?a():jH(r),o||=a();let s=ik(L,rk(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&Bk(c);tH(o,{sync:l,preventScroll:o===L,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=rk(e);return!(t!==o&&ik(L,t))}})})},[r,g,L,ce,w,D,O,b]);let R=q.useRef(null);tj(()=>{if(r||!L){R.current=null;return}R.current&&=(R.current.cancelled=!0,null);let e=yA(L),t=rk(e),n=D.current==null;IH(t);function i(e){if(e.open||(ee.current=MH(e.nativeEvent,te.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute($V(`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(Bk(e.nativeEvent)||Vk(e.nativeEvent))j.current=!1;else{let e=!1;yA(L).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&&yO(t)!==`body`?t:null,s=n?o||a:a||o;return s||=LH()||null,typeof i==`boolean`?s:jH(i)||s||null}return()=>{y.off(`openchange`,i);let t=rk(e),n=le(),r=ik(v,t)||n.some(e=>e===t||ik(e,t))||k&&Ik(k.nodesRef.current,x(),!1).some(e=>ik(e.context?.elements.floating,t)),o=T.current,s=ee.current,c=a(s),l={cancelled:!1};R.current=l,queueMicrotask(()=>{R.current===l&&(R.current=null);let n=RH(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&wO(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,L,T,E,D,y,k,_,x,le]),tj(()=>{if(!ek||g||!v)return;let e=rk(yA(v));!wO(e)||!Mk(e)||ik(v,e)&&e.blur()},[g,v]),tj(()=>{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,_]),tj(()=>{if(!(r||!L))return zH(L),()=>{queueMicrotask(FH)}},[r,L]);let ue=!r&&(!c||!C)&&(se||c);return(0,X.jsxs)(q.Fragment,{children:[ue&&(0,X.jsx)(QV,{"data-type":`inside`,ref:re,onFocus:e=>{if(c){let e=ce();tH(e[e.length-1])}else A?.portalNode&&(j.current=!1,BA(e,A.portalNode)?LA(_)?.focus():jH(f??A.beforeOutsideRef)?.focus())}}),n,ue&&(0,X.jsx)(QV,{"data-type":`inside`,ref:ie,onFocus:e=>{c?tH(ce()[0]):A?.portalNode&&(l&&(j.current=!0),BA(e,A.portalNode)?RA(_)?.focus():jH(d??A.afterOutsideRef)?.focus())}})]})}function VH(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=kV}=t,l=e.context.dataRef,u=q.useRef(void 0),d=YV(),f=gD(),p=q.useMemo(()=>{function t(t,n,r,i){let a=DV(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=Hk(e.pointerType,!0)&&Vk(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||Hk(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=ok(s),p=Mk(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}Hk(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 q.useMemo(()=>n?{reference:p}:fD,[n,p])}function HH(){return!1}function UH(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function WH(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=HH,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=DH(c),m=sD(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=sD(()=>a),{escapeKey:v,outsidePress:y}=UH(s),b=q.useRef(!1),x=q.useRef(!1),S=q.useRef(!1),C=q.useRef(!1),w=q.useRef(!1),T=q.useRef(``),E=q.useRef(null),D=gD(),O=gD(),k=gD(),A=sD(()=>{O.clear(),d.current.insideReactTree=!1}),j=sD(e=>{let t=d.current.floatingContext?.nodeId;return(p?Ik(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=sD(t=>Ak(t,e.select(`floatingElement`))||Ak(t,e.select(`domReferenceElement`))),N=sD(t=>{o()&&e.setOpen(!1,DV(kV,t.nativeEvent))}),P=sD(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=zk(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=DV(PV,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),ee=sD(()=>{d.current.insideReactTree=!0,O.start(0,A)}),te=sD(t=>{if(!l||!n||t.button!==0)return;let r=ok(t.nativeEvent);ik(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),F=sD(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});q.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),q.useEffect(()=>A,[A]),q.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 hD,i=yA(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(ek?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&&Ik(p.nodesRef.current,t).some(t=>Ak(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=ok(n),i=`[${$V(`inert`)}]`,a=CO(r)?r.getRootNode():null,o=Array.from((TO(a)?a:yA(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>ik(e,r))))return;let c=CO(r)?r:null;for(;c&&!IO(c);){let e=zO(c);if(IO(e)||!CO(e))break;c=e}if(!(o.length&&CO(r)&&!jk(r)&&!ik(r,e.select(`floatingElement`))&&o.every(e=>!ik(c,e)))){if(wO(r)&&!(`touches`in n)){let e=IO(r),t=LO(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&&!Bk(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,DV(jV,n)),A())}}}function ee(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function te(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 F(e,t){let n=ok(e);if(!n)return;let r=Sj(n,e.type,()=>{t(e),r()})}function ne(e){T.current=`touch`,F(e,te)}function re(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?ee(e):N(e)})}function ie(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 ae(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 I(e){F(e,ae)}function oe(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function se(e){F(e,oe)}let L=UV(r&&UV(Sj(i,`keydown`,P),Sj(i,`compositionstart`,a),Sj(i,`compositionend`,o)),g&&UV(Sj(i,`click`,re,!0),Sj(i,`pointerdown`,re,!0),Sj(i,`pointerup`,ie,!0),Sj(i,`pointercancel`,ie,!0),Sj(i,`mousedown`,re,!0),Sj(i,`mouseup`,ie,!0),Sj(i,`touchstart`,ne,{capture:!0,passive:!0}),Sj(i,`touchmove`,I,{capture:!0,passive:!0}),Sj(i,`touchend`,se,{capture:!0,passive:!0})));return()=>{L(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let ne=q.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),re=q.useMemo(()=>({onKeyDown:P,onPointerDown:F,onMouseDown:F,onClickCapture:ee,onMouseDownCapture(e){ee(),te(e)},onPointerDownCapture(e){ee(),te(e)},onMouseUpCapture:ee,onTouchEndCapture:ee,onTouchMoveCapture:ee}),[P,ee,te,F]);return q.useMemo(()=>n?{reference:ne,floating:re,trigger:ne}:{},[n,ne,re])}function GH(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),tj(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};CO(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 KH(e,t=!1,n=!1,r=!1){let[i,a]=q.useState(e&&t?`idle`:void 0),[o,s]=q.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),tj(()=>{if(!e&&o&&i!==`ending`&&n){let e=JV.request(()=>{a(`ending`)});return()=>{JV.cancel(e)}}},[e,o,i,n]),tj(()=>{if(!e||t||i===void 0)return;let n=JV.request(()=>{a(void 0)});return()=>{JV.cancel(n)}},[t,e,i]),tj(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=JV.request(()=>{a(`idle`)});return()=>{JV.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var qH=null;function JH(e){if(!qH){let e=[];qH=e,queueMicrotask(()=>{qH=null,ER.flushSync(()=>{for(let t of e)t()})})}qH.push(e)}function YH(e,t=!1,n=!1){let r=YV();return sD((i,a=null)=>{r.cancel();let o=jH(e);if(o==null)return;let s=o,c=()=>{if(!n){ER.flushSync(i);return}JH(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(cj(s).map(e=>e.finished.then(uD))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(cj(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=lk;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 XH(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=sD(a),s=YH(r,n,i);q.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function ZH(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=sD(i),{mounted:c,setMounted:l,transitionStatus:u}=KH(t,!1,!1,o),d=!t&&r;tj(()=>{t&&s(!1)},[t,s]);let f=q.useRef(c),p=q.useRef(!1),m=iO(),h=()=>{f.current=!1,l(!1),a()};tj(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=sD(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return XH({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var QH={tabIndex:-1,[sk]:``};function $H(e){return t=>t!==`touch`||e.current}function eU(e,t=!1){let n=cO(),r=EH()!=null,i=iD(()=>e(n,r)).current;return GH({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function tU({handle:e,store:t}){return tj(()=>e.attachStore(t),[e,t]),null}function nU(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function rU(e,t){let n=q.useRef(null);return sD(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),nU(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),nU(t))})}function iU(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 aU(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function oU(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=rU(e,n),o=sD(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=sD(e=>{a(e),e&&o(e)});return tj(()=>(s(t.current),()=>s(null)),[s,t,n,e]),tj(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function sU(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=q.useRef(null),i=e.useState(`open`);tj(()=>{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=DV(OV);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 cU(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=ZH({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 iD(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function lU(e,t){e.useSyncedValues(t),tj(()=>()=>{e.update({activeTriggerProps:fD,inactiveTriggerProps:fD,popupProps:fD})},[e])}function uU(e,t){tj(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),tj(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var dU=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}},fU=n((e=>{var t=_i();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})),pU=n(((e,t)=>{t.exports=fU()})),mU=n((e=>{var t=_i(),n=pU();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}})),hU=n(((e,t)=>{t.exports=mU()})),gU=[],_U=void 0;function vU(){return _U}function yU(e){gU.push(e)}function bU(e){let t=(t,n)=>{let r=iD(SU).current,i;try{_U=r;for(let e of gU)e.before(r);i=e(t,n);for(let e of gU)e.after(r);r.didInitialize=!0}finally{_U=void 0}return i};return t.displayName=e.displayName||e.name,t}function xU(e){return q.forwardRef(bU(e))}function SU(){return{didInitialize:!1}}var CU=pU(),wU=hU(),TU=OD(19)?OU:kU;function EU(e,t,n,r,i){return TU(e,t,n,r,i)}function DU(e,t,n,r,i){let a=q.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,CU.useSyncExternalStore)(e.subscribe,a,a)}yU({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,CU.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function OU(e,t,n,r,i){let a=vU();if(!a)return DU(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 kU(e,t,n,r,i){return(0,wU.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var AU=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 EU(this,e,t,n,r)}},jU=class extends AU{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){q.useDebugValue(e);let n=this;tj(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;tj(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;tj(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){q.useDebugValue(e);let n=this,r=t!==void 0;tj(()=>{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 q.useDebugValue(e),EU(this,this.selectors[e],t,n,r)}useContextCallback(e,t){q.useDebugValue(e);let n=sD(t??uD);this.context[e]=n}useStateSetter(e){let t=q.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)}})}},MU={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},NU=class extends jU{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:SH(),nested:n,triggerElements:i},MU),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Uk(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 PU(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new NU({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:fD,inactiveTriggerProps:fD,popupProps:fD}}var FU=e=>e.triggerIdProp??e.activeTriggerId,IU=e=>e.openProp??e.open,LU=e=>(e.popupElement?.id??e.floatingId)||void 0;function RU(e,t){return t!==void 0&&IU(e)&&FU(e)===t}function zU(e,t){return RU(e,t)?!0:t!==void 0&&IU(e)&&FU(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var BU={open:IU,mounted:e=>e.mounted,transitionStatus:e=>IU(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:FU,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:LU,isTriggerActive:(e,t)=>t!==void 0&&FU(e)===t,isOpenedByTrigger:(e,t)=>RU(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&FU(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zU(e,t)?LU(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function VU(e){let t=q.useCallback(t=>e===void 0?uD:e.subscribeStore(t),[e]),n=q.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,CU.useSyncExternalStore)(t,n,()=>e?.serverStore)}var HU=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new hD;restTimeout=new hD;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},UU=new WeakMap;function WU(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&UU.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),UU.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function GU(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=UU.get(n);a&&a!==e&&WU(a),WU(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,UU.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function KU(e){let t=e.context.dataRef.current,n=iD(()=>t.hoverInteractionState??HU.create()).current;return t.hoverInteractionState||=n,pD(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function qU(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=DH(),u=EH(),d=KU(e),f=gD(),p=sD(()=>VV(c.current.openEvent?.type,d.interactedInside)),m=sD(()=>HV(c.current.openEvent?.type)),h=sD(()=>{WU(d)});tj(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),q.useEffect(()=>h,[h]),tj(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&CO(s)&&o){let e=s,t=o,n=yA(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??ak(e,`[data-rootownerid]`)??n.body;return GU(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),q.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&Ik(l.nodesRef.current,u).length>0)}function a(t){let n=zV(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,DV(AV,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=ok(e);if(!Nk(t)){d.interactedInside=!1;return}d.interactedInside=ak(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(kk(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&CO(o)&&Ik(l.nodesRef.current,r,!1).some(e=>ik(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,DV(AV,n)),l.events.emit(`floating.closed`,n)})}let y=o;return UV(y&&Sj(y,`mouseenter`,g),y&&Sj(y,`mouseleave`,_),y&&Sj(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var JU={current:null};function YU(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=JU,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=DH(l),v=KU(e),y=q.useRef(!1),b=WV(i),x=WV(r),S=WV(o),C=WV(n),w=WV(p),T=WV(f),E=sD(()=>VV(h.current.openEvent?.type,v.interactedInside)),D=sD(()=>w.current?.()!==!1),O=sD((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!ik(t,n);if(!CO(r))return!1;let a=r;return i.hasMatchingElement(e=>ik(e,a))&&(!t||!ik(t,a))}),k=sD(()=>{v.handler&&=(yA(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=sD(()=>{WU(v)});return u&&(v.handleCloseOptions=i?.__options),q.useEffect(()=>k,[k]),q.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===AV,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]),q.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=zV(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,DV(AV,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,DV(AV,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!CO(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Hk(v.pointerType))return;let n=BV(S.current),r=zV(x.current,`open`,v.pointerType),i=ok(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(CO(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(ik(t,i)){c=t;break}}CO(o)&&CO(s)&&!e.context.triggerElements.hasElement(o)&&ik(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&&CO(c)&&CO(s)&&ik(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,DV(AV,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,DV(AV,t,c))}):g&&D()&&e.setOpen(!0,DV(AV,t,c)))}function o(n){if(E()){A();return}k();let r=yA(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!kk(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`||!ik(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){ik(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?Sj(r,`mouseout`,l):void 0;return s?UV(Sj(r,`mousemove`,i,{once:!0}),Sj(r,`mouseenter`,i),Sj(r,`mouseleave`,o),f):UV(Sj(r,`mouseenter`,i),Sj(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),q.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&&!Hk(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;GU(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=BV(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,DV(AV,n,r))}v.pointerType===`touch`?ER.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var XU=.1,ZU=XU*XU,QU=.5;function $U(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function eW(e,t,n,r,i,a,o,s,c,l){let u=!1;return $U(e,t,n,r,i,a)&&(u=!u),$U(e,t,i,a,o,s)&&(u=!u),$U(e,t,o,s,c,l)&&(u=!u),$U(e,t,c,l,n,r)&&(u=!u),u}function tW(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function nW(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 rW(e={}){let{blockPointerEvents:t=!1}=e,n=new hD,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*ZU;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=ok(r),g=r.type===`mouseleave`,_=ik(u,h),v=ik(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&CO(r.relatedTarget)&&ik(u,r.relatedTarget))return;function y(){return!!(s&&Ik(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=nW(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=nW(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=nW(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=nW(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!tW(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?QU/2:QU*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+QU+1,o=C||T?S.bottom-QU:S.top,s=C?T?S.bottom-QU:S.top:S.bottom-QU;M=eW(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?QU/2:QU*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-QU,o=C||T?S.top+QU:S.bottom,s=C?T?S.top+QU:S.bottom:S.top+QU;M=eW(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?QU/2:QU*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+QU+1,o=w||E?S.right-QU:S.left,s=w?E?S.right-QU:S.left:S.right-QU;M=eW(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?QU/2:QU*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-QU,o=w||E?S.left+QU:S.right,s=w?E?S.left+QU:S.right:S.left+QU;M=eW(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 iW(e,t,n){let{reference:r,floating:i}=e,a=nA(t),o=rA(t),s=tA(o),c=Qk(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=$k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function aW(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}=Zk(t,e),p=hA(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=gA(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=gA(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 oW=50,sW=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:aW},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iW(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<oW&&(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}=iW(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cW=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}=Zk(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Qk(r),_=nA(o),v=Qk(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pA(o)]:aA(o)),x=p!==`none`;!d&&x&&b.push(...fA(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=iA(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`||_===nA(t)||T.every(e=>nA(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=nA(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{}}}},lW=new Set([`left`,`top`]);async function uW(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Qk(n),s=$k(n),c=nA(n)===`y`,l=lW.has(o)?-1:1,u=a&&c?-1:1,d=Zk(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 dW=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 uW(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}}}}},fW=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}=Zk(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=nA(i),p=eA(f),m=u[p],h=u[f],g=(e,t)=>Xk(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}}}}}},pW=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}=Zk(e,t),u={x:n,y:r},d=nA(i),f=eA(d),p=u[f],m=u[d],h=Zk(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=lW.has(Qk(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}}}},mW=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}=Zk(e,t),c=await i.detectOverflow(t,s),l=Qk(n),u=$k(n),d=nA(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=Wk(p-c[m],g),y=Wk(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*Gk(c.left,c.right):S=p-2*Gk(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 hW(e){let t=LO(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=wO(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Kk(n)!==a||Kk(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gW(e){return CO(e)?e:e.contextElement}function _W(e){let t=gW(e);if(!wO(t))return Jk(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=hW(t),o=(a?Kk(n.width):n.width)/r,s=(a?Kk(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vW=Jk(0);function yW(e){let t=bO(e);return!FO()||!t.visualViewport?vW:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bW(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===bO(e)}function xW(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=gW(e),o=Jk(1);t&&(r?CO(r)&&(o=_W(r)):o=_W(e));let s=bW(a,n,r)?yW(a):Jk(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=bO(a),t=CO(r)?bO(r):r,n=e,i=HO(n);for(;i&&t!==n;){let e=_W(i),t=i.getBoundingClientRect(),r=LO(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=bO(i),i=HO(n)}}return gA({width:u,height:d,x:c,y:l})}function SW(e,t){let n=RO(e).scrollLeft;return t?t.left+n:xW(xO(e)).left+n}function CW(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-SW(e,n),y:n.top+t.scrollTop}}function wW(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=xO(r),s=t?OO(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Jk(1),u=Jk(0),d=wO(r);if((d||!a)&&((yO(r)!==`body`||EO(o))&&(c=RO(r)),d)){let e=xW(r);l=_W(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?CW(o,c):Jk(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 TW(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function EW(e){let t=RO(e),n=e.ownerDocument.body,r=Gk(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Gk(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+SW(e),o=-t.scrollTop;return LO(n).direction===`rtl`&&(a+=Gk(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var DW=25;function OW(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=bO(e),a=xO(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!FO()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(SW(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<=DW&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kW(e,t){let n=xW(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_W(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function AW(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=OW(e,n,t);else if(t===`document`)r=EW(xO(e));else if(CO(t))r=kW(t,n);else{let n=yW(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gA(r)}function jW(e,t){let n=t.get(e);if(n)return n;let r=VO(e,[],!1).filter(e=>CO(e)&&yO(e)!==`body`),i=null,a=LO(e).position===`fixed`,o=a?zO(e):e;for(;CO(o)&&!IO(o);){let e=LO(o),t=NO(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=zO(o)}return t.set(e,r),r}function MW(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?OO(t)?[]:jW(t,this._c):[].concat(n),r],o=AW(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=AW(t,a[e],i);s=Gk(n.top,s),c=Wk(n.right,c),l=Wk(n.bottom,l),u=Gk(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function NW(e){let{width:t,height:n}=hW(e);return{width:t,height:n}}function PW(e,t,n){let r=wO(t),i=xO(t),a=n===`fixed`,o=xW(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Jk(0);if((r||!a)&&((yO(t)!==`body`||EO(i))&&(s=RO(t)),r)){let e=xW(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=SW(i));let l=i&&!r&&!a?CW(i,s):Jk(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 FW(e){return LO(e).position===`static`}function IW(e,t){if(!wO(e)||LO(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return xO(e)===n&&(n=n.ownerDocument.body),n}function LW(e,t){let n=bO(e);if(OO(e))return n;if(!wO(e)){let t=zO(e);for(;t&&!IO(t);){if(CO(t)&&!FW(t))return t;t=zO(t)}return n}let r=IW(e,t);for(;r&&DO(r)&&FW(r);)r=IW(r,t);return r&&IO(r)&&FW(r)&&!NO(r)?n:r||PO(e)||n}var RW=async function(e){let t=this.getOffsetParent||LW,n=this.getDimensions,r=await n(e.floating);return{reference:PW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zW(e){return LO(e).direction===`rtl`}var BW={convertOffsetParentRelativeRectToViewportRelativeRect:wW,getDocumentElement:xO,getClippingRect:MW,getOffsetParent:LW,getElementRects:RW,getClientRects:TW,getDimensions:NW,getScale:_W,isElement:CO,isRTL:zW};function VW(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function HW(e,t,n){let r=null,i,a=xO(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=qk(d),h=qk(a.clientWidth-(u+f)),g=qk(a.clientHeight-(d+p)),_=qk(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Gk(0,Wk(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!VW(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=bO(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function UW(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=gW(e),u=i||a?[...l?VO(l):[],...t?VO(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?HW(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?xW(e):null;c&&g();function g(){let t=xW(e);h&&!VW(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 WW=dW,GW=fW,KW=cW,qW=mW,JW=pW,YW=(e,t,n)=>{let r=new Map,i=n??{},a={...BW,...i.platform,_c:r};return sW(e,t,{...i,platform:a})},XW=typeof document<`u`?q.useLayoutEffect:function(){};function ZW(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(!ZW(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)&&!ZW(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function QW(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $W(e,t){let n=QW(e);return Math.round(t*n)/n}function eG(e){let t=q.useRef(e);return XW(()=>{t.current=e}),t}function tG(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]=q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=q.useState(r);ZW(f,r)||p(r);let[m,h]=q.useState(null),[g,_]=q.useState(null),v=q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=q.useRef(null),C=q.useRef(null),w=q.useRef(u),T=c!=null,E=eG(c),D=eG(i),O=eG(l),k=q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),YW(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!ZW(w.current,t)&&(w.current=t,ER.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);XW(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=q.useRef(!1);XW(()=>(A.current=!0,()=>{A.current=!1}),[]),XW(()=>{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=q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=$W(M.floating,u.x),r=$W(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...QW(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var nG=(e,t)=>{let n=WW(e);return{name:n.name,fn:n.fn,options:[e,t]}},rG=(e,t)=>{let n=GW(e);return{name:n.name,fn:n.fn,options:[e,t]}},iG=(e,t)=>({fn:JW(e).fn,options:[e,t]}),aG=(e,t)=>{let n=KW(e);return{name:n.name,fn:n.fn,options:[e,t]}},oG=(e,t)=>{let n=qW(e);return{name:n.name,fn:n.fn,options:[e,t]}},sG=q.createContext(void 0);function cG(){let e=q.useContext(sG);if(e===void 0)throw Error(vD(26));return e}var lG=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),uG=`--nested-dialogs`,dG=`data-nested-dialog-open`,fG={...Ek,...pk,nestedDialogOpen(e){return e?{[dG]:``}:null}},pG=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=vV(),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`);cG(),XH({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?$H(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=JD(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...QH,hidden:!m,onKeyDown(e){lG.has(e.key)&&e.stopPropagation()},style:{[uG]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:fG});return(0,X.jsx)(BH,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function mG(e){return OD(19)?e:e?`true`:void 0}var hG=q.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}})}),gG=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=vV(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(sG.Provider,{value:n,children:(0,X.jsxs)(xH,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(hG,{ref:i.context.internalBackdropRef,inert:mG(!s)}),e.children]})}):null}),_G={},vG={},yG=``;function bG(e,t){return EO(e)?e:t}function xG(e,t,n){return/hidden|clip/.test(e.getComputedStyle(bG(t,n)).overflowY)}function SG(e){if(typeof document>`u`)return!1;let t=yA(e);return bO(t).innerWidth-t.documentElement.clientWidth>0}function CG(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=yA(e),n=t.documentElement,r=t.body,i=bG(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 wG(e){let t=yA(e),n=t.documentElement,r=t.body,i=bG(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 TG(e){let t=yA(e),n=t.documentElement,r=t.body,i=bO(n),a=0,o=0,s=!1,c=JV.create();if(ek&&(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,_G={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},yG=n.style.scrollBehavior,vG={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=bG(n,r);if(s=CG(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,_G),Object.assign(r.style,vG),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=yG)}function d(){u(),c.request(l)}l();let f=Sj(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var EG=new class{lockCount=0;restore=null;timeoutLock=hD.create();timeoutUnlock=hD.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=yA(e),n=t.documentElement,r=t.body,i=bO(n);if(xG(i,n,r)){let t=new i.MutationObserver(()=>{xG(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=YO||!SG(e);this.restore=a?wG(e):TG(e)}};function DG(e=!0,t=null){tj(()=>{if(e)return EG.acquire(t)},[e,t])}function OG({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]=q.useState(0),[d,f]=q.useState(0),p=l===0,m=WH(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=ok(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ik(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return DG(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),tj(()=>{!r&&!i&&(u(0),f(0))},[r,i]),tj(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),lU(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var kG={...BU,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},AG=class extends jU{constructor(e,t,n){let r=new dU,i=jG(e,r,t,n);super(i,MG(r),kG)}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(iU(this.state,e,t.trigger)))}};function jG(e,t,n,r=!1){return{...PU(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 MG(e){return{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function NG(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=vV(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=eU((e,t)=>new AG({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`);uU(b,x),sU(b);let{forceUnmount:w}=cU(x,b);q.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,DV(FV))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(_V.Provider,{value:b,children:[u&&(0,X.jsx)(tU,{handle:u,store:b}),T&&(0,X.jsx)(OG,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var PG=bU(function(e){return NG(`dialog`,e)}),FG=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=vV(),c=lO(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),JD(`h2`,e,{ref:t,props:[{id:c},o]})});function IG(e){let t=q.useRef(``),n=q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:q.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 LG(e,t){let{onClick:n,onPointerDown:r}=IG(sD((n,r)=>{(typeof e==`function`?e():e)||t(r||(YO?`touch`:``))}));return q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var RG=xU(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=vV(!0),f=VU(l)??d;if(!f)throw Error(vD(79));let p=lO(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=q.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=oU(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=wV({disabled:a,native:o}),S=VH(m),C=LG(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return JD(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[mH]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:wk})}),zG=(0,q.createContext)(void 0),BG=(0,q.createContext)(null);function VG(e){let t=(0,q.useContext)(BG);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function HG(e){let t=(0,q.useContext)(zG),n=(0,q.useRef)(e);n.current=e,(0,q.useEffect)(()=>t?.(()=>{n.current()}),[t])}var UG=(0,q.createContext)(null);function WG({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(UG.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(PG,{...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 GG(){let e=(0,q.useContext)(UG);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,q.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(RG,{...n,className:t=>Q(`btn`,KS(e,t)),ref:r,type:t})});var KG=(0,q.forwardRef)(function({container:e,...t},n){let r=VG(`dialog`);return e==null&&r===null?null:(0,X.jsx)(gG,{...t,container:e??r,ref:n})}),qG=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(yV,{...t,ref:n,className:t=>Q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,KS(e,t))})}),JG=(0,q.forwardRef)(function({className:e,finalFocus:t,...n},r){let i=GG();return(0,X.jsx)(pG,{...n,className:t=>Q(`caps-dialog-popup max-h-screen w-11/12 max-w-(--container-lg) overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,KS(e,t)),finalFocus:i.interactionOwner===`host`?!1:t??!0,ref:r})}),YG=(0,q.forwardRef)(function({container:e,keepMounted:t=!0,className:n,...r},i){let{modal:a}=GG();return(0,X.jsxs)(KG,{container:e,keepMounted:t,children:[a===!0?(0,X.jsx)(qG,{}):null,(0,X.jsx)(JG,{...r,className:e=>Q(`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,KS(n,e)),ref:i})]})});function XG({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex justify-end gap-sm`,e)})}function ZG({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex flex-col gap-sm`,e)})}var QG=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(FG,{...t,className:t=>Q(`text-lg font-semibold`,KS(e,t)),ref:n})}),$G=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(LV,{...t,className:t=>Q(`text-sm text-base-content`,KS(e,t)),ref:n})}),eK=(0,q.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(IV,{...n,className:t=>Q(`btn btn-ghost`,KS(e,t)),ref:r,type:t})}),tK=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nK=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),rK={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`},iK=(0,q.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,q.createElement)(`svg`,{ref:c,...rK,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nK(`lucide`,i),...s},[...o.map(([e,t])=>(0,q.createElement)(e,t)),...Array.isArray(a)?a:[a]])),aK=(e,t)=>{let n=(0,q.forwardRef)(({className:n,...r},i)=>(0,q.createElement)(iK,{ref:i,iconNode:t,className:nK(`lucide-${tK(e)}`,n),...r}));return n.displayName=`${e}`,n},oK=aK(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),sK=aK(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),cK=aK(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),lK=aK(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),uK=aK(`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`}]]),dK=aK(`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`}]]),fK=aK(`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`}]]),pK=aK(`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`}]]),mK=aK(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),hK=aK(`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`}]]),gK=aK(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),_K=aK(`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`}]]),vK=aK(`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`}]]),yK=aK(`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`}]]),bK=aK(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function xK(e,t){return Math.max(0,t===`reverse`?-e.scrollTop:e.scrollHeight-e.clientHeight-e.scrollTop)}function SK(){return{phase:`hidden`,shown:!1,jumped:!1,velocity:0,y:0,vy:0,volume:0,vv:0,opacity:0,unread:0,bead:0}}function CK(e){return 1+Math.min(.15,.06*Math.log2(1+Math.max(0,e)))}function wK(e,t,n,r,i,a){let o=t+(-i*i*(e-n)-2*a*i*t)*r;return[e+o*r,o]}function TK(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?CK(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=CK(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]=wK(i.y,i.vy,c,a/l/1e3,e,t),[i.volume,i.vv]=wK(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)?SK():(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 EK=(0,q.memo)(function({direction:e=`forward`,scrollerRef:t,onJump:n,unread:r=0,focusAfterJump:i}){let a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(SK()),p=(0,q.useRef)(()=>void 0),m=(0,q.useRef)(!1),h=(0,q.useRef)(r),g=CC(a),_=`caps-drop-${(0,q.useId)().replaceAll(`:`,``)}`;return(0,q.useEffect)(()=>{h.current=r,p.current()},[r]),(0,q.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=TK(f.current,{distance:xK(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=RE(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)(oK,{ref:d,className:`text-base-content`,size:13})})]})})});function DK(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 OK(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 kK(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var AK=(e,t)=>Math.abs(e-t)<1.01,jK=(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)}})},MK,NK=()=>{if(MK!==void 0)return MK;if(typeof navigator>`u`)return MK=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return MK=!0;let e=navigator.maxTouchPoints;return MK=navigator.platform===`MacIntel`&&e!==void 0&&e>0},PK=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},FK=e=>e,IK=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},LK=(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(PK(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(PK(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},RK={passive:!0},zK=typeof window>`u`||`onscrollend`in window,BK=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&zK,o=0,s=a?null:jK(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,RK),a&&r.addEventListener(`scrollend`,u,RK),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},VK=(e,t)=>BK(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),HK=(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`]},UK=(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})},WK=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:FK,rangeExtractor:IK,onChange:()=>{},measureElement:HK,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=OK(()=>(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,!(!NK()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,RK),e.addEventListener(`touchend`,n,RK),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&&(NK()&&(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=OK(()=>[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=OK(()=>[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=DK(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=OK(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=qK(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=OK(()=>{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=OK(()=>[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 kK(t[GK(0,t.length-1,r?e=>n[e*2]:e=>kK(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:NK()&&(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&&AK(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()}},GK=(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 KK(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 qK(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=KK(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=GK(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 JK=typeof document<`u`?q.useLayoutEffect:q.useEffect;function YK({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=q.useReducer(e=>e+1,0)[1],a=q.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,ER.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=q.useState(()=>{let e=new WK(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),JK(()=>l._didMount(),[]),JK(()=>(o(l),l._willUpdate())),JK(()=>{s(l)}),l}function XK(e){return YK({observeElementRect:LK,observeElementOffset:VK,scrollToFn:UK,...e})}function ZK(e){return e.kind===`user_message`&&e.requestId!==void 0?e.requestId:e.id}function QK(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function $K(e,t){let n=t.map(ZK),[r,i]=(0,q.useState)(n),a=QK(r,n)?r:n;return a!==r&&i(a),(0,q.useCallback)(t=>{let n=e[t];return n===void 0?a[t-e.length]??t:ZK(n)},[e,a])}function eq(e){return e<1e3?`${String(e)} tok`:`${(e/1e3).toFixed(1)}K`}var tq=(0,q.forwardRef)(function({action:e,className:t,input:n,leading:r,rowClassName:i,...a},o){return(0,X.jsx)(`div`,{...a,ref:o,className:[`caps-composer flex min-w-0 flex-1 items-end gap-sm`,t].filter(Boolean).join(` `),children:(0,X.jsxs)(`div`,{className:[`join w-full p-2xs`,i].filter(Boolean).join(` `),children:[r,n,e]})})}),nq=Lv({keyCode:Wv(229)});function rq(e){return e.nativeEvent.isComposing||Ze(nq,e.nativeEvent).success}var iq={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 aq({failure:e,cause:t,onRetry:n}){return(0,X.jsx)(JS,{tone:`warning`,title:e===`cancelled`?`Taking a breather`:`A little tangle`,description:(0,X.jsxs)(X.Fragment,{children:[iq[e],` If the model didn’t start, there’s no charge. Model work already done can still use credits.`,t?(0,X.jsx)(`span`,{className:`block`,children:t}):null]}),action:e===`cancelled`?void 0:(0,X.jsx)(YE,{"aria-label":`Retry prompt`,variant:`outline`,onClick:n,children:`Retry`})})}var oq=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),sq=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function cq(e){if(!Number.isFinite(e))throw RangeError(`Money amount must be finite`);return e!==0&&Math.abs(e)<1e-5?e<0?`>-$0.01`:`<$0.01`:e!==0&&Math.abs(e)<.01?sq.format(e):oq.format(e)}var lq=(0,q.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),uq=(0,q.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}),dq=(0,q.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)}})}),fq={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function pq({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,q.useId)().replaceAll(`:`,``)}`,i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(fq[t]).current,d=(0,q.useRef)(t===`dot`?1:4).current,f=(0,q.useRef)(+(t===`bang`)).current,p=(0,q.useRef)(t),m=CC(s),{reduced:h}=m;return(0,q.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=fq[t],n=h||p.current===t;p.current=t;let r=SC(i.current),o=n?{duration:0}:kj(r,{bounce:.3,duration:360}),s=OE(i.current,{y:e.y,height:e.height,...o}),u=OE(a.current,{cy:e.cy,...n?{duration:0}:{delay:wC(r,35),...kj(r,{bounce:.3,duration:420})}}),d=OE(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=OE(l.current,{opacity:+(t===`bang`),...n?Oj:Aj(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,q.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?OE(o.current,{opacity:[1,.45],...Aj(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):OE(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}},...Aj(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=RE(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)(LE,{id:r,values:IE}),(0,X.jsx)(NE,{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)(PE,{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 mq=.28;function hq(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?mq: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 gq=7.25;function _q({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,q.useId)().replaceAll(`:`,``)}`,i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(hq(t,n)).current,p=(0,q.useRef)(t),m=NC();(0,q.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=hq(t,n),y=p.current;p.current=t;let b=SC(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:Oj:Aj(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=Aj(b,{ease:`inOutSine`,duration:220}),T=[OE(r,{opacity:v.dashes,...S}),OE(c,{opacity:v.track*.28,...S}),OE(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?Oj:S:w}),OE(h,{r:v.disc*gq,...C?{delay:w.duration*.7,...kj(b,{bounce:.35,duration:360})}:m?Oj:Aj(b,{ease:`inCubic`,duration:140})}),OE(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...Aj(b,{ease:`outCubic`,duration:240})}:Oj}),OE(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...Aj(b,{ease:`outCubic`,duration:240})}:Oj})];return t===`cross`&&C&&b.shake>0&&T.push(OE(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...Aj(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,q.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=SC(i.current),t=OE(c.current,{rotate:[0,360],...Aj(e,{ease:`linear`,duration:900}),loop:!0}),n=RE(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)(NE,{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*gq,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var vq=new Set([`ring`,`arc`,`check`,`cross`]);function yq(e){return vq.has(e)}var bq={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`},xq=(0,q.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:[yq(n)?(0,X.jsx)(_q,{className:bq[i],glyph:n,progress:s}):(0,X.jsx)(pq,{className:bq[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),Sq=(0,q.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 Cq(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 wq(e,t){return`${e}-${String(t)}`}function Tq({slash:e,listId:t}){let{completion:n,selected:r}=e;if(n.kind===`none`)return null;let i=n.kind===`commands`?n.items.map(e=>({key:e.command.commandId+e.label,label:Cq(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:Cq(e.label,e.matches),detail:e.word.description??``,keys:``,disabled:!1}));return(0,X.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":n.kind,children:[n.kind===`arguments`?(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:n.hint}):null,i.length===0?null:(0,X.jsx)(`div`,{id:t,role:`listbox`,"aria-label":`Commands`,children:i.map((n,i)=>(0,X.jsxs)(dq,{id:wq(t,i),active:i===r,"aria-disabled":n.disabled||void 0,"data-disabled":n.disabled,onMouseEnter:()=>{e.highlight(i)},onClick:()=>{e.choose(i)},children:[(0,X.jsx)(`span`,{className:`parakeet-slash-label`,children:n.label}),(0,X.jsx)(`span`,{className:`parakeet-slash-detail`,children:n.detail}),n.keys.length===0?null:(0,X.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:n.keys})]},n.key))})]})}var Eq={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 Dq({placeholder:e,onChange:t,onSend:n,onAbort:r,slash:i,slashListId:a,textareaId:o,textareaRef:s,value:c,queuedRecall:l}){let u=(0,q.useRef)(c),[d,f]=(0,q.useState)([]),[p,m]=(0,q.useState)(-1);u.current=c;let h=l?.recallState,g=h?.kind===`recalling`;(0,q.useLayoutEffect)(()=>{if(h?.kind!==`restored`)return;m(-1);let e=s.current;e!==null&&e.setSelectionRange(e.value.length,e.value.length)},[h,s]),(0,q.useLayoutEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=`${String(Math.min(e.scrollHeight,320))}px`)},[s,c]);let _=(0,q.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,q.useCallback)(e=>{if(!rq(e)&&!g){if(i?.open===!0&&(e.key===`ArrowDown`?i.move(1):e.key===`ArrowUp`?i.move(-1):e.key===`Tab`?i.complete():e.key===`Escape`&&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){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)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:o,children:`Message`}),(0,X.jsx)(Sq,{"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,"aria-autocomplete":`list`,"aria-controls":y?a:void 0,"aria-expanded":y,"aria-activedescendant":y&&i!==void 0?wq(a,i.selected):void 0,className:`join-item min-h-[48px] max-h-[320px] w-full resize-none overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words px-3 py-[calc((3rem-1.25rem)/2)] font-sans text-xs text-base-content !border-0 !bg-transparent !shadow-none focus:!outline-none`,id:o,onChange:e=>{t(e.target.value),m(-1)},onKeyDown:v,placeholder:e??(i===void 0?`Ask agent...`:`Ask agent… (/ for commands)`),role:i===void 0?void 0:`combobox`,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.`}),(l?.images?.length??0)===0?null:(0,X.jsxs)(`p`,{className:`text-xs`,children:[l?.images?.length,` attached image(s)`]})]})}function Oq(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`}}function kq({statusChips:e,model:t,status:n,viewState:r,usage:i,context:a}){let o=r.kind===`error`?`error`:Eq[n].tone,s=Oq(`idle`,r),c=r.kind===`waiting_for_you`||r.kind===`error`;return(0,X.jsxs)(`div`,{className:`composer-footer`,children:[c?(0,X.jsx)(xq,{label:s,title:s,tone:o}):null,e?.map((e,t)=>(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e},t)),t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono font-semibold`,children:Lj(t)})]}):null,a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,title:`Context used / model context`,children:zj(a)})]}):null,i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:eq(i.tokens)}),(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:cq(i.cost)})]}):null]})}var Aq=(0,q.memo)(function({queuedRecall:e,placeholder:t,showFooter:n=!0,statusChips:r,actionVariant:i=`primary`,draft:a,failure:o,failureCause:s,admissionError:c,model:l,onAbort:u,onChange:d,onRetry:f,onSend:p,status:m,viewState:h,textareaRef:g,usage:_,context:v,slash:y}){let b=(0,q.useId)(),x=`${b}-commands`,{busy:S}=Eq[m],C=e?.recallState.kind===`recalling`,w=C||a.trim().length===0&&(e?.images?.length??0)===0,T={action:S?(0,X.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,X.jsx)(YE,{"aria-label":`Stop current turn`,className:`join-item h-auto min-h-0 self-stretch`,"data-testid":`composer-stop`,disabled:C||m===`queued`||m===`cancelling`,onClick:u,title:`Stop the current turn. Queued messages keep running in order.`,size:`lg`,variant:`ghost`,children:`Stop`}),(0,X.jsx)(YE,{"aria-label":`Queue follow-up`,className:`join-item h-auto min-h-0 self-stretch`,disabled:w,onClick:()=>{p(`followUp`)},size:`lg`,variant:i,children:`Queue`})]}):(0,X.jsx)(YE,{"aria-label":`Send message`,className:`join-item h-auto min-h-0 self-stretch`,disabled:w,onClick:()=>{p(`steer`)},title:`Send`,size:`lg`,variant:i,children:`Send`}),input:(0,X.jsx)(Dq,{queuedRecall:e,placeholder:t,onChange:d,onAbort:u,onSend:()=>{p(S?`followUp`:`steer`)},slash:y,slashListId:x,textareaId:b,textareaRef:g,value:a})},E={status:m,viewState:h,statusChips:r};return l&&(E.model=l),_&&(E.usage=_),v&&(E.context=v),(0,X.jsxs)(`div`,{className:`chat-composer not-prose flex-shrink-0 border-t border-base-300`,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[c===`queue_full`?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-error`,role:`alert`,children:`Too many prompts are still awaiting admission. Try again shortly.`}):null,o===void 0?null:(0,X.jsx)(aq,{failure:o,cause:s,onRetry:f}),y?.interactions.notice===void 0?null:(0,X.jsx)(`div`,{className:`parakeet-command-notice px-3 py-1.5 text-xs`,"data-tone":y.interactions.notice.tone,role:y.interactions.notice.tone===`error`?`alert`:`status`,children:y.interactions.notice.message}),(0,X.jsxs)(lq,{className:`composer-body`,children:[y===void 0?null:(0,X.jsx)(uq,{open:y.open,side:`top`,"data-parakeet-slash":``,children:(0,X.jsx)(Tq,{slash:y,listId:x})}),(0,X.jsx)(tq,{...T})]})]}),n?(0,X.jsx)(kq,{...E}):null,y===void 0?null:(0,X.jsx)(`p`,{className:`sr-only`,id:`${b}-guidance`,children:dB(y.hints)})]})}),jq={attention:`text-warning`,running:`text-info`,error:`text-error`,settled:`text-success`,muted:`text-dim`};function Mq({entryId:e,rows:t,actions:n,onOpen:r}){let i=TR(),{inspection:a}=(0,q.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=>(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?``:jq[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?``:jq[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)(YE,{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)(YE,{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)(ZS,{aside:(0,X.jsx)(YE,{size:`xs`,variant:`ghost`,onClick:()=>{i.inspect(void 0)},children:`Close`}),children:t.title}),(0,X.jsx)(YS,{density:`compact`,tabIndex:0,className:`max-h-64 overflow-y-auto overscroll-contain`,children:t.inspection.rows.map(e=>(0,X.jsxs)(XS,{children:[(0,X.jsx)(xq,{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 Nq=(0,q.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]})}),Pq=(0,q.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:q.Children.map(e,e=>(0,q.isValidElement)(e)?(0,q.cloneElement)(e,{className:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),Fq=(0,q.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 Iq(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,q.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,q.useRef)(null);(0,q.useImperativeHandle)(a,()=>o.current);let s=NC(),[c,l]=(0,q.useState)(e),u=(0,q.useRef)(!0);return e&&!c&&l(!0),(0,q.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!OC(n)){e||l(!1);return}let i=SC(n),a=`translateY(${String(i.distance)}px)`,c=DC(i,i.ease),d=n.getBoundingClientRect().height,f=Iq(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:DC(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 Lq=(0,q.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,q.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,q.useRef)(null);(0,q.useImperativeHandle)(a,()=>o.current);let s=NC(),[c,l]=(0,q.useState)({key:e,content:n}),[u,d]=(0,q.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,q.useRef)(null);return(0,q.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,q.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(!OC(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=SC(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:DC(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:DC(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:DC(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 Rq({children:e,...t}){let[n,r]=(0,q.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(Lq,{...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 zq({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)(Rq,{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 Bq=(0,q.forwardRef)(function({busy:e=!1,children:t,className:n,...r},i){return(0,X.jsx)(`form`,{...r,"aria-busy":e||void 0,className:Q(`caps-form`,n),ref:i,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),Vq={2:`h2`,3:`h3`,4:`h4`},Hq=(0,q.forwardRef)(function({children:e,className:t,description:n,level:r=3,title:i,...a},o){let s=(0,q.useId)(),c=Vq[r];return(0,X.jsxs)(`section`,{...a,"aria-labelledby":`${s}-title`,className:Q(`caps-form-section`,t),ref:o,children:[(0,X.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,X.jsx)(c,{className:`caps-form-section-title`,id:`${s}-title`,children:i}),n?(0,X.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,X.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),Uq=(0,q.forwardRef)(function({children:e,className:t,description:n,error:r,legend:i,...a},o){let s=(0,q.useId)(),c=[n?`${s}-description`:a[`aria-describedby`],r?`${s}-error`:null].filter(Boolean).join(` `)||void 0;return(0,X.jsxs)(`fieldset`,{...a,"aria-describedby":c,"aria-invalid":r?!0:a[`aria-invalid`],className:Q(`caps-fieldset`,t),ref:o,children:[(0,X.jsx)(`legend`,{className:`caps-fieldset-legend`,children:i}),n?(0,X.jsx)(`p`,{className:`caps-fieldset-description`,id:`${s}-description`,children:n}):null,(0,X.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,X.jsx)(Rq,{id:`${s}-error`,children:r})]})});function Wq(e){let t=[];return q.Children.forEach(e.props.children,e=>{(0,q.isValidElement)(e)&&e.type!==Fq&&t.push(e)}),t[0]??null}var Gq=(0,q.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,optional:o,orientation:s=`vertical`,readout:c=!1,required:l,...u},d){let f=(0,q.useId)(),p=(0,q.isValidElement)(e)?e:null,m=p?.type===Pq,h=m?Wq(p):p,g=h?.props.id??f,_=`${g}-description`,v=`${g}-error`,y=[h?.props[`aria-describedby`],n?_:null,r?v:null].filter(Boolean).join(` `)||void 0,b=l===!0||h?.props.required,x=r?!0:h?.props[`aria-invalid`],S=l===!0||h?.props[`aria-required`],C={id:g};b!==void 0&&(C.required=b),y!==void 0&&(C[`aria-describedby`]=y),x!==void 0&&(C[`aria-invalid`]=x),S!==void 0&&(C[`aria-required`]=S);let w=p&&h&&!c?m?(0,q.cloneElement)(p,void 0,q.Children.map(p.props.children,e=>e===h?(0,q.cloneElement)(h,C):e)):(0,q.cloneElement)(p,C):e,T=a?(0,X.jsx)(Nq,{htmlFor:c?void 0:g,className:s===`inline`?`font-normal`:void 0,...l===void 0?{}:{required:l},...o===void 0?{}:{optional:o},children:a}):null,E=a||n?(0,X.jsxs)(`div`,{className:`caps-field-copy`,children:[T,n?(0,X.jsx)(`p`,{className:`caps-field-description`,id:_,children:n}):null]}):null,D=i?(0,X.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,X.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),E]}):E;return(0,X.jsxs)(`div`,{...u,className:Q(`caps-field`,t),"data-orientation":s,ref:d,children:[s===`horizontal`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[D,w]}):s===`inline`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[w,D]}):(0,X.jsxs)(X.Fragment,{children:[D,w]}),(0,X.jsx)(Rq,{id:v,children:r})]})});function Kq(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var qq=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,Jq=6,Yq=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),Xq=(0,q.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,q.useState)(n),[y,b]=(0,q.useState)(null),x=p===void 0?_:p,S=Kq(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,q.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)/Jq),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:qq,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:qq,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(YE,{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)(mK,{"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=Yq.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)(YE,{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)(gK,{"aria-hidden":`true`})})]})}),Zq=(0,q.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,q.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)(Zq,{...n,type:`search`,className:t,ref:r})]})});var Qq=`data-glide-stand-in`;function $q(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 eJ(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function tJ(e){let t=(0,q.useRef)(null);return(0,q.useCallback)(n=>{t.current?.(),t.current=n?nJ(n,e):null},[e])}function nJ(e,t){if(!OC(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?$q(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(Qq);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=SC(e),u=$q(e,t),d=o&&a?$q(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(Qq,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(Qq,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([eJ(d),eJ(u)],{duration:r.normal,easing:DC(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 rJ({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,q.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,q.useState)(null);(0,q.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 iJ(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,q.useId)(),_=o??g,v=(0,q.useRef)(null);(0,q.useImperativeHandle)(p,()=>v.current);let y=tJ(`[role="option"][data-active]`),b=(0,q.useCallback)(e=>{v.current=e,y(e)},[y]),x=l===!0,S=x?[]:null,[C,w]=(0,q.useState)(()=>n??S),T=aJ(oJ(m,C),x),E=rJ({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,q.useRef)(N),ee=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(ee.current||k!==null)return;let e=O??D[0];e&&(ee.current=!0,j(i(e)))},[k,D,O,i,j]),(0,q.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 te=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)}},F=e=>{if(d?.(e),!e.defaultPrevented&&e.key!==`Escape`){if(e.key===`Enter`||e.key===` `){e.preventDefault(),te(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:F,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),te(e)},role:`option`,children:f?.(e,o,c)??a(e)},t)})})}function aJ(e,t){return t?Array.isArray(e)?e.slice():[]:e==null||Array.isArray(e)?[]:[e]}function oJ(e,t){switch(e){case void 0:return t;default:return e}}function sJ({host:e,pending:t}){let[n,r]=(0,q.useState)(``),i=t.request;return i.type===`choice`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:i.message}),(0,X.jsx)(iJ,{"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`,children:[(0,X.jsx)(`span`,{children: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)(`p`,{children:i.message}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[(0,X.jsx)(YE,{variant:`ghost`,onClick:()=>e.answer(t.sequence,!1),children:i.cancelLabel??`Cancel`}),(0,X.jsx)(YE,{onClick:()=>e.answer(t.sequence,!0),children:i.confirmLabel??`Confirm`})]})]}):(0,X.jsxs)(`form`,{className:`flex flex-col gap-sm`,onSubmit:r=>{r.preventDefault(),e.answer(t.sequence,n)},children:[(0,X.jsx)(Gq,{label:i.message,children:(0,X.jsx)(Zq,{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)(YE,{type:`submit`,children:`Continue`})})]})}function cJ({host:e,onClose:t}){let n=(0,q.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)(Fj,{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)(xq,{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)(sJ,{host:e,pending:n.prompt},n.prompt.sequence),n.status===`failed`?(0,X.jsx)(JS,{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)(YE,{variant:`ghost`,onClick:e.cancel,children:`Cancel`}):null,n.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(YE,{variant:`ghost`,onClick:()=>{e.cancel(),t?.()},children:`Close`}),n.retryable?(0,X.jsx)(YE,{onClick:e.retry,children:`Try again`}):null]}):null,n.status===`done`||n.status===`cancelled`?(0,X.jsx)(YE,{onClick:t,children:`Done`}):null]})]})}function lJ({waiting:e}){return e===null?null:(0,X.jsx)(`div`,{role:`status`,className:`flex items-center justify-between gap-2 px-3 py-1.5 text-xs text-dim`,"data-parakeet-waiting":`waiting`,children:(0,X.jsx)(`span`,{children:LP(e)})})}var uJ={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)`},dJ=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,fJ=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function pJ({transform:e,fill:t=dJ}){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 mJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(pJ,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(pJ,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(pJ,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function hJ(){return(0,X.jsxs)(`g`,{style:{fill:uJ.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 gJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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 _J(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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 vJ({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 yJ({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?fJ:uJ.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 bJ(){return(0,X.jsx)(`path`,{style:{fill:uJ.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 xJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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:uJ.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:uJ.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 SJ(){return(0,X.jsx)(`path`,{style:{fill:uJ.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 CJ({transform:e}){return(0,X.jsx)(`path`,{style:{fill:uJ.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 wJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:dJ},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:uJ.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:uJ.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 TJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:dJ},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:uJ.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:uJ.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:uJ.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:uJ.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 EJ(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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:uJ.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:uJ.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:uJ.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 DJ(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:uJ.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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:uJ.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 OJ(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:uJ.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:uJ.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:uJ.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:uJ.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:kJ,blue:AJ,mint:jJ,grape:MJ,yellow:NJ,cream:PJ,ink:FJ}=uJ,IJ={bonsai:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:jJ,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:jJ,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:AJ,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,X.jsx)(`circle`,{fill:MJ,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:NJ,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:NJ,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:AJ,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,X.jsx)(`path`,{fill:kJ,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,X.jsx)(`rect`,{fill:kJ,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,X.jsx)(EJ,{}),prints:(0,X.jsx)(DJ,{}),inkcap:(0,X.jsx)(OJ,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:kJ},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:PJ},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:PJ},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:PJ},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:AJ},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:PJ},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:PJ},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:NJ},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:PJ},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(wJ,{}),generateMedia:(0,X.jsx)(TJ,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:NJ,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:PJ,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(pJ,{fill:NJ,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(pJ,{fill:NJ,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:AJ,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:kJ,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:PJ,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:AJ,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:AJ,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:PJ,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:kJ,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:kJ,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:PJ,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:kJ,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:PJ,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:kJ,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)(gJ,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:AJ,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)(yJ,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:AJ},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:PJ},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:kJ},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:kJ},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:AJ},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)(_J,{})}),(0,X.jsx)(pJ,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(pJ,{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)(hJ,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(gJ,{})}),(0,X.jsx)(mJ,{})]}),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)(vJ,{fill:AJ})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(gJ,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:dJ},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)(yJ,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:kJ},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)(yJ,{})}),(0,X.jsx)(`path`,{style:{fill:AJ},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)(yJ,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:dJ},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)(yJ,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:jJ},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)(yJ,{})}),(0,X.jsx)(pJ,{fill:NJ,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(pJ,{fill:NJ,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)(vJ,{fill:kJ})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(bJ,{})}),(0,X.jsx)(pJ,{fill:jJ,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(pJ,{fill:jJ,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xJ,{}),(0,X.jsx)(SJ,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:AJ},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:PJ},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:AJ},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:kJ},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:NJ},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:jJ},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:NJ},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:MJ},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:dJ},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:jJ},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:FJ},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:dJ},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:AJ},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:PJ},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:jJ},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:MJ},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:kJ},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:kJ},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:kJ},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:PJ},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:kJ},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:PJ},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:PJ},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`g`,{fill:NJ,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:jJ,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:jJ,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)(CJ,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,X.jsx)(CJ,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,X.jsx)(CJ,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,X.jsx)(CJ,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,X.jsx)(CJ,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,X.jsx)(`circle`,{fill:kJ,cx:`31.9`,cy:`18.8`,r:`4`}),(0,X.jsx)(`circle`,{fill:AJ,cx:`32`,cy:`32.3`,r:`4`}),(0,X.jsx)(`circle`,{fill:MJ,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:AJ,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:PJ,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,X.jsx)(`ellipse`,{fill:FJ,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,X.jsx)(`path`,{fill:FJ,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,X.jsx)(`circle`,{fill:kJ,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,X.jsx)(`circle`,{fill:PJ,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,X.jsx)(`ellipse`,{fill:NJ,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,X.jsx)(`ellipse`,{fill:PJ,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:MJ,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:PJ,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,X.jsxs)(`g`,{fill:FJ,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:MJ,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:NJ,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:PJ,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:NJ,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:kJ,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:AJ,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:PJ,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:PJ,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:kJ,cx:`21.7`,cy:`26.6`,r:`1`}),(0,X.jsx)(`circle`,{fill:NJ,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,X.jsxs)(`g`,{fill:jJ,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.5 12 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:jJ,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,X.jsxs)(`g`,{fill:FJ,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:kJ,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:NJ,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:kJ,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:AJ,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:jJ,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:NJ,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:AJ,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,X.jsx)(`path`,{fill:`none`,stroke:kJ,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:NJ,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,X.jsx)(`ellipse`,{fill:AJ,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,X.jsx)(`ellipse`,{fill:PJ,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:kJ,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,X.jsx)(`path`,{fill:PJ,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:NJ,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:AJ,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:MJ,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:jJ,cx:`32`,cy:`34.9`,r:`14.5`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:PJ,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:NJ,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:AJ,cx:`32`,cy:`32`,r:`21.1`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:PJ,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:NJ,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:AJ,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,X.jsx)(`path`,{fill:AJ,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:kJ,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,X.jsx)(`path`,{fill:kJ,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:FJ,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:NJ,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:PJ,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:NJ,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:PJ,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:kJ,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:PJ,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,X.jsx)(pJ,{fill:NJ,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,X.jsx)(pJ,{fill:NJ,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:PJ,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,X.jsx)(`path`,{fill:kJ,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,X.jsxs)(`g`,{fill:PJ,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:AJ,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:jJ,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:MJ,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:NJ,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,X.jsx)(`path`,{fill:`none`,stroke:FJ,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,X.jsx)(`circle`,{fill:FJ,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),fungi:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:PJ,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,X.jsx)(`path`,{fill:kJ,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:PJ,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:FJ,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 LJ({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:IJ[e]})}function RJ({children:e,...t}){return(0,q.createElement)(q.Fragment,null,zJ(e,t))}function zJ(e,t={}){return(typeof e==`string`?YB(e,t):e).children.map((e,n)=>BJ(e,t,`b:${n}`))}function BJ(e,t={},n){switch(e.type){case`heading`:return ZJ(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},HJ(e.children,t),$J(e.id,t));case`paragraph`:return ZJ(t,`p`,{key:n},HJ(e.children,t));case`code`:return UJ(e,t,n);case`list`:return ZJ(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>ZJ(t,`li`,{key:r},WJ(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return ZJ(t,`blockquote`,{key:n},e.children.map((e,r)=>BJ(e,t,`${n}:${r}`)));case`table`:return ZJ(t,`table`,{key:n},ZJ(t,`thead`,null,ZJ(t,`tr`,null,e.header.map((n,r)=>KJ(`th`,n,e.align[r],t,r)))),e.rows.length?ZJ(t,`tbody`,null,e.rows.map((n,r)=>ZJ(t,`tr`,{key:r},n.map((n,r)=>KJ(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return qJ(e.items,t,n);case`thematicBreak`:return ZJ(t,`hr`,{key:n});case`html`:return t.allowHtml?ZJ(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):ZJ(t,`p`,{key:n},e.value);case`callout`:return ZJ(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},ZJ(t,`p`,{className:`markdown-alert-title`},e.title),ZJ(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>BJ(e,t,`${n}:${r}`))));case`component`:return QJ(e,t,n)}}function VJ(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return ZJ(t,`code`,{key:n},e.value);case`strong`:return ZJ(t,`strong`,{key:n},HJ(e.children,t));case`emphasis`:return ZJ(t,`em`,{key:n},HJ(e.children,t));case`strike`:return ZJ(t,`del`,{key:n},HJ(e.children,t));case`footnoteReference`:return ZJ(t,`sup`,{key:n},ZJ(t,`a`,{id:`user-content-fnref-${XJ(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return ZJ(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},HJ(e.children,t));case`image`:return ZJ(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return ZJ(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?ZJ(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function HJ(e,t){return e.map((e,n)=>VJ(e,t,`i:${n}`))}function UJ(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=ZJ(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}:{}},ZJ(t,`code`,{...a,...s},o));return e.title?ZJ(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},ZJ(t,`figcaption`,null,e.title),c):ZJ(t,q.Fragment,{key:n},c)}function WJ(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[ZJ(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...HJ(a.children,r)];return[...n?[ZJ(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>GJ(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>GJ(e,n,r,`${i}:${t}`))]}function GJ(e,t,n,r){return!t&&e.type===`paragraph`?HJ(e.children,n):[BJ(e,n,r)]}function KJ(e,t,n,r,i){return ZJ(r,e,{key:i,...n?{style:{textAlign:n}}:{}},HJ(t.children,r))}function qJ(e,t,n){return ZJ(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},ZJ(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,$J(`footnote-label`,t)),ZJ(t,`ol`,null,e.map(e=>ZJ(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},JJ(e,t)))))}function JJ(e,t){let n=e.children.length-1,r=YJ(e,t);return n<0?[ZJ(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?ZJ(t,`p`,{key:i},HJ(e.children,t),r):BJ(e,t,`${i}`))}function YJ(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(` `,ZJ(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 XJ(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function ZJ(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,q.createElement)(i,n,...r)}function QJ(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)),ZJ(t,r,{key:n,...i},e.children.map((e,r)=>BJ(e,t,`${n}:${r}`)))}function $J(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return ZJ(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function eY(e){return e}function tY({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=aY(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(aY(n),t)}let i=aY(e);function a(e){return r.get(aY(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:oY(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(aY(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?sY(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=rY(nY(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${vY(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${vY(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 nY(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(lY),a=r.filter(uY);if(!(t.lineNumbers||a.length))return cY(e,0,n.length,i);let o=[],s=dY(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]===`
150
+ `,d=u?l-1:l,f=a.filter(e=>fY(e.lines,r));o.push({type:`element`,classNames:[`th-line`,...f.flatMap(e=>gY(e.className))],data:{...pY(f),line:String(r)},children:cY(e,c,d,i)}),u&&o.push({type:`text`,value:`
151
+ `})}return o}function rY(e){let t=``;for(let n of e){if(n.type===`text`){t+=iY(n.value);continue}let e=n.classNames.map(vY).join(` `),r=Object.entries(n.data||{}).map(([e,t])=>` data-${vY(_Y(e))}="${vY(t)}"`).join(``);t+=`<span${e?` class="${e}"`:``}${r}>${rY(n.children)}</span>`}return t}function iY(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function aY(e){return e.trim().toLowerCase()}function oY(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 sY(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 cY(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`,...gY(e.className)],data:mY(e.data),children:[c]};i.push(c)}}if(a=e,a>=n)break}return i}function lY(e){return`range`in e}function uY(e){return`lines`in e}function dY(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
152
+ `&&n+1<e.length&&t.push(n+1);return t}function fY(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function pY(e){let t={};for(let n of e)Object.assign(t,mY(n.data));return t}function mY(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[hY(e),String(t)]))}function hY(e){return _Y(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function gY(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function _Y(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function vY(e){return iY(e)}function yY(e){return t=>bY(t,e)}function bY(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))SY(r,i,t);continue}let t=CY(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;SY(r,i,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return r}function xY(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function SY(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||wY(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function CY(e){return new RegExp(e.source,e.flags.includes(`g`)?e.flags:`${e.flags}g`)}function wY(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var TY=eY({name:`css`,tokenize:yY([{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}])}),EY=eY({name:`dockerfile`,aliases:[`docker`],tokenize:yY([{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 DY(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=MY(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||OY(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=kY(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:t})}}a=c+1}n===`vue`&&AY(e,`{{`,`}}`,`js`,i),n===`svelte`&&jY(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...xY(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function OY(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=NY(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function kY(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 AY(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 jY(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 MY(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=NY(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function NY(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 PY=eY({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>DY(e,t)}),FY=[{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 IY(e,t=!1,n=!1){let r=LY(e,t,n),i=t?VY(e,n):[];return bY(e,FY,[...r,...i])}function LY(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`/`&&o===`/`){let t=YY(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=JY(e,i,a);r.push({start:i,end:t,className:`string`}),i=t;continue}if(a==="`"){i=RY(e,i,r,t,n);continue}if(a===`/`&&!(t&&e[i-1]===`<`)&&GY(e,i)){let t=KY(e,i);if(t>i+1){r.push({start:i,end:t,className:`literal`}),i=t;continue}}i++}return r}function RY(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=zY(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...xY(IY(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 zY(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=JY(e,r,t);continue}if(t==="`"){r=BY(e,r);continue}if(t===`/`&&i===`/`){r=YY(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 BY(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=zY(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function VY(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]==="`"?BY(e,r):JY(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||UY(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)&&!UY(e,r,t)){r++;continue}let l=qY(e,s+c[0].length);if(l<0||WY(e,r,l,o)){r++;continue}n.push({start:s,end:s+c[0].length,className:`tag`}),o||HY(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 HY(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 UY(e,t,n){if(n&&/^\s*$/.test(e.slice(e.lastIndexOf(`
153
+ `,t-1)+1,t)))return!0;let r=e.slice(0,t).trimEnd();return!r||/\b(?:return|case|yield)$/.test(r)?!0:/(?:[=([{,:;!&|?]|>)$/.test(r)}function WY(e,t,n,r){if(r)return!1;let i=e.slice(t+1,n),a=e.slice(n+1).trimStart();return/\s+extends\s+/.test(i)||a[0]===`(`&&!i.trimEnd().endsWith(`/`)}function GY(e,t){let n=e.slice(0,t).trimEnd();return!n||/\b(?:case|delete|in|instanceof|of|return|throw|typeof|void|yield)$/.test(n)?!0:/[=([{,:;!&|?~+*%^<>-]$/.test(n)}function KY(e,t){let n=!1,r=t+1;for(;r<e.length&&e[r]!==`
154
+ `;)if(e[r]===`\\`)r+=2;else if(e[r]===`[`)n=!0,r++;else if(e[r]===`]`)n=!1,r++;else if(e[r]===`/`&&!n){for(r++;/[a-z]/i.test(e[r]||``);)r++;return r}else r++;return t+1}function qY(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`||t===`"`){r=JY(e,r,t);continue}if(t===`{`)n++;else if(t===`}`)n=Math.max(0,n-1);else if(t===`>`&&n===0)return r;else if(t===`
155
+ `&&n===0)return-1;r++}return-1}function JY(e,t,n){let r=t+1;for(;r<e.length;)if(e[r]===`\\`)r+=2;else if(e[r]===n)return r+1;else if(e[r]===`
156
+ `&&n!=="`")return r;else r++;return e.length}function YY(e,t){let n=e.indexOf(`
157
+ `,t);return n<0?e.length:n}var XY=eY({name:`js`,aliases:[`javascript`,`mjs`,`cjs`,`js-vue`],tokenize:e=>IY(e)}),ZY=eY({name:`json`,aliases:[`jsonc`,`json5`],tokenize:yY([{className:e=>e[0].startsWith(`//`)||e[0].startsWith(`/*`)?`comment`:e[1]?`property`:`string`,regex:/\/\/[^\n]*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"\\])*")(?=\s*:)|"(?:\\.|[^"\\])*"/g},{className:`literal`,regex:/\b(?:false|null|true)\b/g},{className:`number`,regex:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi}])}),QY=eY({name:`jsx`,tokenize:e=>IY(e,!0)}),$Y=eY({name:`markdown`,aliases:[`md`],tokenize(e,t){return bY(e,[{className:`heading`,regex:/^#{1,6}\s.*$/gm},{className:`heading`,regex:/^.+\n(?:=+|-+)\s*$/gm},{className:`code-inline`,regex:/`[^`\n]+`/g},{className:`link`,regex:/!?\[[^\]]+\]\([^)]+\)/g},{className:`meta`,regex:/^\s{0,3}(?:>|[-*+] |\d+\. )/gm}],eX(e,t))}});function eX(e,t){let n=[],r=/^( {0,3})(`{3,}|~{3,})\s*([^\n]*)$/gm,i;for(;i=r.exec(e);){let a=i[2],o=e.indexOf(`
158
+ `,i.index+i[0].length);if(o<0)break;let s=RegExp(`^ {0,3}${a[0]}{${a.length},}\\s*$`,`gm`);s.lastIndex=o+1;let c=s.exec(e),l=c?.index??e.length,u=i[3].trim().split(/\s+/)[0],d=u&&t.hasLanguage(u)?xY(t.tokenize(e.slice(o+1,l),u),o+1):[];n.push({start:i.index,end:o,className:`meta`}),n.push(...tX(o+1,l,d)),c&&n.push({start:c.index,end:c.index+c[0].length,className:`meta`}),r.lastIndex=c?c.index+c[0].length:e.length}return n}function tX(e,t,n){let r=[],i=e;for(let e of[...n].sort((e,t)=>e.start-t.start))e.start>i&&r.push({start:i,end:e.start,className:`code-inline`}),r.push(e),i=e.end;return i<t&&r.push({start:i,end:t,className:`code-inline`}),r}var nX=eY({name:`plaintext`,aliases:[`text`,`txt`,`-->`],tokenize:()=>[]}),rX=eY({name:`python`,aliases:[`py`],tokenize(e){return bY(e,[{className:e=>e[0].startsWith(`#`)?`comment`:`string`,regex:/#[^\n]*|(?:br|rb|fr|rf|[rubf])?(?:"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*')/gi},{className:`keyword`,regex:/\b(?:and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/g},{className:`literal`,regex:/\b(?:False|None|True|NotImplemented|Ellipsis)\b/g},{className:`function`,regex:/@[A-Za-z_][\w.]*/g},{className:`function`,regex:/\bdef\s+([A-Za-z_]\w*)/g,group:1},{className:`type`,regex:/\b(?:bool|bytes|dict|float|frozenset|int|list|object|set|str|tuple|type)\b/g},{className:`number`,regex:/\b(?:0x[\da-f_]+|0b[01_]+|0o[0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?j?)\b/gi}])}}),iX=eY({name:`shell`,aliases:[`bash`,`sh`,`zsh`,`cmd`,`console`],tokenize(e){return bY(e,[{collect:aX},{className:`variable`,regex:/\$[A-Za-z_][A-Za-z0-9_]*|\b[A-Z_][A-Z0-9_]*(?==)/g},{className:`keyword`,regex:/\b(?:case|do|done|elif|else|esac|export|fi|for|function|if|in|select|then|time|until|while)\b/g},{className:`command`,regex:/(^|[\n;|&])\s*([A-Za-z0-9_./-]+)(?=\s|$)/g,group:2}])}});function aX(e){let t=[];oX(e,t);let n=0;for(;n<e.length;){if(cX(n,t)){n=t.find(e=>e.start<=n&&e.end>n).end;continue}let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`$`&&e[n+1]===`{`){let r=e.indexOf(`}`,n+2),i=r<0?e.length:r+1;t.push({start:n,end:i,className:`variable`}),n=i;continue}if(r===`#`&&(n===0||e[n-1]===`
159
+ `||/[\s;|&()]/.test(e[n-1]))){let r=e.indexOf(`
160
+ `,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function oX(e,t){let n=/<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g,r;for(;r=n.exec(e);){if(e[r.index-1]===`<`||sX(e,r.index))continue;let n=e.indexOf(`
161
+ `,r.index+r[0].length);if(n<0)continue;let i=n+1,a=RegExp(`^\\t*${lX(r[2])}\\s*$`,`m`).exec(e.slice(i));if(!a){t.push({start:i,end:e.length,className:`string`});continue}let o=i+a.index;o>i&&t.push({start:i,end:o,className:`string`});let s=i+a.index;t.push({start:s,end:s+a[0].length,className:`meta`})}}function sX(e,t){let n=e.lastIndexOf(`
162
+ `,t-1)+1,r=``;for(let i=n;i<t;i++)e[i]===`\\`&&r!==`'`?i++:r&&e[i]===r?r=``:!r&&(e[i]===`"`||e[i]===`'`)&&(r=e[i]);return!!r}function cX(e,t){return t.some(t=>t.start<=e&&t.end>e)}function lX(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var uX=eY({name:`sql`,tokenize:yY([{className:e=>e[0].startsWith(`--`)||e[0].startsWith(`/*`)?`comment`:`string`,regex:/--[^\n]*|\/\*[\s\S]*?\*\/|'(?:''|[^'])*'|"(?:""|[^"])*"/g},{className:`keyword`,regex:/\b(?:add|all|alter|and|as|asc|begin|between|by|case|check|column|commit|constraint|create|cross|database|default|delete|desc|distinct|drop|else|end|exists|foreign|from|full|group|having|index|inner|insert|into|join|key|left|like|limit|not|null|on|or|order|outer|primary|references|returning|right|rollback|select|set|table|then|union|unique|update|using|values|view|when|where|with)\b/gi},{className:`literal`,regex:/\b(?:false|null|true)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g},{className:`function`,regex:/\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()/g}])}),dX=eY({name:`ts`,aliases:[`typescript`,`angular-ts`],tokenize:e=>IY(e)}),fX=eY({name:`tsx`,tokenize:e=>IY(e,!0)}),pX=eY({name:`yaml`,aliases:[`yml`],tokenize(e){let t=[...mX(e),...hX(e)];return bY(e,[{className:`property`,regex:/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,group:1},{collect:gX},{className:`literal`,regex:/\b(?:false|null|true|yes|no|on|off|~)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g}],t)}});function mX(e){let t=[],n=/^(\s*)[\w.-]+:\s*[>|][+-]?\s*(?:#.*)?$/gm,r;for(;r=n.exec(e);){let n=e.indexOf(`
163
+ `,r.index+r[0].length);if(n<0)continue;let i=r[1].length,a=n+1;for(;a<e.length;){let t=e.indexOf(`
164
+ `,a),n=t<0?e.length:t,r=e.slice(a,n);if(r.trim()&&(r.match(/^\s*/)?.[0].length||0)<=i)break;a=t<0?e.length:t+1}a>n+1&&t.push({start:n+1,end:a,className:`string`})}return t}function hX(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length&&e[a]!==`
165
+ `;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`#`&&(n===0||e[n-1]===`
166
+ `||/\s/.test(e[n-1]))){let r=e.indexOf(`
167
+ `,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function gX(e){let t=[],n=/:\s*([^\n]*)/g,r;for(;r=n.exec(e);){let n=r[1],i=n.trimEnd();if(!i)continue;let a=r.index+r[0].indexOf(n),o=a+i.length,s=/\s+#/.exec(i);for(s&&(o=a+s.index);o>a&&/\s/.test(e[o-1]);)o--;o>a&&t.push({start:a,end:o,className:`string`})}return t}var _X=/[ \t]*(?:(?:\/\/|#)[ \t]*\[!code[ \t]+(\+\+|--)\]|\/\*[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*\*\/|<!--[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*-->)[ \t]*$/;function vX(e){let t=[];return{code:e.split(`
168
+ `).map((e,n)=>{let r=_X.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(`
169
+ `),decorations:t}}function yX(e){return(t,n=`plaintext`,r={})=>{let i=vX(t);return rY(nY(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 bX=tY({fallbackLanguage:`plaintext`,languages:[TY,EY,PY,XY,ZY,QY,$Y,nX,rX,iX,uX,dX,fX,pX]}),xX=yX(bX);function SX(e,t){return bX.highlightToHtml(e,t?{lang:t}:{})}var CX=(0,q.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 wX(e){return URL.parse(e)?.protocol??null}function TX(e){if(e===``||e.startsWith(`//`))return!1;let t=wX(e);return t===null||t===`http:`||t===`https:`||t===`mailto:`}function EX(e){let t=wX(e);return t===`http:`||t===`https:`}function DX(e){if(e===``||e.startsWith(`//`))return!1;let t=wX(e);return t===null||t===`http:`||t===`https:`}function OX({children:e,className:t,components:n,frontmatter:r=!0,policy:i=`default`,typography:a=`prose`}){let o=(0,q.useMemo)(()=>YB(e,{allowHtml:!1,frontmatter:r}),[e,r]),s=(0,q.useMemo)(()=>({...n,a(e){let t=e.href??``;if(i===`visitor`){let n=URL.parse(t);return n===null||!EX(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(!TX(t))return(0,X.jsx)(X.Fragment,{children:e.children});let n=EX(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 DX(t)?n?.img?(0,q.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)(RJ,{allowHtml:!1,components:s,highlighter:xX,children:o}),l=Q(`min-w-0 break-words`,t);return a===`prose`?(0,X.jsx)(CX,{className:l,children:c}):(0,X.jsx)(`div`,{className:l,children:c})}var kX=(0,q.createContext)(`session`),AX={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 jX({children:e,policy:t}){let n=(0,q.useContext)(kX);return(0,X.jsx)(OX,{className:`markdown-renderer`,components:AX,frontmatter:!1,policy:(t??n)===`visitor`?`visitor`:`default`,typography:`inherit`,children:e})}var MX=(0,q.memo)(function({thinking:e}){let[t,n]=(0,q.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)(lK,{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)(jX,{children:e})}):null]})});function NX({pending:e}){return e?(0,X.jsx)(`span`,{className:`sr-only`,role:`status`,children:`Sending`}):null}function PX({children:e,isError:t,pending:n,speaker:r,thinking:i,markdownPolicy:a}){let o=(0,X.jsx)(jX,{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)(NX,{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)(MX,{thinking:i}):null,s?(0,X.jsx)(`div`,{className:`px-3 py-2 ${t?`text-error`:`text-base-content`}`,children:o}):null]})}var FX=bx(`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`}}),IX=(0,q.forwardRef)(function({className:e,size:t,tone:n,variant:r,...i},a){return(0,X.jsx)(`span`,{...i,className:Q(FX({size:t,tone:n,variant:r}),e),ref:a})}),LX={add:`+`,context:` `,file:``,hunk:`@@`,remove:`-`};function RX({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:LX[e.kind]}),e.text,`
170
+ `]},`${String(t)}:${e.kind}`)),t>0?(0,X.jsxs)(`span`,{className:`caps-diff-line`,"data-kind":`more`,children:[`… `,String(t),` more lines`]}):null]})}function zX({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(()=>t);return[i&&e!==void 0?e:a,q.useCallback(e=>{i||o(e)},[])]}function BX(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=zX({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=KH(a,!0,!0),u=lO(),[d,f]=q.useState(),p=d===null?void 0:d??u,m=sD(e=>{let t=!a,n=DV(kV,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return q.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 VX=q.createContext(void 0);function HX(){let e=q.useContext(VX);if(e===void 0)throw Error(vD(15));return e}var UX=`data-open`,WX=`data-closed`,GX=lk,KX=`data-panel-open`,qX={[UX]:``},JX={[WX]:``},YX={open(e){return e?{[KX]:``}:null}},XX={open(e){return e?qX:JX},...pk},ZX=q.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=sD(o),d=BX({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=q.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=q.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=JD(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:XX});return(0,X.jsx)(VX.Provider,{value:p,children:m})}),QX={...YX,...pk},$X=q.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=HX(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=wV({disabled:c,native:u});return JD(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:QX})}),eZ={height:void 0,width:void 0};function tZ(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=q.useRef(null),f=q.useRef(null),[p,m]=q.useState(eZ),h=q.useRef(eZ),g=q.useRef(!1),_=q.useRef(s),v=q.useRef(!1),[y,b]=q.useState(!1),x=q.useRef(null),S=xD(t,d),C=WV(s),w=YH(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=sD((e,t=!0)=>{t&&(h.current=e),m(e)}),j=sD(()=>{x.current?.(),x.current=null}),M=sD(e=>{j(),x.current=()=>{x.current=null,e()}}),N=sD(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});tj(()=>{!y||u===`starting`||b(!1)},[y,u]),q.useEffect(()=>()=>{N(),j()},[N,j]),tj(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&j();let t=rZ(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=nZ(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(nZ(e)),b(!0);return}if(t===`css-transition`){let t=oZ(e);if(A(nZ(e)),!n)return t;let r=aZ(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(nZ(e));let r=aZ(e,`animation-name`,`none`);if(!n){r();return}let i=aZ(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){A(eZ,!1),c(!1);return}A(nZ(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=nZ(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&aZ(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),XH({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(eZ,!1)}}),q.useEffect(()=>{if(s||!a||E!==`ending`)return;if(!d.current){c(!1),A(eZ,!1);return}let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(eZ,!1))}return t=JV.request(()=>{w(n,e.signal)}),()=>{JV.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),tj(()=>{let e=d.current;!e||!n||!T||e.setAttribute(`hidden`,`until-found`)},[T,n]),q.useEffect(function(){let e=d.current;if(!e)return;let t=hD.create(),n=-1,r=(r,i)=>{t.start(0,()=>{C.current||(n=JV.request(()=>{C.current||(r&&(g.current=!1),i&&e.setAttribute(GX,``),e.setAttribute(`hidden`,`until-found`))}))})},i=Sj(e,`beforematch`,t=>{let n=DV(OV,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(GX);e.removeAttribute(GX),l(!0),r(!0,i)});return()=>{t.clear(),JV.cancel(n),i()}},[C,o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[GX]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function nZ(e){return{height:e.scrollHeight,width:e.scrollWidth}}function rZ(e,t){let n=bO(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&iZ(n.animationDuration),i=iZ(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function iZ(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function aZ(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 oZ(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=JV.request(n);return()=>{JV.cancel(r),n()}}var sZ=`--collapsible-panel-height`,cZ=`--collapsible-panel-width`,lZ=q.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:_}=HX(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;tj(()=>(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}=tZ({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=ND(s,k),j=JD(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[sZ]:S===void 0?`auto`:`${S}px`,[cZ]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:XX});return E?j:null}),uZ=bx(`caps-disclosure`,{variants:{tone:{neutral:``,error:`caps-disclosure-error`},size:{group:`caps-disclosure-group`,row:`caps-disclosure-row`}},defaultVariants:{tone:`neutral`,size:`group`}});function dZ({open:e,onOpenChange:t,summary:n,leading:r,trailing:i,children:a,tone:o,size:s,className:c}){return(0,X.jsxs)(ZX,{className:Q(uZ({tone:o,size:s}),c),onOpenChange:t,open:e,children:[(0,X.jsxs)($X,{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)(lK,{"aria-hidden":`true`,className:`caps-disclosure-chevron`,size:12})]}),(0,X.jsx)(lZ,{className:`caps-disclosure-panel`,children:a})]})}var fZ=1e4;function pZ({className:e,content:t,header:n,hideCopy:r,language:i,maxHeight:a=`320px`,style:o}){let[s,c]=(0,q.useState)(`idle`),l=async()=>{try{await navigator.clipboard.writeText(t),c(`copied`),setTimeout(()=>{c(`idle`)},1500)}catch(e){eI(`copy code to clipboard`,e),c(`failed`)}},u=i&&t.length<=fZ?SX(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)(`button`,{"aria-label":`Copy to clipboard`,className:`btn btn-circle btn-ghost btn-xs text-dim absolute top-1 right-1 z-10 hover:text-base-content`,onClick:()=>{l()},type:`button`,children:s===`copied`?(0,X.jsx)(sK,{size:10}):(0,X.jsx)(uK,{size:10})}),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>fZ?(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 mZ(e,t,n){return n||e.length<=t?{shown:e,hidden:0}:{shown:e.slice(0,t),hidden:e.length-t}}function hZ({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 gZ=`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 _Z({section:e,full:t,onShowAll:n}){switch(e.kind){case`diff`:{let{shown:r,hidden:i}=mZ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{className:`not-prose`,children:[(0,X.jsx)(RX,{hiddenLines:0,lines:r}),(0,X.jsx)(hZ,{hidden:i,onShowAll:n})]})}case`excerpt`:{let{shown:r,hidden:i}=mZ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:gZ,"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)(hZ,{hidden:i,onShowAll:n})]})}case`matches`:{let{shown:r,hidden:i}=mZ(e.matches,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:gZ,"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)(hZ,{hidden:i,onShowAll:n})]})}case`command`:case`script`:{let{shown:r,hidden:i}=mZ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:gZ,"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)(hZ,{hidden:i,onShowAll:n})]})}case`output`:{let{shown:r,hidden:i}=mZ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:gZ,"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)(hZ,{hidden:i,onShowAll:n})]})}case`text`:{let{shown:r,hidden:i}=mZ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(pZ,{className:`overflow-hidden rounded-lg`,content:r.join(`
171
+ `),header:e.label,...e.language===void 0?{}:{language:e.language}}),(0,X.jsx)(hZ,{hidden:i,onShowAll:n})]})}}}function vZ({call:e,tool:t,disclosure:n,onToggle:r}){let i=`${e.id}:full`,a=rL(n,i,!1),o=()=>{r(i,!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)(_Z,{full:a,onShowAll:o,section:e},`${e.kind}:${String(t)}`)),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 yZ({call:e,tool:t,disclosureId:n,size:r,disclosure:i,onToggle:a,renderToolActions:o}){let s=nL(e),c=rL(i,n,s),l=e.status===`running`;return(0,X.jsxs)(`div`,{"data-parakeet-call":e.kind,"data-status":e.status,children:[(0,X.jsx)(dZ,{leading:(0,X.jsx)(LJ,{name:nI[e.kind],size:16}),onOpenChange:()=>{a(n,s)},open:c,size:r,summary:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:l?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)(IX,{size:`sm`,tone:`error`,children:[`exit `,String(e.exitCode)]}),e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:KI(e.durationMs)}),(0,X.jsx)(xq,{motion:l?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:tI(e.status)})]}),children:(0,X.jsx)(vZ,{call:e,disclosure:i,onToggle:a,tool:t})}),e.status===`completed`&&t?.result!==void 0?o?.(t):null]})}var bZ=(0,q.memo)(function({group:e,disclosure:t,onToggle:n,renderToolActions:r}){let i=eL(e),a=rL(t,e.id,i),o=e.status===`running`,s=e.active,c=e.calls.length===1?e.calls[0]:void 0;return c===void 0?(0,X.jsxs)(`div`,{className:`px-1`,children:[(0,X.jsx)(dZ,{className:`[&>.caps-disclosure-panel]:hidden`,leading:(0,X.jsx)(LJ,{name:`list`,size:16}),onOpenChange:()=>{n(e.id,i)},open:a,summary:o&&s!==void 0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:s.activeVerb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:s.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:KI(e.durationMs)}),(0,X.jsx)(xq,{motion:o?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:tI(e.status)})]})}),tL(e,a).map(i=>(0,X.jsx)(yZ,{call:i,disclosure:t,disclosureId:i.id,onToggle:n,renderToolActions:r,size:`row`,tool:e.tools.find(e=>e.id===i.id)},i.id)),e.status===`completed`&&e.calls.length>3?(0,X.jsx)(`button`,{"aria-expanded":a,className:`btn btn-ghost btn-xs text-dim`,onClick:()=>{n(e.id,i)},type:`button`,children:a?`Show less`:`Show all ${String(e.calls.length)} calls`}):null]}):(0,X.jsx)(`div`,{className:`px-1`,children:(0,X.jsx)(yZ,{call:c,disclosure:t,disclosureId:c.id,onToggle:n,renderToolActions:r,size:`row`,tool:e.tools[0]})})}),xZ=()=>void 0,SZ={nothing_to_compact:`nothing to compact`,failed:`compaction failed`,stale:`compaction skipped: the context moved on`,insufficient:`compaction skipped: the summary would not fit`},CZ=(0,q.memo)(function({item:e,onDismissFailed:t,onCancelQueued:n,cancellingQueued:r=!1,renderToolActions:i,renderAssistantAttachment:a,formatAssistantText:o,toolDisclosure:s=$I,onToggleTool:c=xZ}){switch(e.kind){case`user_message`:{let i=e.status===`pending`||e.status===`queued`,a=e.requestId,o=e.commandId,l=e.status===`queued`&&o!==void 0&&n!==void 0?(0,X.jsx)(`div`,{className:`flex justify-end px-3`,children:(0,X.jsx)(YE,{"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)(`button`,{"aria-label":`Dismiss failed prompt`,className:`btn btn-ghost btn-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=rL(s,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)(NX,{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:()=>{c(e.id,!1)},type:`button`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0`,children:(0,X.jsx)(LJ,{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,l]})}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)(PX,{pending:i,speaker:`user`,children:e.text}),d,l]})}case`assistant_message`:return eF(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)(PX,{isError:e.isError===!0,pending:e.pending,speaker:`agent`,...e.thinking?{thinking:e.thinking}:{},children:o?.(e.text)??e.text}),!e.pending&&!e.isError?a?.(e.text):null]}):null;case`tool_group`:return(0,X.jsx)(bZ,{disclosure:s,group:e,onToggle:c,renderToolActions:i});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 ${Rj(e.tokensBefore)} → ${Rj(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:[`· `,SZ[e.result],e.diagnostic===null?``:`: ${e.diagnostic}`]})}});function wZ({disambiguateAuthors:e,visitor:t,composerActionVariant:n,empty:r,commands:i,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s,onLink:c,onOpen:l}){let u=(0,q.useRef)(null),[d]=(0,q.useState)(()=>bi()),f=vB({enabled:t===void 0,commands:i??d,origin:`browser`,keys:{newline:`Shift+Enter`},busy:EZ()}),p=mV(i??d),m=wR(),h=vR(),g=(0,q.useMemo)(()=>gV(m,h.commandAnchors,h.positionAnchors),[m,h.commandAnchors,h.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&&c?.(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)(OZ,{disambiguateAuthors:t===void 0&&e===!0,clientActions:p,onOpen:l,focusAfterJump:u,empty:r,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s}),m.some(({value:e})=>e.panel.length>0)?(0,X.jsx)(`section`,{"aria-label":`Session extension controls`,className:`w-full shrink-0 border-t border-base-300 bg-base-100`,children:m.map(({entryId:e,value:t})=>{let n=t.panel.length===0?void 0:g.omitted.find(t=>t.entryId===e),r=t.panel.length===0?[]:g.unanchored.filter(t=>t.entryId===e).flatMap(({cell:e})=>e.rows.map(t=>({...t,id:`unanchored:${e.id}:${t.id}`})));return(0,X.jsx)(Mq,{entryId:e,rows:[...t.panel,...n===void 0?[]:[{id:`omitted:${e}`,title:`${String(n.count)} earlier change${n.count===1?``:`s`} omitted`,tone:`muted`}],...r],actions:p,onOpen:l},e)})}):null,(0,X.jsx)(kZ,{clientActions:p}),(0,X.jsx)(AZ,{visitor:t,textareaRef:u,composerActionVariant:n,slash:f})]}),t===void 0?(0,X.jsx)(DZ,{slash:f}):null]})}var TZ=new Set([`cancelling`,`queued`,`retrying`,`sending`,`streaming`,`thinking`]);function EZ(){return TZ.has(CR().status)}function DZ({slash:e}){let t=e.interactions.open;return(0,X.jsx)(WG,{open:t!==void 0,onOpenChange:t=>{t||e.store.close()},children:(0,X.jsx)(YG,{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)(cJ,{host:t.host,onClose:e.store.close},t.key)})})}function OZ({disambiguateAuthors:e,clientActions:t,onOpen:n,focusAfterJump:r,empty:i,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s}){let c=bR(),l=vR(),u=(0,q.useCallback)(e=>{l.cancelQueued(e)},[l.cancelQueued]),d=(0,q.useMemo)(()=>Vj(e?[...l.settled,...l.tail].flatMap(e=>`author`in e&&e.author?[e.author]:[]):[]),[e,l.settled,l.tail]),f=gV(wR(),l.commandAnchors,l.positionAnchors),p=f.before.map(({entryId:e,cell:r})=>(0,X.jsx)(Mq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`)),[m,h]=(0,q.useState)($I),g=(0,q.useCallback)((e,t)=>{h(n=>iL(n,e,t))},[]),_=CR(),v=(0,q.useRef)(null),y=(0,q.useRef)(void 0),b=l.settled.length+l.tail.length,x=(0,q.useCallback)(e=>e<l.settled.length?l.settled[e]:l.tail[e-l.settled.length],[l.settled,l.tail]),S=XK({anchorTo:`end`,count:b,estimateSize:()=>72,followOnAppend:`auto`,getItemKey:$K(l.settled,l.tail),getScrollElement:()=>v.current,initialRect:{height:800,width:800},overscan:6,useFlushSync:!1}),C=S.getVirtualItems(),w=S.isAtEnd(),[T,E]=(0,q.useState)(0),D=b>0?x(b-1)?.id:void 0,O=(0,q.useRef)({count:b,lastItem:D});(0,q.useEffect)(()=>{let e=O.current;O.current={count:b,lastItem:D},w?E(0):e.lastItem!==void 0&&D!==e.lastItem&&E(t=>t+Math.max(1,b-e.count))},[w,b,D]);let k=(C[0]?.index??1/0)<3,{hasMoreHistory:A,hasNewerHistory:j,loadingOlderHistory:M,loadOlderHistory:N,loadNewerHistory:P}=l,ee=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(!k){ee.current=!1;return}A&&!M&&!ee.current&&(ee.current=!0,N())},[A,N,M,k]);let te=(0,q.useCallback)(()=>{E(0),y.current=void 0,l.jumpToLatest(),S.scrollToEnd({behavior:`smooth`})},[S,l]);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:Oq(_.status,_.viewState)}),_.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:_.observation.reason}),(0,X.jsx)(`button`,{className:`underline`,onClick:()=>void _.reconnect(),type:`button`,children:`Reconnect`})]}):null,(0,X.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,"data-chat-scroller":!0,ref:v,onScroll:e=>{let t=e.currentTarget.scrollTop;y.current!==void 0&&t<y.current&&l.pinVisibleHistory(),y.current=t},onWheel:e=>{let t=v.current;t===null||M||(e.deltaY<0&&l.pinVisibleHistory(),e.deltaY<0&&t.scrollTop<=1&&A&&N(),e.deltaY>0&&t.scrollTop+t.clientHeight>=t.scrollHeight-1&&j&&P())},style:{overscrollBehavior:`contain`},children:b>0?(0,X.jsx)(`div`,{className:`relative w-full`,style:{height:`${String(S.getTotalSize())}px`},children:C.map(e=>{let r=x(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:S.measureElement,style:{left:0,position:`absolute`,top:0,transform:`translateY(${String(e.start)}px)`,width:`100%`},children:[e.index===0?p:null,(0,X.jsx)(CZ,{item:`author`in r&&r.author&&d.has(r.author.id)?{...r,author:{...r.author,name:d.get(r.author.id)??r.author.name}}:r,onDismissFailed:c,onCancelQueued:u,cancellingQueued:l.cancellingQueued,onToggleTool:g,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s,toolDisclosure:m}),f.after.get(r.id)?.map(({entryId:e,cell:r})=>(0,X.jsx)(Mq,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`))]},e.key)})}):p.length>0?p:A?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?`})]})})}),b>0?(0,X.jsx)(EK,{direction:`forward`,unread:T,focusAfterJump:r,onJump:te,scrollerRef:v}):null]})}function kZ({clientActions:e}){let{viewState:t}=CR(),n=wR(),r=t.kind===`idle`?n.find(({value:e})=>e.waiting!==null):void 0,i=t.kind===`queued`?t:null;return(0,X.jsxs)(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)(YE,{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})]}),(0,X.jsx)(lJ,{waiting:i})]})}function AZ({visitor:e,textareaRef:t,composerActionVariant:n,slash:r}){let i=yR(),a=CR(),o=wR(),s=vR();(0,q.useEffect)(()=>{i.failure!==void 0&&t.current?.focus()},[i.failure,t]);let c=(0,q.useCallback)(()=>{i.cancel()},[i.cancel]),l={queuedRecall:e===void 0?i: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)(Aq,{...l})}function jZ({authorOf:e,disambiguateAuthors:t,visitor:n,markdownPolicy:r=`session`,composerActionVariant:i,empty:a,session:o,clients:s,renderToolActions:c,renderAssistantAttachment:l,formatAssistantText:u,commands:d,onLink:f,onOpen:p}){return(0,X.jsx)(kX.Provider,{value:r,children:(0,X.jsx)(_R,{session:o,clients:s,authorOf:e,children:(0,X.jsx)(wZ,{disambiguateAuthors:t,visitor:n,composerActionVariant:i,empty:a,renderToolActions:c,renderAssistantAttachment:l,formatAssistantText:u,commands:d,onLink:f,onOpen:p})})})}function MZ(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}var NZ=[`primary`,`secondary`,`accent`,`info`,`success`,`warning`];function PZ(e){return NZ[MZ(e)%NZ.length]??`primary`}var FZ=(0,q.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":PZ(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})}),IZ=(0,q.createContext)(null),LZ=(0,q.createContext)(void 0);function RZ(e){let t=(0,q.useContext)(LZ);return e??t}var zZ=(0,q.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=RZ(s),p=f!==void 0,m=(0,q.useContext)(IZ),h=e??m;if(!h)throw Error(`Sprite needs a configured SpriteProvider or service`);let g=(0,q.useRef)(null),_=(0,q.useRef)(null),v=(0,q.useRef)(l);return v.current=l,(0,q.useImperativeHandle)(d,()=>{if(!g.current)throw Error(`Sprite host is not mounted`);return g.current}),(0,q.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,q.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,q.useEffect)(()=>{_.current?.pause(c||p)},[h,c,p]),(0,X.jsx)(`div`,{...u,ref:g})});function BZ(e){return{src:{local:e.character},appearance:e.appearance,expression:e.expression,renderStyle:e.renderStyle}}function VZ(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 HZ=(e,t)=>{let n=si.safeParse(e);return n.success?{kind:`local`,key:n.data.local}:{kind:`remote`,url:new URL(z().parse(e),t).href}},UZ=e=>e instanceof Error?e:Error(String(e),{cause:e}),WZ=e=>en(e)?UZ(Xn(e.cause)):Error(`Unexpected Sprite success`);function GZ(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=VZ(n),i=new WeakSet,a=new WeakMap,o=e=>{let t=HZ(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=je(Tn()),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=Ug(s),w=()=>{let e=y||s.ownerDocument.hidden||b?.matches===!0;C.still(e);try{f?.native?.pause(e)}catch(e){S(UZ(e))}};je($t(c,xt(()=>{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=Dt(br(e.scope,Ln)).then(e=>{if(en(e))throw WZ(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=ci(n.controls,r.appearance),s=gg.parse(r.renderStyle??`plain`)}catch(e){let t=UZ(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(UZ(e))}},D=async(i,a,o)=>{let c=r(),l=je(Tn()),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,je($t(l,xt(()=>{m.remove()}))),s.append(m);let g=tt(function*(){let r,a,o=n.baseURL,s=HZ(i.src,n.baseURL);if(s.kind===`remote`){let t=yield*Lt({try:()=>c(s.url,d.signal),catch:UZ});o=t.url,r=oi.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*Lt({try:n,catch:UZ})).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*Lt({try:n,catch:UZ});r=oi.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=>tt(function*(){let t=yield*Lt({try:()=>c(e,d.signal,o),catch:UZ});return yield*At(xt(()=>URL.createObjectURL(new Blob([t.bytes],{type:t.contentType}))),e=>xt(()=>{URL.revokeObjectURL(e)}))})});if(!l.activities.includes(`idle`))throw Error(`Character has no idle fallback`);return l.pause(!0),{native:l,document:r}}).pipe(kn(l)),_=await Dt(g,{signal:d.signal});if(!(v||o!==p||f!==h)){if(en(_)){let e=WZ(_);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:UZ(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 Dt(br(c,Ln));if(en(e))throw WZ(e)})(),a.set(s,_.then(()=>({kind:`closed`}),e=>({kind:`failed`,error:UZ(e)}))),_)}}}}}var KZ=GZ({characters:{mushroom:async()=>(await ui(async()=>{let{default:e}=await import(`./mushroom-CstiBfYI.js`);return{default:e}},__vite__mapDeps([6,7,2,1,8]))).default,cat:async()=>(await ui(async()=>{let{default:e}=await import(`./cat-DCYVOD6V.js`);return{default:e}},__vite__mapDeps([9,7,2,1,8,10]))).default,burger:async()=>(await ui(async()=>{let{default:e}=await import(`./burger-CJ8nsj7v.js`);return{default:e}},__vite__mapDeps([11,7,2,1,8,10]))).default}}),qZ=(0,q.memo)(function({activity:e=`idle`,avatar:t,className:n,name:r,size:i=24,timeMs:a}){let o=RZ(a),[s,c]=(0,q.useState)(!1),l=(0,q.useMemo)(()=>BZ(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)(FZ,{className:`absolute inset-0`,name:r,seed:r}),(0,X.jsx)(zZ,{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:KZ,src:l.src})]})}),JZ=(0,q.memo)(function({avatar:e,className:t=`h-12 w-12 shrink-0`,service:n=KZ,state:r}){let i=(0,q.useMemo)(()=>e?BZ(e):void 0,[e]);return(0,X.jsx)(zZ,{"aria-hidden":`true`,className:t,service:n,src:i?.src??{local:`mushroom`},...i?{appearance:i.appearance,renderStyle:i.renderStyle}:{},...r})}),YZ={needs_you:`Waiting for you`,running:`Working`,errored:`Failed`,done:`Done`},XZ={needs_you:0,errored_unseen:1,running:2,recent:3};function ZZ(e){return e===`running`||e===`needs_you`}function QZ(e,t){return e!==void 0&&(t===void 0||e>t)}function $Z(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 eQ(e,t){return XZ[e.tier]-XZ[t.tier]||(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)}var tQ=[`Needs you`,`Working`,`Ready`,`Finished`];function nQ(e){return e.tier===`running`?`Working`:e.shelf===`active`?`Needs you`:e.ready?`Ready`:`Finished`}function rQ(e){return{key:cQ(e.agentId,e.sessionId),shelf:nQ(e),attention:e.tier===`needs_you`||e.tier===`errored_unseen`?`${e.tier}:${String(e.settledAt??e.createdAt)}`:null}}function iQ(e,t,n){let r=new Map(t.map(e=>[cQ(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(rQ).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=tQ.flatMap(t=>{let a;a=e===null||n.reorder?i.map(rQ).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:rQ(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:rQ(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 aQ(e){switch(e.kind){case`idle`:return`done`;case`waiting_for_you`:return`needs_you`;case`error`:return`errored`;default:return`running`}}function oQ(e,t,n=null,r){let i=new Set(e.map(e=>e.agentId));return sQ(t.filter(e=>!(`kind`in e)&&i.has(e.agentId)&&(n===null||e.agentId===n)),r)}function sQ(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=QZ(i.settledAt,i.visitedAt),a=t?.agentId===i.agentId&&t.sessionId===i.sessionId?t.state:void 0,o=a?aQ(a):i.state,s=a?a.kind===`idle`:o===`done`&&i.settledAt===void 0,c=$Z(o,e);n.push({...i,state:o,ready:s,unseen:e,tier:c,shelf:c===`recent`?`settled`:`active`})}return n.sort(eQ),{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 cQ(e,t){return`${e}\u0000${t}`}function lQ(e){return e.name}function uQ({children:e}){return(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:e})}function dQ({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,q.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)(YE,{variant:`ghost`,"aria-label":`All Agents`,"aria-pressed":h,className:`${m} text-xs ${h?`bg-base-300`:``}`,onClick:c,children:(0,X.jsx)(uQ,{children:`All`})}),a?(0,X.jsx)(YE,{variant:`ghost`,"aria-label":`Websites`,"aria-pressed":i,className:`${m} ${i?`bg-base-300`:``}`,onClick:l,children:(0,X.jsx)(uQ,{children:(0,X.jsx)(LJ,{name:`internet`,size:28})})}):null,(0,X.jsx)(Ij,{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)(YE,{variant:`ghost`,"aria-label":lQ(e),title:lQ(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)(uQ,{children:(0,X.jsx)(qZ,{activity:n.get(e.agentId)??(f===e.agentId?`thinking`:`idle`),avatar:e.avatar,name:lQ(e),size:32})})},e.agentId))})}),o?(0,X.jsx)(YE,{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)(gK,{size:20})})}):null]})}function fQ({app:e}){let[t,n]=(0,q.useState)(null),r=zs({queryKey:lx.of(e,`team-inbox-notices`,t),enabled:e!==null&&(e.capabilities.has(y_)||e.capabilities.has(b_)),queryFn:async()=>{if(!e)throw Error(`No App connection`);let n=await E_(e.capabilities);try{return await rx(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)(Ij,{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)(YS,{density:`compact`,className:`px-3 py-2`,children:r.data.items.map(e=>(0,X.jsx)(XS,{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)(xq,{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)(YE,{variant:`ghost`,size:`sm`,onClick:()=>{n(r.data.next)},children:`Older notices`}):null,t===null?null:(0,X.jsx)(YE,{variant:`ghost`,size:`sm`,onClick:()=>{n(null)},children:`Newest notices`})]})})}var pQ=`(min-width: 900px)`;function mQ(e){let t=globalThis.matchMedia(pQ);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}}function hQ(){return globalThis.matchMedia(pQ).matches}function gQ(){return(0,q.useSyncExternalStore)(mQ,hQ,()=>!0)}function _Q({open:e,onOpenChange:t,returnFocus:n,children:r}){let i=gQ(),[a,o]=(0,q.useState)(null);return(0,X.jsxs)(WG,{open:i||e,modal:!i,disablePointerDismissal:i,onOpenChange:e=>{i||t(e)},children:[(0,X.jsx)(`div`,{ref:o,className:`contents`}),(0,X.jsxs)(KG,{container:a,keepMounted:!0,className:`contents`,children:[i?null:(0,X.jsx)(qG,{className:`grove-nav-scrim z-30 bg-base-200`}),(0,X.jsx)(JG,{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 vQ=U({path:V,entries:H(U({name:V,type:Sr([`file`,`directory`,`symlink`]),size:Pn,modifiedAt:Pn})),nextOffset:wn(Pn)}),yQ=Qh(`computer.list`,1,Qe(()=>$h({list:tg(eg(Ft().transform(e=>Pr(vQ)(e))))}))),bQ=xn([U({state:Sr([`running`,`sleeping`,`starting`])}),U({state:B(`queued`),position:Pn.pipe(G(xr()),G(Qr(0)))})]),xQ=U({enabled:$r,effective:$r,blockedBy:wn(Sr([`team`,`global`]))}),SQ=U({computerId:fn,name:fn,runtime:bQ,backends:H(U({id:fn,kind:Sr([`platform-container`,`on-box-vm`,`local`]),status:Sr([`ready`,`queued`,`online`,`offline`]),queuePosition:wn(Pn.pipe(G(xr()),G(Qr(0)))),hostId:wn(V),hostLabel:wn(V),folderLabel:wn(V),detachable:$r})),internet:xQ});Qh(`computer.instrument.read`,1,Qe(()=>$h({read:tg(eg(Ft().transform(e=>Pr(SQ)(e))))}))),Qh(`computer.instrument.control`,1,Qe(()=>$h({start:tg(eg(Ft().transform(e=>Pr(bQ)(e)))),setInternetAccess:tg(eg(Ft().transform(e=>Pr(xQ)(e)))),detachLocal:tg(eg(Ft().transform(e=>Pr(U({detached:$r}))(e))))})));var CQ=U({ports:H(U({port:Pn.pipe(G(xr()),G(gr({minimum:1,maximum:65535}))),previewUrl:fn,openMode:Sr([`inline`,`external-only`]),expiresAt:Pn.pipe(G(xr()),G(Qr(0)))})).pipe(G(K(64)))}),wQ=xn([CQ,U({error:B(`port_previews_not_configured`)})]),TQ=U({port:Pn.annotate({message:`Use a port from 1 to 65535.`}).check(xr({message:`Use a port from 1 to 65535.`}),gr({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:$r}),EQ=U({port:Pn.pipe(G(xr()),G(gr({minimum:1,maximum:65535}))),removed:$r});Qh(`computer.ports`,2,Qe(()=>$h({list:tg(eg(Ft().transform(e=>Pr(wQ)(e)))),expose:tg(eg(Ft().transform(e=>Pr(TQ)(e)))),unexpose:tg(eg(Ft().transform(e=>Pr(EQ)(e))))})));var DQ=Sr([`synced`,`pending`,`unknown`]),OQ=U({port:wn(TQ.fields.port),id:fn,command:fn,cwd:wn(V),startedAt:Pn.pipe(G(xr()),G(sn(0))),state:Sr([`running`,`exited`,`uncertain`]),exitCode:wn(Pn.pipe(G(xr()))),sync:DQ,endedAt:wn(Pn.pipe(G(xr()),G(sn(0))))}),kQ=U({processes:H(OQ)}),AQ=U({process:OQ,signalled:$r});U({requestId:fn.pipe(G(K(256))),command:fn.pipe(G(K(16384))),cwd:An(V),port:An(TQ.fields.port)}),Qh(`computer.processes`,1,Qe(()=>$h({start:tg(eg(Ft().transform(e=>Pr(OQ)(e)))),list:tg(eg(Ft().transform(e=>Pr(kQ)(e)))),kill:tg(eg(Ft().transform(e=>Pr(AQ)(e))))}))),Qh(`computer.readFile`,1,Qe(()=>$h({open:tg($h({response:tg(E(Response)),close:ng}))}))),Qh(`computer.writeFile`,3,Qe(()=>$h({open:tg($h({write:ng,close:ng})),mkdir:ng,replace:tg(eg(Ft().transform(e=>Pr(jQ)(e))))})));var jQ=xn([U({kind:B(`replaced`),path:fn,bytes:Pn.pipe(G(xr()),G(sn(0)))}),U({kind:B(`conflict`)})]),MQ=U({computerName:fn.pipe(G(K(256))),teamName:fn.pipe(G(K(256))),modelDoor:fn.pipe(G(K(256))),uptimeSeconds:Pn.pipe(G(xr()),G(sn(0))),version:fn.pipe(G(K(64)))});Qh(`computer.terminal`,2,Qe(()=>$h({open:tg($h({information:tg(eg(Ft().transform(e=>Pr(MQ)(e)))),output:tg(E(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(E(Uint8Array).parse(e))}})))),input:tg(E(WritableStream)),resize:ng,close:ng}))})));function NQ({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 PQ(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 FQ=[],IQ=0,{link:LQ,unlink:RQ,propagate:zQ,checkDirty:BQ,shallowPropagate:VQ}=NQ({update(e){return e._update()},notify(e){FQ[UQ++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,qQ(e))}}),HQ=0,UQ=0,WQ,GQ=0;function KQ(e){try{++GQ,e()}finally{--GQ||JQ()}}function qQ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=RQ(n,e)}function JQ(){if(!(GQ>0)){for(;HQ<UQ;){let e=FQ[HQ];FQ[HQ++]=void 0,e.notify()}HQ=0,UQ=0}}function YQ(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 WQ!==void 0&&LQ(i,WQ,IQ),i._snapshot},subscribe(e){let t=PQ(e),n={current:!1},r=XQ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=WQ,o=t?.compare??Object.is;if(n)WQ=i,++IQ,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{WQ=a,n&&(i.flags&=-5),qQ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&BQ(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&VQ(e)}}else e&32&&(i.flags=e&-33);return WQ!==void 0&&LQ(i,WQ,IQ),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(zQ(e),VQ(e),JQ())}},i}function XQ(e){let t=()=>{let t=WQ;WQ=n,++IQ,n.depsTail=void 0,n.flags=6;try{return e()}finally{WQ=t,n.flags&=-5,qQ(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&&BQ(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,qQ(this)}};return t(),n}var ZQ=class{constructor(e,t){this.atom=YQ(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(PQ(e))}},QQ=class{constructor(e){this.atom=YQ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(PQ(e))}};function $Q(e,t){return typeof e==`function`?new QQ(e):t?new ZQ(e,t):new ZQ(e)}var e$=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 t$(e,t){return new e$(e,t).maybeExecute}var n$=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)}},r$=new class extends n${constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function i$(e,t){return typeof e==`function`?e(t):e}function a$(e,t){return p$(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function o$(e,t,n){let r=p$(t);function i(e){if(!r.length)return i$(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 s$(e,t){let n=p$(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 c$=46,l$=91,u$=93,d$=48,f$=57;function p$(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)===l$),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===c$||s===l$||s===u$){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==d$),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!==u$&&(a!==-1||s!==u$)&&(a!==s||s!==c$&&s!==l$)&&n.push(``);r=o+1,i=!0}else(s<d$||s>f$)&&(i=!1);a=s}return n.length||n.push(``),n}function m$(e){return!(Array.isArray(e)&&e.length===0)}function h$(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 g$(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 _$=e=>!!e&&typeof e==`object`&&`fields`in e;function v$(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)||!v$(e[i],t[i]))return!1;return!0}var y$=({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},b$=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function x$(e,t){return e==null?t:{...e,...t}}for(var S$=256,C$=[],w$;S$--;)C$[S$]=(S$+256).toString(16).substring(1);function T$(){let e=0,t,n=``;if(!w$||S$+16>256){for(w$=Array(256),e=256;e--;)w$[e]=256*Math.random()|0;e=0,S$=0}for(;e<16;e++)t=w$[S$+e],n+=e===6?C$[t&15|64]:e===8?C$[t&63|128]:C$[t],e&1&&e>1&&e<11&&(n+=`-`);return S$++,n}var E$=t$(e=>r$.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function D$(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]=D$(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,D$(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(D$(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=D$(e[n]));return t}function O$(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var k$=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 A$(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 j$=(e,t)=>{let n=A$(e,t);return{form:n,fields:n}},M$={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:j$(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:j$(r.issues,e)}},N$=e=>!!e&&`~standard`in e,P$={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function F$(e){function t(t){let n=e.getFieldMeta(t)??P$;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=()=>P$;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function I$(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 L$=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{E$(this)}),t=r$.on(`request-form-state`,e=>{e.payload.id===this._formId&&r$.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=r$.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=r$.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(),r$.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return r$.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&&!v$(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!v$(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(KQ(()=>{this.baseStore.setState(()=>I$(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=F$(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}r$.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=o$(t,e.instance.name,e.instance.options.defaultValue))}),I$({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return KQ(()=>{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 KQ(()=>{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=h$(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||k$}),r=!1,i={};return KQ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=R$(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=z$(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)??P$,r=a?.[e],{newErrorValue:s,newSource:c}=y$({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=P$)=>({...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=z$(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=z$(`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=g$(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||k$});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=z$(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}=R$(r);s&&(i=i?{...i,...s}:s);let c=z$(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)??P$,r=i?.[e],{newErrorValue:a,newSource:o}=y$({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=P$)=>({...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})),KQ(()=>{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}),r$.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}),r$.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}KQ(()=>{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}),KQ(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),r$.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),r$.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>a$(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]:i$(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=P$,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;KQ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:o$(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=s$(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),F$(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],x$(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),F$(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),x$(r,{dontValidate:!0})),F$(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),x$(n,{dontValidate:!0})),F$(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 o$(o$(e,`${t}`,i),`${n}`,r)},x$(r,{dontValidate:!0})),F$(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},x$(r,{dontValidate:!0})),F$(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,[],x$(t,{dontValidate:!0})),F$(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=a$(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:P$},values:i===void 0?t.values:o$(t.values,e,i)}})},this.setErrorMap=e=>{KQ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(_$(t)){let{formError:e,fieldErrors:r}=R$(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=>M$.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>M$.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??T$(),this._devtoolsSubmissionOverride=!1;let t=I$({...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||!_$(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=$Q(t);let n;this.fieldMetaDerived=$Q(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=a$(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=!m$(u),f=!o.isDirty,p=v$(l,this.getFieldInfo(a)?.instance?.options.defaultValue??a$(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=$Q(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||!O$(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&&O$(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=$Q(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&&_$(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&&v$(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 N$(e.validate)?M$[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function R$(e){return e?_$(e)?{formError:R$(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function z$(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 B$=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]:{...P$,isTouched:e.fieldMetaBase[this.name]?.isTouched??P$.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??P$.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??P$.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&&(v$(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,x$(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,x$(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,x$(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,x$(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,x$(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,x$(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,x$(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,x$(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=h$(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||k$}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=h$(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||k$});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;KQ(()=>{let e=(e,n)=>{let r=H$(n.cause),a=n.validate?V$(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}=b$({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=H$(`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=g$(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||k$}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=g$(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||k$});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)));KQ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=H$(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=V$(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=b$({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)),KQ(()=>{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=>O$(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[H$(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[H$(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=>M$.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>M$.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)O$(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=$Q(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...P$,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!v$(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 N$(e.validate)?M$[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 V$(e){if(e)return e}function H$(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 U$(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function W$(e){return{...P$,...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 G$=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??U$({});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&&(v$(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,{...P$,...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]??U$({...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;q$(t)&&(n=t.group,r=t.fields);let i=K$(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]:U$({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,x$(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 B$&&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&&O$(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}=y$({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=P$)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=h$(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||k$}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=h$(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||k$});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;KQ(()=>{let t=(t,r)=>{let i=Y$(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&&q$(s)&&(c=s.group,l=s.fields);let u=K$(c),d=n[i],{newErrorValue:f,newSource:p}=b$({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=Y$(`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=g$(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||k$}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=g$(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||k$});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=Y$(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&&q$(o)&&(l=o.group,u=o.fields);let d=K$(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=b$({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 KQ(()=>{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=>O$(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[Y$(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>O$(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})),KQ(()=>{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}KQ(()=>{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}),KQ(()=>{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=$Q(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??W$(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!v$(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(N$(e.validate)){let t=M$[e.type](e.value,e.validate);return e.type===`validate`?J$(t):t.then(J$)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function K$(e){if(e)return e}function q$(e){return!!e&&typeof e==`object`&&`fields`in e}function J$(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 Y$(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 X$(e,t){if(!t)return;let n=Object.assign({},e,{state:D$(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 KQ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function Z$(e,t){return e===t}function Q$(e,t=e=>e,n){let r=n?.compare??Z$,i=(0,q.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,q.useCallback)(()=>e.get(),[e]);return(0,wU.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var $$=typeof window<`u`?q.useLayoutEffect:q.useEffect;function e1(e){let[t,n]=(0,q.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,q.useState)(()=>new B$({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new B$({...e}),i(a),n({form:e.form,name:e.name}));let o=Q$(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=Q$(a.store,e=>e.meta.isTouched),c=Q$(a.store,e=>e.meta.isBlurred),l=Q$(a.store,e=>e.meta.isDirty),u=Q$(a.store,e=>e.meta.errorMap),d=Q$(a.store,e=>e.meta.errorSourceMap),f=Q$(a.store,e=>e.meta.isValidating),p=(0,q.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 $$(a.mount,[a]),$$(()=>{a.update(e)}),p}var t1=(({children:e,...t})=>{let n=e1(t),r=(0,q.useMemo)(()=>i$(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function n1(){return(0,q.useState)(()=>T$())[0]}var r1=q,i1=`18.3.1`.split(`.`)[0]===`17`?n1:r1.useId;function a1(e){let[t,n]=(0,q.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,q.useState)(()=>new G$({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new G$({...e})),n({form:e.form,name:e.name}));let a=Q$(r.store,e=>e.value),o=Q$(r.store,e=>e.meta.isTouched),s=Q$(r.store,e=>e.meta.isBlurred),c=Q$(r.store,e=>e.meta.isDirty),l=Q$(r.store,e=>e.meta.errorMap),u=Q$(r.store,e=>e.meta.errorSourceMap),d=Q$(r.store,e=>e.meta.isValidating),f=Q$(r.store,e=>e.meta.isSubmitting),p=Q$(r.store,e=>e.meta.isSubmitted),m=Q$(r.store,e=>e.meta.submissionAttempts),h=Q$(r.store,e=>e.meta.isSubmitSuccessful),g=Q$(r.store,e=>e.meta.canSubmit),_=Q$(r.store,e=>e.meta.isValid),v=Q$(r.store,e=>e.meta.isFieldsValid),y=Q$(r.store,e=>e.meta.isFieldsValidating),b=Q$(r.store,e=>e.meta.isGroupValid),x=(0,q.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 $$(r.mount,[r]),$$(()=>{r.update(e)}),x}var o1=(({children:e,...t})=>{let n=a1(t),r=(0,q.useMemo)(()=>i$(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function s1({form:e,selector:t=e=>e,children:n}){let r=Q$(e.store,t);return(0,X.jsx)(X.Fragment,{children:i$(n,r)})}function c1(e){let t=i1(),[n,r]=(0,q.useState)(e?.formId),[i,a]=(0,q.useState)(()=>new L$({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new L$({...e,formId:n})),r(n)}let o=(0,q.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)(t1,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(o1,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(s1,{form:i,selector:e.selector,children:e.children})},e},[i]);$$(i.mount,[]),$$(()=>{i.update(e)});let s=(0,q.useRef)(!1);return $$(()=>{s.current&&e?.transform&&X$(i,e.transform)},[i,e?.transform]),$$(()=>{s.current=!0}),o}var l1=vr(V),u1=vr(U({message:V}));function d1(e){for(let t of e.errors){let e=we(Ae(mt(u1(t),e=>e.message),()=>l1(t)));if(e!==void 0&&e.length>0)return e}}var f1={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},p1=(0,q.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)(YE,{...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)]`,f1[n]),children:t})})}),m1={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},h1=(0,q.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`,m1[t],e),ref:r})});(0,q.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)(h1,{"aria-label":e,value:t,max:n,tone:r})]})});function g1({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)(y1,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function _1({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(p1,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(_K,{}):(0,X.jsx)(bK,{}),onClick:()=>void n(t),type:`button`}):null}function v1({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 y1({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)(pK,{className:`size-4`})}),(0,X.jsx)(v1,{item:e}),(0,X.jsx)(b1,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(h1,{"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 b1({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)(_1,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(_1,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(_1,{action:e.remove,id:t,onAction:r})]})}var x1={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`},S1={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function C1({state:e}){let t=`caps-checkbox-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(e).current,i=(0,q.useRef)(e),a=NC();return(0,q.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=SC(n.current),c=Aj(s,{ease:`inCubic`,duration:160}),l=OE(n.current,{d:{to:x1[e],...o?Oj:Aj(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?Oj:t?Aj(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...Aj(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:wC(s,120),...kj(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)(NE,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(PE,{id:`${t}-shadow`}),(0,X.jsx)(FE,{id:`${t}-inset`}),(0,X.jsx)(LE,{id:`${t}-goo`,values:S1}),(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:x1[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 w1=(0,q.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,q.useRef)(null),[d,f]=(0,q.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,q.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,q.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,q.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)(C1,{state:m}):n]})}),T1=q.createContext(void 0);function E1(e){let t=q.useContext(T1);if(t===void 0&&!e)throw Error(vD(47));return t}var D1={...BU,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!BU.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&BU.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>BU.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},O1=class extends jU{constructor(e,t,n){let r=new dU;super(k1(e,r,t,n),A1(r),D1)}setOpen=(e,t)=>{let n=t.reason===AV,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=aU(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=iU(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}),ER.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function k1(e,t,n,r=!1){let i={...PU(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 A1(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),stickIfOpenTimeout:new hD,stickIfOpen:!0,triggerElements:e}}var j1=bU(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=N1(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),uU(u,d),sU(u);let{forceUnmount:m}=cU(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),q.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,DV(FV))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(T1.Provider,{value:u,children:[s&&(0,X.jsx)(tU,{handle:s,store:u}),h&&(0,X.jsx)(P1,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function M1(e){return E1(!0)?(0,X.jsx)(j1,{props:e}):(0,X.jsx)(AH,{children:(0,X.jsx)(j1,{props:e})})}function N1(e,t){let n=eU((e,n)=>new O1(t,e,n));return q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function P1({store:e,modal:t}){let n=WH(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return lU(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function F1(e,t){function n(n,r,i){let a=n.currentTarget;ER.flushSync(()=>{e.setOpen(!1,DV(NV,n.nativeEvent,a))}),zA(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&&BA(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var I1=xU(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=E1(!0),h=VU(s)??m;if(!h)throw Error(vD(74));let g=lO(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=q.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=oU(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=YU(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:rW(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=VH(v,{stickIfOpen:sD(()=>h.context.stickIfOpen)}),k=LG(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=wV({disabled:a,native:o}),N={open(e){return w?Tk.open(e):wk.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:ee}=F1(h,x),te=JD(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[mH]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),F=(0,X.jsx)(q.Fragment,{children:te},g);return E?(0,X.jsxs)(q.Fragment,{children:[(0,X.jsx)(QV,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),F,(0,X.jsx)(QV,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):F}),L1=q.createContext(void 0);function R1(){let e=q.useContext(L1);if(e===void 0)throw Error(vD(45));return e}var z1=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return E1().useState(`mounted`)||n?(0,X.jsx)(L1.Provider,{value:n,children:(0,X.jsx)(xH,{ref:t,...r})}):null}),B1=q.createContext(void 0);function V1(){let e=q.useContext(B1);if(!e)throw Error(vD(46));return e}function H1(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]=q.useState(null),d=q.useRef(null),f=DH(n),p=q.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=tG({...e,elements:{...p,...l&&{reference:l}}}),h=q.useCallback(e=>{let t=CO(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=q.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=q.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=q.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 tj(()=>{o&&(d.current=o)},[o]),tj(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),q.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var U1=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}=Zk(e,t)||{};if(l==null)return{};let d=hA(u),f={x:n,y:r},p=rA(i),m=tA(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=Xk(D,k,O),j=!c.arrow&&$k(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}}}),W1=(e,t)=>{let{name:n,fn:r}=U1(e);return{name:n,fn:r,options:[e,t]}},G1={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}}}},K1={sideX:`left`,sideY:`top`},q1=`--available-width`,J1=`--available-height`,Y1=`--anchor-width`,X1=`--anchor-height`,Z1=`--transform-origin`,Q1=q1,$1=J1;function e0(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 t0(e,t,n){let{rects:r,placement:i}=e;return{side:e0(t,Qk(i),n),align:$k(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function n0(e){return r0(e,H1)}function r0(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=sD(O),A=O?k:n,j=WV(n),M=WV(g),N=oj()===`rtl`,[P,ee]=q.useState(null);!g&&P!==null&&ee(null);let te=x===`placement`,F=P?Qk(P):null,ne=P&&te?$k(P)||`center`:null,re=F||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ie=ne||o,ae=ie===`center`?re:`${re}-${ie}`,I=l;typeof I==`number`?I={top:I,right:I,bottom:I,left:I}:I&&={top:I.top||0,right:I.right||0,bottom:I.bottom||0,left:I.left||0};let oe=+(i===`bottom`),se=+(i===`top`),L=+(i===`right`),ce=+(i===`left`),le={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:I},R=q.useRef(null),ue=WV(a),de=WV(s),fe=typeof a==`function`?0:a,pe=typeof s==`function`?0:s,me=[];p&&me.push(p),me.push(nG(e=>{let t=t0(e,i,N),n=typeof ue.current==`function`?ue.current(t):ue.current,r=typeof de.current==`function`?de.current(t):de.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[fe,pe,N,i]));let he=w===`none`&&C!==`shift`,ge=!he&&(u||E||C===`shift`),_e=C===`none`?null:aG({...le,padding:{top:I.top+1+oe,right:I.right+1+ce,bottom:I.bottom+1+se,left:I.left+1+L},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),ve=he?null:rG({...le,rootBoundary:D,mainAxis:w!==`none`,crossAxis:ge,limiter:u||E?void 0:iG(e=>{if(!R.current)return{};let{width:t,height:n}=R.current.getBoundingClientRect(),r=nA(Qk(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})},[le,u,E,D,I,w]);C===`shift`||w===`shift`||ie===`center`?me.push(ve,_e):me.push(_e,ve),me.push(oG({...le,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(Q1,`${t}px`),i.setProperty($1,`${n}px`);let a=bO(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(Y1,`${u}px`),i.setProperty(X1,`${d}px`)}}),W1(e=>({element:R.current||yA(e.elements.floating).createElement(`div`),padding:R.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=Qk(r),u=$k(r),d=nA(l)===`y`,f=R.current,p=typeof a==`function`?a(t0(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 ge&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(Z1,d?`${m} ${h}`:`${h} ${m}`),{}}},G1,b),tj(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ye=q.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:be,elements:xe,x:Se,y:Ce,middlewareData:we,update:Te,placement:Ee,context:De,isPositioned:Oe,floatingStyles:ke}=t({rootContext:h,open:m?g:void 0,placement:ae,middleware:me,strategy:r,whileElementsMounted:m?void 0:(...e)=>UW(...e,ye),nodeId:y,externalTree:S}),{sideX:Ae,sideY:je}=we.adaptiveOrigin||K1,Me=Oe?r:`fixed`,Ne=q.useMemo(()=>{let e;return e=Oe?b?{position:Me,[Ae]:Se,[je]:Ce}:{...ke,position:Me}:{position:Me,top:0,left:0},e[Q1]=`100vw`,e[$1]=`100vh`,Oe||(e.opacity=0),e},[b,Me,Ae,Se,je,Ce,ke,Oe]),Pe=q.useRef(null);tj(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(i0(t)?t.current:t)||null;n!==Pe.current&&(be.setPositionReference(n),Pe.current=n)},[g,be,A,j]),q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&i0(e)&&e.current!==Pe.current&&(be.setPositionReference(e.current),Pe.current=e.current)},[g,be,A,j]),q.useEffect(()=>{if(m&&g&&xe.reference&&xe.floating)return UW(xe.reference,xe.floating,Te,ye)},[m,g,xe,Te,ye]);let Fe=Qk(Ee),Ie=e0(i,Fe,N),Le=$k(Ee)||`center`,Re=!!we.hide?.referenceHidden;tj(()=>{x&&g&&Oe&&(Fe!==re||te&&Le!==ie)&&ee(Ee)},[x,te,g,Oe,Ee,Fe,Le,re,ie]);let ze=q.useMemo(()=>({position:`absolute`,top:we.arrow?.y,left:we.arrow?.x}),[we.arrow]),Be=we.arrow?.centerOffset!==0;return q.useMemo(()=>({positionerStyles:Ne,arrowStyles:ze,arrowRef:R,arrowUncentered:Be,side:Ie,align:Le,physicalSide:Fe,anchorHidden:Re,refs:be,context:De,isPositioned:Oe,update:Te}),[Ne,ze,R,Be,Ie,Le,Fe,Re,be,De,Oe,Te])}function i0(e){return e!=null&&`current`in e}function a0(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=q.useRef(null),o=q.useRef(null),s=YH(r);tj(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),tj(()=>{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 o0(e){return e===`starting`?pH:fD}function s0(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),JD(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},o0(r),i],stateAttributesMapping:Ek})}var c0=20;function l0(e,t,n,r){let[i,a]=q.useState(!1);tj(()=>{if(!e||!t||n==null){a(!1);return}let r=yA(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-c0)},[e,t,n]),DG(e&&(!t||i),r)}var u0=q.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=hH,..._}=e,v=E1(),y=R1(),b=OH(),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=n0({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`)});a0({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;l0(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=s0(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)(B1.Provider,{value:j,children:[S&&M&&(0,X.jsx)(hG,{inert:mG(!C),cutout:T}),(0,X.jsx)(kH,{id:b,children:P})]})}),d0=q.createContext(void 0);function f0(e){let t=q.useContext(d0);if(t===void 0&&!e)throw Error(vD(69));return t}var p0=q.createContext(void 0);function m0(){let[e,t]=q.useState(0),n=sD(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var h0=q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=E1(),l=V1(),u=f0(!0)!=null,{context:d,hasClosePart:f}=m0(),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`);XH({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),qU(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?$H(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=JD(`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`,...QH,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&lG.has(e.key)&&e.stopPropagation()}},o0(g),s],stateAttributesMapping:Dk});return(0,X.jsx)(BH,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:wO(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(p0.Provider,{value:d,children:M})})}),g0=(0,q.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)(cK,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function _0({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,q.useState)(``),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(t),[x,S]=(0,q.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,q.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=rJ({getKey:n,isDisabled:o,items:T});(0,q.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(rq(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,q.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 v0(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,q.useId)(),ee=O?.props??_,te=g??ee?.id??P,F={id:te,"aria-describedby":[t,ee?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??ee?.[`aria-invalid`],"aria-label":ee?.[`aria-label`]??r,"aria-labelledby":ee?.[`aria-labelledby`]??i,"aria-required":a??ee?.[`aria-required`]},{keyboardNavigation:ne,onPointerMove:re,activeItem:ie,activeKey:ae,commit:I,groups:oe,inputValue:se,listboxId:L,onInputChange:ce,onInputKeyDown:le,open:R,optionId:ue,selectedKeys:de,setOpen:fe}=_0({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:te,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});HG(()=>{O&&fe(!1)});let pe=VG(`popover`),me=s===void 0?pe:s,he=tJ(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),ge=(0,X.jsx)(Zq,{..._,...O?{}:F,"aria-activedescendant":ie?ue(f(ie)):void 0,"aria-autocomplete":`list`,"aria-controls":L,"aria-expanded":!0,className:Q(`input-sm`,_?.className),id:O?_?.id??`${te}-input`:te,onChange:e=>{_?.onChange?.(e),ce(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||le(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:se}),_e=(0,X.jsx)(`div`,{id:L,ref:he,className:`caps-combobox-list`,"data-navigation":ne?`keyboard`:`pointer`,onPointerMove:re,role:`listbox`,"aria-multiselectable":C??void 0,children:oe.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):oe.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=ae===t,i={active:r,disabled:n,selected:de.includes(t)};return(0,X.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&ne,disabled:n,id:ue(t),onClick:()=>{I(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)(sK,{}):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)(M1,{modal:!0,onOpenChange:fe,open:R,children:[(0,X.jsx)(I1,{...F,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),me===null?null:(0,X.jsx)(z1,{container:me,children:(0,X.jsx)(u0,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(h0,{"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:ge}),_e]})})})]})}):(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:ge}),_e]})})}function y0({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 b0=(0,q.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)(w1,{...a,appearance:r??`default`,"aria-label":e,className:Q(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(y0,{icon:t,caption:n}),ref:o})})});function x0({checked:e}){let t=`caps-radio-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(e).current,i=(0,q.useRef)(e),a=(0,q.useRef)(null),o=CC(a),{reduced:s}=o;return(0,q.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=Aj(o,{ease:`outCubic`,duration:75}),c=e?kj(o,{bounce:.65,duration:300}):Aj(o,{ease:`inCubic`,duration:100}),l=OE(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)(NE,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(PE,{id:`${t}-shadow`}),(0,X.jsx)(FE,{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 S0=(0,q.createContext)(null),C0=(0,q.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,q.useId)(),d=(0,q.useRef)(null);(0,q.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,q.useState)(n),h=s??p;return(0,q.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)(S0.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})})}),w0=(0,q.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,q.useContext)(S0);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)(x0,{checked:c}):t]})}),T0=(0,q.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,q.useContext)(S0),s=(0,q.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)(w0,{...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]})}),E0=(0,q.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)(w0,{...i,"aria-label":e,className:Q(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(y0,{icon:t,caption:n}),ref:a})})}),D0=(0,q.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)(cK,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function O0({checked:e}){let t=`caps-switch-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(null),i=(0,q.useRef)(e).current,a=(0,q.useRef)(e),o=NC();return(0,q.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=SC(n.current),c=kj(s,{bounce:.25,duration:440}),l=Aj(s,{ease:`inOutSine`,duration:100}),u=OE(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=OE(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)(NE,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(PE,{id:`${t}-shadow`}),(0,X.jsx)(FE,{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 k0=(0,q.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,q.useRef)(null),[c,l]=(0,q.useState)(n),u=t??c;return(0,q.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,q.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)(O0,{checked:u})]})}),A0=vr(V),j0=vr($r),M0=vr(wn(ln)),N0=vr(H(V)),P0=H(Lr(File)),F0=vr(P0),I0=xn([V,ln,$r,vn,Sn,H(V),P0]),L0=vr(I0),R0=e=>ve(A0(e.state.value),()=>``),z0=e=>ve(j0(e.state.value),()=>!1),B0=e=>ve(M0(e.state.value),()=>null),V0=e=>ve(N0(e.state.value),()=>[]),H0=e=>ve(F0(e.state.value),()=>[]),U0=e=>ve(L0(e.state.value),()=>null);function W0({field:e,spec:t,locked:n,...r}){let[i,a]=(0,q.useState)(!1);return(0,X.jsxs)(Pq,{children:[(0,X.jsx)(Zq,{...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:R0(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(YE,{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)(dK,{"aria-hidden":`true`}):(0,X.jsx)(fK,{"aria-hidden":`true`})})]})}var G0={text:`text`,email:`email`,url:`url`,tel:`tel`};function K0({spec:e,field:t,locked:n,...r}){let i=H0(t),a=n||e.readOnly===!0,o=(0,q.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(PC,{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)(YE,{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)(g1,{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 q0({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)(Zq,{...a,type:G0[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:R0(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(Sq,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:R0(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(W0,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)(Pq,{children:[(0,X.jsx)(Fq,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(Zq,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:R0(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(Zq,{...a,type:`date`,readOnly:e.readOnly,value:R0(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(Xq,{...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:B0(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(D0,{...a,value:R0(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)(v0,{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:R0(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(g0,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===R0(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)(K0,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(w1,{...a,disabled:n||e.readOnly===!0,checked:z0(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(k0,{...a,disabled:n||e.readOnly===!0,checked:z0(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var J0=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function Y0({spec:e,field:t,locked:n,error:r}){let i=n||e.readOnly===!0,a=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=V0(t),o=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(Uq,{legend:a,description:e.help,disabled:i,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)(b0,{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=>{o(r.value,e.currentTarget.checked)}},r.value))}):e.options.map(r=>(0,X.jsx)(Gq,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(w1,{name:e.name,value:r.value,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{o(r.value,e.currentTarget.checked)}})},r.value))})}let o=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,X.jsx)(Uq,{legend:a,description:e.help,disabled:i,error:r??null,children:(0,X.jsx)(C0,{name:e.name,"aria-label":a,value:R0(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||o?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,X.jsx)(E0,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):o?(0,X.jsx)(T0,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(Gq,{label:t.label,orientation:`inline`,children:(0,X.jsx)(w0,{value:t.value,disabled:t.disabled})},t.value))})})}function X0({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:U0(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 Z0({form:e,spec:t,locked:n}){let r=e1({form:e,name:t.name}),i=Q$(e.store,e=>e.submissionAttempts>0),a=r.state.meta.isBlurred||i?d1(r.state.meta):void 0;if(t.render===void 0&&J0.has(t.kind))return(0,X.jsx)(Y0,{spec:t,field:r,locked:n,error:a});let o=t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,X.jsx)(Gq,{label:t.label,description:t.help,icon:t.icon,orientation:o,error:a,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,X.jsx)(q0,{spec:t,field:r,locked:n}):(0,X.jsx)(X0,{spec:t,field:r,locked:n,error:a,render:t.render})})}var Q0=vr(ai(V,I0));function $0({form:e,spec:t,locked:n}){let r=t.when;return Q$(e.store,e=>r===void 0||r(ve(Q0(e.values),()=>({}))))?(0,X.jsx)(Z0,{form:e,spec:t,locked:n}):null}function e2({form:e,section:t,locked:n}){let r=t.fields.map(t=>(0,X.jsx)($0,{form:e,spec:t,locked:n},t.name));return t.title===void 0?r:(0,X.jsx)(Hq,{title:t.title,description:t.description,children:r})}function t2({model:e,names:t,disabled:n=!1}){let r=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(e2,{form:r,section:e,locked:n},e.id??``)):t.map(t=>{let i=e.description.fields.find(e=>e.name===t);return i===void 0?null:(0,X.jsx)($0,{form:r,spec:i,locked:n},t)})}var n2=class{annotation;constructor(e){this.annotation=e}},r2=class{sections;constructor(e){this.sections=e}},i2=`caps/form`,a2=0;function o2(e){a2+=1;let t={[`${i2}:${String(a2)}`]:new n2(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}V.annotate(o2({kind:`secret`})).pipe(qn(`Secret`));var s2=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 c2(e){return Object.values(e??{}).reduce((e,t)=>t instanceof n2?{...e,...t.annotation}:e,{})}function l2(e){return e.reduce((e,t)=>({...e,...c2(t)}),{})}function u2(e){let t=e?.[i2];return t instanceof r2?t.sections:{}}var d2=vr(V);function f2(e){if(ur(e))return Et(d2(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!Yr(e))return null;let t=[];for(let n of e.types){if(Zn(n))continue;let e=f2(n);if(e===null)return null;t.push(...e)}return t}function p2(e){if(pr(e))return{type:`string`,literals:[]};if(Er(e))return{type:`number`,nullable:!1};if(Kr(e))return{type:`boolean`};let t=f2(e);if(t!==null)return{type:`string`,literals:t};if(wr(e)){let[t]=e.rest;if(t===void 0)return null;if(pr(t))return{type:`strings`,literals:[]};let n=f2(t);return n===null?null:{type:`strings`,literals:n}}if(Yr(e)){let t=e.types.filter(e=>!Zn(e)&&!Ir(e)),n=e.types.some(e=>Ir(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=p2(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function m2(e){let t=e.ast;if(!hr(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Fn(e.type),r=l2([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:p2(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:ei(e.type),description:rr(e.type)}}),sections:u2(ni(t))}}function h2(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof Xt)n=!0,t=t.unwrap();else if(t instanceof C)r=!0,t=t.unwrap();else if(t instanceof M)t=t.unwrap();else if(t instanceof l)t=t.in;else return{node:t,optional:n,nullable:r}}function g2(e){if(e instanceof le){let t=e.options.map(e=>g2(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof ee?e.options:e instanceof h?[...e.values]:null;if(t===null)return null;let n=t.map(e=>d2(e));return n.every(Ue)?n.map(e=>e.value):null}function _2(e){let{node:t,nullable:n}=h2(e);if(t instanceof de)return{type:`string`,literals:[]};if(t instanceof O)return{type:`number`,nullable:n};if(t instanceof A)return{type:`boolean`};let r=g2(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof rt){let e=h2(t.element).node;if(e instanceof de)return{type:`strings`,literals:[]};let n=g2(e);return n===null?null:{type:`strings`,literals:n}}return null}function v2(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof Xt||e instanceof C||e instanceof M?e.unwrap():e instanceof l?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>Mt.get(e))}function y2(e){return v2(e).reduce((e,t)=>({...e,...t}),{})}function b2(e){return Object.entries(e.shape)}function x2(e){let t=h2(e).node;if(!(t instanceof ie))throw Error(`A schema form needs a z.object.`);return{fields:b2(t).map(([e,t])=>{let n=l2(v2(t)),r=n.kind===`file`?{type:`files`}:_2(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=y2(t);return{name:e,valueType:r,optional:h2(t).optional,annotation:n,title:i.title,description:i.description}}),sections:u2(y2(e))}}function S2(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??s2(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function C2(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 w2(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 T2(e){let t=e instanceof b?x2(e):m2(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=S2(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??s2(e.name),help:a,kind:n??C2(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=w2(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 E2(e){let t=e instanceof b?e:er(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>D2(e)):D2(n)}}}}function D2(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 O2=`onServer`;function k2(e){return e.state.meta.errorMap.onServer!==void 0}function A2(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[O2]:void 0}}))}function j2(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[O2]:n}}))}function M2(e){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(e.defaultValues),[s,c]=(0,q.useState)(null);v$(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,q.useMemo)(()=>T2(l),[l]),d=(0,q.useMemo)(()=>E2(l),[l]),f=c1({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),k2(e)&&A2(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await E2(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o=await e.onSubmit(a.value,t)??{kind:`saved`};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&&j2(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function N2(e){return{dirty:Q$(e.form.store,e=>!e.isDefaultValue),submitting:Q$(e.form.store,e=>e.isSubmitting),canSubmit:Q$(e.form.store,e=>e.canSubmit)}}function P2({model:e,submitLabel:t=`Save changes`,discardLabel:n,allowClean:r,footer:i,children:a,disabled:o=!1,...s}){let{submitting:c}=N2(e);return(0,X.jsxs)(Bq,{...s,busy:c,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit()},children:[a??(0,X.jsx)(t2,{model:e,disabled:o}),i===void 0?(0,X.jsx)(L2,{model:e,label:t,...n===void 0?{}:{discardLabel:n},...r===void 0?{}:{allowClean:r}}):i]})}function F2({schema:e,defaultValues:t,onSubmit:n,...r}){let i=M2({schema:e,defaultValues:t,onSubmit:n});return(0,X.jsx)(P2,{...r,model:i})}function I2(e){return`model`in e?(0,X.jsx)(P2,{...e}):(0,X.jsx)(F2,{...e})}function L2({model:e,label:t,discardLabel:n,allowClean:r=!1,dirtyLabel:i=`Unsaved changes`,buttonProps:a,...o}){let{dirty:s,submitting:c,canSubmit:l}=N2(e),u=c?null:e.saved&&!s?(0,X.jsx)(xq,{tone:`success`,size:`compact`,label:e.saved}):s?(0,X.jsx)(xq,{tone:`neutral`,size:`compact`,label:i}):null;return(0,X.jsxs)(zq,{...o,error:e.error,status:u,children:[n&&s?(0,X.jsx)(YE,{type:`button`,variant:`ghost`,disabled:c,onClick:e.discard,children:n}):null,(0,X.jsx)(YE,{...a,type:`submit`,loading:c,disabled:c||!l||!s&&!r,children:t})]})}var R2=e=>e,z2=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing burger path: ${t}`);return n},B2={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=mi(e,t,a,{blushMode:`medium-alias`,hideMouth:!0}),s=e.group({parent:r,name:`burger.mouth`,translate:{y:1,z:10}}),c=R2({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=R2({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:z2(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:z2(l,n),stroke:1.5,translate:a}),u[n]=r}return{root:n,variants:{eyes:o.eyes,mouth:u,blush:o.blush}}},expressions:pi,activities:hi,defaultPresentation:{activity:`idle`,expression:`normal`}},V2=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing cat face node: ${t}`);return n},H2=e=>e,U2={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=mi(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=H2({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:V2(c,`normal`),happy:c.happy,sad:V2(c,`sad`),angry:V2(c,`angry`),surprised:c.surprised,dead:c.dead,small:V2(c,`small`),worried:V2(c,`worried`),pout:c.pout,open:c.open};return{root:n,variants:{eyes:a.eyes,mouth:f,blush:a.blush}}},expressions:pi,activities:{...hi,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`}},W2={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=mi(e,t,a,{blushMode:`none`});return{root:n,variants:{eyes:o.eyes,mouth:o.mouth,blush:o.blush}}},expressions:pi,activities:{...hi,error:{geometry:{eyes:`dead`,mouth:`dead`},motion:{target:`root`,rotate:{x:.9},durationMs:600,repeat:`none`},mouseInfluence:.1}},defaultPresentation:{activity:`idle`,expression:`sleepy`}},G2={mushroom:[`cap`,`capSpot`],cat:[`body`,`stripes`],burger:[`topBun`,`bottomBun`]},K2={mushroom:W2,cat:U2,burger:B2};function q2(e){let t=di(fi(K2[e])),n=li.parse(t.data);return{controls:t.controls,expressions:Object.keys(n.expressions),identitySlots:G2[e]}}var J2=new Map;function Y2(e){let t=J2.get(e);return t||(t=q2(e),J2.set(e,t)),t}var X2=Object.freeze({get mushroom(){return Y2(`mushroom`)},get cat(){return Y2(`cat`)},get burger(){return Y2(`burger`)}}),Z2={mushroom:`Shiitake`,cat:`Cat`,burger:`Burger`},Q2=[[`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 $2(e,t){if(t===e.character)return e;let n=X2[e.character].identitySlots,r=X2[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 e4({value:e,disabled:t=!1,onChange:n}){let r=(0,q.useId)(),i=X2[e.character].identitySlots,a=Q2.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)(C0,{"aria-label":`Character`,className:`grid grid-cols-3 gap-sm`,disabled:t,orientation:`horizontal`,value:e.character,onValueChange:t=>{n($2(e,Jg.shape.character.parse(t)))},children:Wg.map(t=>(0,X.jsx)(T0,{id:`${r}-${t}`,value:t,title:Z2[t],description:(0,X.jsx)(qZ,{avatar:$2(e,t),name:Z2[t],size:40})},t))}),(0,X.jsx)(C0,{"aria-label":`Colour`,className:`flex flex-wrap gap-xs`,disabled:t,orientation:`horizontal`,value:a,onValueChange:t=>{let r=Q2.find(([e])=>e===t);r&&n({...e,appearance:{...e.appearance,...Object.fromEntries(i.map((e,t)=>[e,r[t===0?1:2]]))}})},children:Q2.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)(w0,{value:e,"aria-label":e})},e))})]})}var t4=Bn.check(Rn(1,{message:`Give your Agent a name.`}),K(256,{message:`Use at most 256 characters.`})),n4=vr(t4),r4=n_.annotate(o2({label:`Computer`,kind:`select`,options:{new:`New Computer`,none:`No Computer`}})),i4=ri({family:`grove-agent-create-request`,version:1,kinds:{request:{prefix:`request`}}});function a4({create:e,canChooseComputer:t,inputRef:n,error:r,onCancel:i}){let a=(0,q.useRef)(null),[o,s]=(0,q.useState)(()=>Qg(i4.request.generate())),c=M2({schema:(0,q.useMemo)(()=>U({name:t4.annotate(o2({label:`Name`,render:e=>(0,X.jsx)(Zq,{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:r4}),[n]),defaultValues:{name:``,computer:n_.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:i4.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:n_.make(`new`)}}):{kind:`refused`}}}),{submitting:l,canSubmit:u,dirty:d}=N2(c);return(0,X.jsxs)(I2,{model:c,"aria-label":`Create Agent`,footer:(0,X.jsxs)(zq,{divider:!1,error:r,children:[(0,X.jsx)(YE,{type:`button`,variant:`ghost`,disabled:l,onClick:i,children:`Cancel`}),(0,X.jsx)(YE,{type:`submit`,className:`shrink-0 disabled:-outline-offset-1`,variant:`primary`,loading:l,disabled:l||!u||!d,children:`Create Agent`})]}),onSubmitCapture:e=>{F(n4(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)(t2,{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)(e4,{value:o,disabled:l,onChange:e=>{s(e),a.current=null}})]})]})}function o4({open:e,pending:t,error:n,canChooseComputer:r,create:i,onClose:a,returnFocus:o}){let s=(0,q.useRef)(null);return(0,X.jsx)(WG,{open:e,onOpenChange:e=>{!e&&!t&&a()},children:(0,X.jsxs)(YG,{className:`flex flex-col gap-lg`,initialFocus:s,finalFocus:o,keepMounted:!1,children:[(0,X.jsxs)(ZG,{children:[(0,X.jsx)(QG,{children:`New Agent`}),(0,X.jsx)($G,{children:`Agents chat, write and make little games with you.`})]}),(0,X.jsx)(a4,{create:i,canChooseComputer:r,inputRef:s,error:n,onCancel:a})]})})}function s4({open:e,agents:t,defaultAgentId:n,start:r,pending:i,onClose:a,onNewAgent:o,returnFocus:s}){let c=M2({schema:(0,q.useMemo)(()=>U({agentId:V.check(Gn(e=>t.some(t=>t.agentId===e)||`Choose an Agent.`)).annotate(o2({label:`Agent`,kind:`select`,options:Object.fromEntries(t.map(e=>[e.agentId,lQ(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}=N2(c);return(0,X.jsx)(WG,{open:e,onOpenChange:e=>{!e&&!i&&!c.form.state.isSubmitting&&a()},children:(0,X.jsxs)(YG,{className:`flex flex-col gap-lg`,keepMounted:!1,finalFocus:s,children:[(0,X.jsxs)(ZG,{children:[(0,X.jsx)(QG,{children:`New conversation`}),(0,X.jsx)($G,{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)(YE,{onClick:o,children:`New Agent`}):null,(0,X.jsx)(YE,{variant:`ghost`,onClick:a,children:`Cancel`})]}):(0,X.jsx)(I2,{model:c,"aria-label":`New conversation`,footer:(0,X.jsxs)(zq,{divider:!1,error:c.error,children:[(0,X.jsx)(YE,{type:`button`,variant:`ghost`,disabled:l||i,onClick:a,children:`Cancel`}),(0,X.jsx)(YE,{type:`submit`,loading:l||i,disabled:!u||l||i,children:`Start`})]})})]})})}var c4=q.useLayoutEffect;function l4(e,t,n){q.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 u4(e){let t=q.useRef(null);return q.useImperativeHandle(e,()=>t.current,[]),t}function d4(e){return e[e.length-1]}function f4(e){return typeof e==`function`}function p4(e,t){return f4(e)?e(t):e}var m4=Object.prototype.hasOwnProperty,h4=Object.prototype.propertyIsEnumerable;function g4(e){for(let t in e)if(m4.call(e,t))return!0;return!1}var _4=()=>Object.create(null),v4=(e,t)=>y4(e,t,_4);function y4(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=C4(e)&&C4(i);if(!a&&!(x4(e)&&x4(i)))return i;let o=a?e:b4(e);if(!o)return i;let s=a?i:b4(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:m4.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=y4(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function b4(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(!h4.call(e,r))return!1;t.push(r)}return t}function x4(e){if(!S4(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!S4(n)||!n.hasOwnProperty(`isPrototypeOf`))}function S4(e){return Object.prototype.toString.call(e)===`[object Object]`}function C4(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w4(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(!w4(e[r],t[r],n))return!1;return!0}if(x4(e)&&x4(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!w4(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||!w4(e[o],t[o],n)))return!1;return i===a}return!1}var T4=/[\x00-\x1f\x7f"<>`{}]/g;function E4(e){return e.replace(T4,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function D4(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 E4(t)}var O4=[`http:`,`https:`,`mailto:`,`tel:`];function k4(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function A4(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+=D4(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=D4(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function j4(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function M4(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 N4(){throw Error(`Invariant failed`)}function P4(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 F4=4,I4=5;function L4(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 R4(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=L4(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 z4(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=R4(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=V4(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=H4(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=V4(r);e.kind=I4,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=V4(r);e.kind=F4,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)z4(e,t,r,c,i,a,o,s)}function B4(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 V4(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 H4(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 U4(e,t){let n=V4(`/`),r=new Uint16Array(6),i=[];for(let t of e)z4(!1,r,t,1,n,0,i);for(let e of i)e.sort(B4);t.masksTree=n,t.flatCache=P4(1e3)}function W4(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Y4(e,t.masksTree);return t.flatCache.set(e,r),r}function G4(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=V4(`/`),z4(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Y4(r,o,n)}function K4(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=Y4(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Z4(a.route)),t.matchCache.set(r,a),a}function q4(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function J4(e,t=!1,n){let r=V4(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;z4(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&N4(),o[e.id]=e,c!==0&&e.path){let t=q4(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(B4);return{processedTree:{segmentTree:r,singleCache:P4(1e3),matchCache:P4(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Y4(e,t,n=!1){let r=e.split(`/`),i=$4(e,r,t,n);if(!i)return null;let[a]=X4(e,r,i);return{route:i.node.route,rawParams:a}}function X4(e,t,n){let r=Q4(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===F4)break;if(u.kind===I4){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 Z4(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Q4(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function $4(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!d4(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&&!r3(l,n))continue;if(i.parse){if(!n3(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==F4&&r3(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===F4||i.kind===2)&&r3(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&&(n3(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&t3(f,o))return n;r3(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+e3(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+e3(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+e3(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+e3(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 e3(e,t){return 2**(e-t-1)}function t3(e,t){return e===2**(t-1)-1}function n3(e,t,n){let r,i;try{[r,i]=X4(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 r3(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===F4)>(e.node.kind===F4)||t.node.kind===F4==(e.node.kind===F4)&&t.node.depth>e.node.depth)))}function i3(e){return a3(e.filter(e=>e!==void 0).join(`/`))}function a3(e){return e.replace(/\/{2,}/g,`/`)}function o3(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function s3(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function c3(e){return s3(o3(e))}function l3(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function u3(e,t,n){return l3(e,n)===l3(t,n)}function d3({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&&d4(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&&(d4(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=a3(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function f3(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 p3(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>h3(e,n)).join(`/`):h3(r,n):r}function m3({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=R4(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=p3(`_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=p3(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=p3(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function h3(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function g3(e){return e?.isNotFound===!0}function _3(){try{return sessionStorage}catch{return}}var v3=`tsr-scroll-restoration-v1_3`,y3=_3();function b3(){try{return JSON.parse(y3?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function x3(){try{y3?.setItem(v3,JSON.stringify(S3))}catch{}}var S3=b3(),C3=`data-scroll-restoration-id`,w3=e=>e.state.__TSR_key||e.href;function T3(e){let t=e.getAttribute(C3);if(t)return`[${C3}="${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 E3=!1,D3=`window`;function O3(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function k3(e){let t=new Set;for(let n of e){if(n===D3)continue;let e=O3(n);e&&t.add(e)}return t}function A3(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||w3,a=new Set,o=e=>{let t=S3[e]||={};for(let e of a)e===document?t[D3]={scrollX,scrollY}:e.isConnected&&(t[T3(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,E3=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{E3||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())),x3()})),!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=S3[d];if(e){let t=S3[u];for(let n in e){if(n===D3){if(s)continue}else{let e=O3(n);if(!e||s&&o&&(l??=k3(o),l.has(e)))continue}t||=S3[u]={},t[n]??=e[n]}}}E3=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=k3(o));let t=e&&i&&c,s=r.restoring?S3[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===D3){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=O3(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{E3=!1}}))}function j3(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 M3(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function N3(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]=M3(r):Array.isArray(t)?t.push(M3(r)):n[e]=[t,M3(r)]}return n}var P3=/^(?:\s|["[{\d-]|fa|nu|tr)/,F3=L3(JSON.parse),I3=R3(JSON.stringify,JSON.parse);function L3(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=N3(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function R3(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&&!P3.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=j3(e,r);return t?`?${t}`:``}}var z3=`__root__`;function B3(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 V3(e){return e instanceof Response&&!!e.options}function H3(e){return{input:({url:t})=>{for(let n of e)t=W3(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=G3(e[n],t);return t}}}function U3(e){let t=c3(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=i3([`/`,t,e.pathname]),e)}}function W3(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 G3(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 K3(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(()=>{M4(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 q3=`__TSR_index`,J3=`popstate`,Y3=`beforeunload`;function X3(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=t6(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[q3];i=Z3(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[q3];i=Z3(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[q3]!==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 Z3(e,t){t||={};let n=n6();return{...t,key:n,__TSR_key:n,[q3]:e}}function Q3(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??(()=>t6(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=n6();t.history.replaceState({[q3]: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=t6(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[q3]-l.state[q3],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=X3({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(Y3,x,{capture:!0}),t.removeEventListener(J3,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Y3,x,{capture:!0}),t.addEventListener(J3,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 $3(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)=>Z3(t,void 0)),i=()=>t6(t[n],r[n]),a=[];return X3({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 e6(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function t6(e,t){let n=e6(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=n6();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||{[q3]:0,key:a,__TSR_key:a}}}function n6(){return(Math.random()+1).toString(36).substring(7)}function r6(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function i6(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function a6({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function o6(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 s6=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=f3(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Q3()),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=P4(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=K3(this.latestLocation,e),A3(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=c3(a);t&&t!==`/`&&e.push(U3({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:H3(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=J4(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&U4(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:A4(e).path,external:!1,searchStr:o,search:v4(t?.search,i),hash:A4(r.slice(1)).path,state:y4(t?.state,a)}}let o=new URL(i,this.origin),s=W3(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:A4(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:v4(t?.search,c),hash:A4(s.hash.slice(1)).path,state:y4(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)=>d3({base:e,to:t.includes(`//`)?a3(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=K4(s3(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=p6(t.params,s),d=this.routesByPath[s3(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&&g4(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:A4(m3({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,u6(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=d6(m,t,f,e._includeValidateSearch),m=v4(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?p4(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?p4(t.state,n.state):{};v=y4(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=G3(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=j4(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=W4(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=p6(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=s3(this.latestLocation.href)===s3(n.href)&&w4(a6(n.state),a6(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=t6(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=W3(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(k4(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 a8(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(i6(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`)&&r6(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&&k4(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=_6,this.preloadRoute=e=>o8(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=G4(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!w4(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?w4(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??I3,parseSearch:e.parseSearch??F3,protocolAllowlist:e.protocolAllowlist??O4}),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=Z4(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[`**`]:s3(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?f6(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=u6(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof c6||(r=new c6(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:_}=m3({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{m6(i,d)}catch(e){if(x=g3(e)||V3(e)?e:new l6(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:v4(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=r6(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?v4(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?y4(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`?v4(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=d4(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=d4(a),c={...e.search};for(let e of a)try{Object.assign(c,u6(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{m6(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},c6=class extends Error{},l6=class extends Error{};function u6(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new c6(`Async validation not supported`);if(n.issues)throw new c6(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 d6(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=u6(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=p4(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 f6(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 z3}function p6(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,p4(e,t))}function m6(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function h6(e,t){return e.options[t]?.preload?.()}function g6(e,t){let n=h6(e,`component`),r=h6(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function _6(e,t,n){let r=()=>t===!1?void 0:t?h6(e,t):g6(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 v6(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var y6=0,b6=1,x6=2,S6=3,C6=4;function w6(e){return typeof e[0]==`number`}function T6(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 E6(e,t){return e.routesById[t.routeId]}function D6(e,t,n){return V3(e)?[S6,e]:g3(e)?(e.routeId||=n,[x6,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[b6,e]:[y6,e])}function O6(e,t){let n=D6(t,!0,e.id);if(n[0]!==b6)return n;try{e.options.onError?.(n[1])}catch(t){n=D6(t,!0,e.id)}return n}function k6(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[C6]):O6(e,t)}function A6(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function j6(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=E6(e,r);r.abortController=n[0];let u=s[t-1]?.context??e.options.context??{},d={params:r.params,location:o,navigate:A6(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 N6(e,r),[t,k6(i,a,n)]}if(c.aborted||!n[2]())return n[0].abort(),[t,[C6]];let p=r.paramsError??r.searchError;if(p!==void 0)return N6(e,r),[t,k6(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{I6(e,r,`beforeLoad`,n[0]);let a=await T6(m(h),c);if(!n[2]())return n[0].abort(),[t,[C6]];let o=D6(a,!1,i.id);if(o[0]!==y6)return N6(e,r),[t,o];r.context={...f,...a}}catch(a){return N6(e,r),[t,k6(i,a,n)]}finally{g===`success`&&r.status===`pending`&&(r.status=`success`),I6(e,r,!1,n[0])}}i()}function M6(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 N6(e,t){let n=t._flight;t._flight=void 0,M6(e,t,n)?.abort()}function P6(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=M6(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function F6(e){for(let t of e){let e=t._flight;e&&e[2]++}}function I6(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 L6(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:A6(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 R6(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[C6];if(!i)return[y6,void 0];let l=n._flight;I6(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(L6(e,t,n,r,s,a,o))).then(e=>D6(e,!1,r.id),e=>D6(e,!0,r.id)).then(t=>(t[0]!==y6&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===b6&&l[2]?O6(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await T6(l[0],c)}catch(t){if(t!==c)throw t;return N6(e,n),[C6]}finally{I6(e,n,!1,s)}}function z6(e,t,n){t[0]===y6?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==S6&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function B6(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&&N6(e,r)}function V6(e,t){return t[0]===b6||t[0]===x6?{...e,status:t[0]===b6?`error`:`notFound`,error:t[1],_flight:void 0}:e}function H6(e,t,n,r,i,a,o){let s=t[1][n],c=E6(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(L6(e,t,s,c,a[0],i,l))),a[2]()||(a[0].abort(),p=[C6])),!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,N6(e,s),p=k6(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,M6(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?R6(e,t,s,c,h,i,l,a[0]):Promise.resolve([y6,s.loaderData])).then(t=>(y&&(z6(s,t,l),t[0]===y6&&(m&&!a[0].signal.aborted&&B6(e,s,u),s.status=`pending`)),t)),S=T6(Promise.resolve().then(()=>_6(c,void 0,b)),a[0].signal).then(()=>void 0,e=>[n,k6(c,e,a)]).then(e=>x.then(t=>(y&&!e&&t[0]===y6&&s.status===`pending`&&a[2]()&&(s.status=`success`,a[8]?.()),e)));if(r.push([n,x,S]),!_)return x.then(e=>V6(s,e));let C={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let w=R6(e,t,C,c,h,i,!1,a[0]).then(e=>(s.isFetching=!1,z6(C,e,!1),e));return(t[2]??=[]).push([n,w,S,C]),w.then(e=>V6(C,e))}async function U6(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=E6(e,t[n]),a=_6(i,!1);if(a)try{await T6(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function W6(e,t){t[2]&&=(P6(e,t[2].map(e=>e[3])),void 0)}async function G6(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]>=S6)throw[a,t];!i&&t[0]!==y6&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===S6)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function K6(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]===x6?U6(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=S6)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]!==y6&&t[0]<S6&&!(`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)>=S6){let n=c[1];if(n[0]!==S6||n[1].options.reloadDocument||i<20)return W6(e,t),n;l=!0,c=[0,[b6,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===b6?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=E6(e,u);try{await T6(i?Promise.resolve().then(()=>_6(m,a===b6?`errorComponent`:`notFoundComponent`)):Promise.all([_6(m),_6(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return W6(e,t),[C6]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),W6(e,t),P6(e,s),f()):(u.status=`success`,o?.())}return t}async function q6(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=E6(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 T6(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 J6(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 U6(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=H6(e,i,t,l,d,r,c)},p=await j6(e,i,r,s,f,c);if(p&&(r[5]=!0,s=p[0],p[1][0]===x6?(p[2]=await U6(e,i[1],p,r[0].signal),s=Math.min(s,p[2]+1)):p[1][0]>=S6&&(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=K6(e,i,l,r[0],r[1],G6(l,p,i[2]),r[8]);i[2]?.length&&(i[3]=G6(i[2],void 0,void 0,t.then(e=>w6(e)?0:v6(e[1]).length,()=>0))),m=await t}catch(t){throw W6(e,i),t}return w6(m)?m:q6(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function Y6(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=E6(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(()=>Y6(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 X6(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function Z6(e,t){e._committed=t,e.stores.setMatches(t)}function Q6(e,t){P6(e,t[1]),W6(e,t)}function $6(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=v6(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=E6(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,Z6(e,n),P6(e,[...a.values(),...i],[...n,...s.values()]),o6(e,i,n,()=>e._tx===t)}async function e8(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function t8(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function n8(e,t){X6(e,t),t[0].abort(),P6(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 r8(e,t,n,r,i){let a=n.map(e=>({...e}));F6(a);for(let t of r)N6(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await K6(e,o,r,t[0],t[1],i)}catch(t){throw P6(e,a),t}if(w6(s)){P6(e,a),s[0]===S6&&e._tx===t&&e._committed===n&&await t8(e,t,s[1]);return}let c=await q6(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){P6(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),N6(e,n))}Z6(e,c[1]),P6(e,n,c[1])}async function i8(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 J6(e,t[2],t[3],o);if(w6(s)){s[0]===S6&&e._tx===t?(X6(e,t),P6(e,t[3]),t[3]=[],e._tx===t&&await t8(e,t,s[1])):n8(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 T6(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 T6(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){X6(e,t),Q6(e,s);return}let l=t[2],u=i6(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){Q6(e,s);return}let n=await e.startTransition(()=>{X6(e,t),$6(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){W6(e,s);return}d?.length&&r8(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 a8(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 e8(e,n);return}let f=i6(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await e8(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),F6(m)}catch(t){if(u.abort(),!V3(t)){await e8(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await e8(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){P6(e,m),await e8(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>i8(e,_,p,()=>Y6(e,_),t?.sync,g)).catch(()=>{e._tx===_&&n8(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&I6(e,t,!1)}n[0].abort(),P6(e,n[3],_[3],!0)}if(e._tx!==_){P6(e,_[3]),_[3]=[],await e8(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),!r&&!m.some(e=>e._notFound)&&Y6(e,_);try{await _[5]}finally{await e8(e,_)}}async function o8(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}),F6(o)}catch(e){a.abort(),g3(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await J6(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),P6(e,o),a.abort()}if(!w6(t))return t[1];if(s&&t[0]===S6&&!t[1].options.reloadDocument)return o8(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){g3(e)||console.error(e)}}var s8=`Error preloading route! ☝️`,c8=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=z3:this.parentRoute||N4();let r=n?z3:t?.path;r&&r!==`/`&&(r=o3(r));let i=t?.id||r,a=n?z3:i3([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=i3([`/`,a]));let o=a===`__root__`?`/`:i3([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=s3(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=>B3({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.`)}},l8=class extends c8{constructor(e){super(e)}};function u8(e){return(0,X.jsx)(d8,{...e})}var d8=class extends q.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?q.createElement(this.props.errorComponent??f8,{error:e,reset:this.reset}):this.props.children}};function f8({error:e}){let[t,n]=q.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 p8({children:e,fallback:t=null}){return(0,X.jsx)(q.Fragment,{children:m8()?e:t})}function m8(){return q.useSyncExternalStore(h8,()=>!0,()=>!1)}function h8(){return()=>{}}var g8=q.createContext(null);function _8(e){return q.useContext(g8)}var v8=q.createContext(void 0),y8=q.createContext(void 0),b8=(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))(b8||{});function x8({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 S8(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 C8=[],w8=0,{link:T8,unlink:E8,propagate:D8,checkDirty:O8,shallowPropagate:k8}=x8({update(e){return e._update()},notify(e){C8[j8++]=e,e.flags&=~b8.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=b8.Mutable|b8.Dirty,F8(e))}}),A8=0,j8=0,M8,N8=0;function P8(e){try{++N8,e()}finally{--N8||I8()}}function F8(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=E8(n,e)}function I8(){if(!(N8>0)){for(;A8<j8;){let e=C8[A8];C8[A8++]=void 0,e.notify()}A8=0,j8=0}}function L8(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?b8.None:b8.Mutable,get(){return M8!==void 0&&T8(i,M8,w8),i._snapshot},subscribe(e){let t=S8(e),n={current:!1},r=R8(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=M8,o=t?.compare??Object.is;if(n)M8=i,++w8,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=b8.Mutable|b8.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{M8=a,n&&(i.flags&=~b8.RecursedCheck),F8(i)}}};return n?(i.flags=b8.Mutable|b8.Dirty,i.get=function(){let e=i.flags;if(e&b8.Dirty||e&b8.Pending&&O8(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&k8(e)}}else e&b8.Pending&&(i.flags=e&~b8.Pending);return M8!==void 0&&T8(i,M8,w8),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(D8(e),k8(e),I8())}},i}function R8(e){let t=()=>{let t=M8;M8=n,++w8,n.depsTail=void 0,n.flags=b8.Watching|b8.RecursedCheck;try{return e()}finally{M8=t,n.flags&=~b8.RecursedCheck,F8(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:b8.Watching|b8.RecursedCheck,notify(){let e=this.flags;e&b8.Dirty||e&b8.Pending&&O8(this.deps,this)?t():this.flags=b8.Watching},stop(){this.flags=b8.None,this.depsTail=void 0,F8(this)}};return t(),n}var z8=n((e=>{var t=_i();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})),B8=n(((e,t)=>{t.exports=z8()})),V8=n((e=>{var t=_i(),n=B8();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}})),H8=n(((e,t)=>{t.exports=V8()}))();function U8(e,t){return e===t}function W8(e,t,n=U8){let r=(0,q.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,q.useCallback)(()=>e?.get(),[e]);return(0,H8.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var G8={};function K8(e,t){let n=q.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=y4(n.current,i):i}}function q8(e){let t=_8(),n=q.useContext(e.from?y8:v8),r=e.from??n,i=t.stores.getMatchStore(r),a=K8(e,t),o=W8(i,e=>e?a(e):G8);if(o!==G8)return o;(e.shouldThrow??!0)&&N4()}function J8(e){return q8({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Y8(e){let{select:t,...n}=e;return q8({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function X8(e){return q8({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 Z8(e){return q8({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Q8(e){let t=_8();return q.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function $8(e){return q8({...e,select:t=>e.select?e.select(t.context):t.context})}function e5(e){let t=q.useRef(e);return w4(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function t5(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function n5(e,t,n){if(e?.external)return k4(e.href,n)?void 0:e.href;if(!p5(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),k4(t,n)?void 0:t}catch{}}function r5(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!u3(e.pathname,t.pathname,r))return!1}else{let n=l3(e.pathname,r),i=l3(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!w4(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function i5(e,t){let n=_8(),r=u4(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:ee,_fromLocation:te,...F}=e,ne=m8(),re=e5(e.search),ie=e5(e.params),ae=e5(o),I=q.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,re,ie,e.state,e.mask,e.unsafeRelative]),oe=q.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...I}),r=f5(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=n5(r,s,n.protocolAllowlist);return[r?.href,i,r5(e,t,ae,n.basepath,ne,i!==void 0)]},[ae,v,ne,I,n,s]),[se,L,ce]=W8(n.stores.location,oe,t5),le=ce?p4(i,{})??o5:a5,R=ce?a5:p4(a,{})??a5,ue=[b,le.className,R.className].filter(Boolean).join(` `),de=(y||le.style||R.style)&&{...y,...le.style,...R.style},fe=q.useRef(!1),pe=e.reloadDocument||L||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=q.useCallback(()=>{n.preloadRoute(I).catch(e=>{console.warn(e),console.warn(s8)})},[n,I]),ge=q.useCallback(e=>{if(!e){u5(r);return}if(!(e.isIntersecting??pe===`intent`)){e.isIntersecting===!1&&u5(r);return}if(!me){he();return}l5.has(r)||l5.set(r,setTimeout(()=>{l5.delete(r),he()},me))},[he,r,pe,me]);l4(r,ge,pe!==`viewport`),q.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!h5(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...I,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(L)return{...F,ref:r,href:L,...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 ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&u5(r)};return{...F,...le,...R,href:se,ref:r,onClick:d5([x,_e]),onBlur:d5([S,ye]),onFocus:d5([C,ge]),onMouseEnter:d5([w,ge]),onMouseLeave:d5([T,ye]),onTouchStart:d5([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&s5,...ce&&c5}}var a5={},o5={className:`active`},s5={role:`link`,"aria-disabled":!0},c5={"data-status":`active`,"aria-current":`page`},l5=new WeakMap,u5=e=>{clearTimeout(l5.get(e)),l5.delete(e)},d5=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function f5(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function p5(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var m5=q.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=i5(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return q.createElement(`a`,t,o)}return q.createElement(n,a,o)});function h5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var g5=class extends c8{constructor(e){super(e),this.useMatch=e=>q8({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$8({...e,from:this.id}),this.useSearch=e=>Z8({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>X8({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Y8({...e,from:this.id}),this.useLoaderData=e=>J8({...e,from:this.id}),this.useNavigate=()=>Q8({from:this.fullPath}),this.Link=q.forwardRef((e,t)=>(0,X.jsx)(m5,{ref:t,from:this.fullPath,...e}))}};function _5(e){return new g5(e)}var v5=class extends l8{constructor(e){super(e),this.useMatch=e=>q8({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$8({...e,from:this.id}),this.useSearch=e=>Z8({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>X8({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Y8({...e,from:this.id}),this.useLoaderData=e=>J8({...e,from:this.id}),this.useNavigate=()=>Q8({from:this.fullPath}),this.Link=q.forwardRef((e,t)=>(0,X.jsx)(m5,{ref:t,from:this.fullPath,...e}))}};function y5(e){return new v5(e)}function b5(e){let t=_8(),n=`not-found-${W8(t.stores.location,e=>e.pathname)}-${W8(t.stores.status,e=>e)}`;return(0,X.jsx)(u8,{getResetKey:()=>n,onCatch:(t,n)=>{if(g3(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(g3(t))return e.fallback?.(t);throw t},children:e.children})}function x5(){return(0,X.jsx)(`p`,{children:`Not Found`})}function S5(e){return(0,X.jsx)(X.Fragment,{children:e.children})}function C5(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)(x5,{})}function w5(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,X.jsx)(n,{}):null}var T5=(e,t)=>e[0]===t[0]&&e[1]===t[1],E5=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,D5=q.memo(function({routeId:e}){let t=_8();return(0,X.jsx)(O5,{router:t,match:W8(t.stores.getMatchStore(e),e=>e)})});function O5({router:e,match:t}){let n=e.routesById[t.routeId],r=w5(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=E5(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?q.Suspense:S5,l=i?u8:S5,u=o?b5:S5;return(0,X.jsxs)(n.isRoot?n.options.shellComponent??S5:S5,{children:[(0,X.jsx)(v8.Provider,{value:t.routeId,children:(0,X.jsx)(c,{fallback:r,children:(0,X.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(g3(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 q.createElement(o,e)},children:s?(0,X.jsx)(p8,{fallback:r,children:(0,X.jsx)(k5,{match:t})}):(0,X.jsx)(k5,{match:t})})})})}),null]})}var k5=q.memo(function({match:e}){let t=_8(),n=e.routeId,r=t.routesById[n],i=q.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=q.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,X.jsx)(e,{},i):(0,X.jsx)(A5,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!E5(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return w5(t,r)}if(e.status===`notFound`)return C5(t,r,e.error);if(e.status===`error`)throw e.error;return a}),A5=q.memo(function(){let e=_8(),t=q.useContext(v8),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=W8(a,e=>[!!e._notFound,e.error],T5),i=W8(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return C5(e,e.routesById[t],r);if(!i)return null;let a=(0,X.jsx)(D5,{routeId:i});return t===`__root__`?(0,X.jsx)(q.Suspense,{fallback:w5(e),children:a}):a});function j5(e,t){let n=e[1];e.length=0,n?.(t)}function M5({t:e}){let t=_8(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{j5(n,!1),n.push(i,a),e(t),q.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),c4(()=>{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(s3(r.publicHref)!==s3(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`,...i6(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function N5(){let e=_8(),t=e.routesById[z3],n=w5(e,t),r=e.ssr?S5:q.Suspense,i=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(M5,{t:q.useState()[1]}),(0,X.jsx)(r,{fallback:n,children:(0,X.jsx)(P5,{})})]});return e.options.InnerWrap?(0,X.jsx)(e.options.InnerWrap,{children:i}):i}function P5(){let e=_8(),t=e._rendered,n=W8(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;c4(()=>{t[0]===n&&j5(t,!0)},[t,n]);let a=i?(0,X.jsx)(D5,{routeId:i}):null;return(0,X.jsx)(v8.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,X.jsx)(u8,{getResetKey:()=>r,onCatch:void 0,children:a})})}var F5=e=>({createMutableStore:L8,createReadonlyStore:L8,batch:P8}),I5=e=>new L5(e),L5=class extends s6{constructor(e){super(e,F5)}};function R5({router:e,children:t,...n}){g4(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,X.jsx)(g8.Provider,{value:e,children:t});return e.options.Wrap?(0,X.jsx)(e.options.Wrap,{children:r}):r}function z5({router:e,...t}){return(0,X.jsx)(R5,{router:e,...t,children:(0,X.jsx)(N5,{})})}function B5(e){let t=_8({warn:e?.router===void 0}),n=e?.router||t;return W8(n.stores.__store,K8(e,n))}function V5(){return W8(_8().stores.location,e=>e.state.__TSR_index!==0)}var H5=(0,q.createContext)(null),U5=H5.Provider,W5=y5({validateSearch:ot({agent:z().min(1).optional()}),component:()=>null}),G5=_5({getParentRoute:()=>W5,path:`/`}),K5=_5({getParentRoute:()=>W5,path:`/sessions/$agentId/$sessionId`,params:{parse:e=>ot({agentId:z().min(1),sessionId:z().min(1)}).parse(e)}});function q5(){return I5({routeTree:W5.addChildren([G5,K5]),history:$3(),InnerWrap:({children:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,q.useContext)(H5),e]}),defaultPendingMs:0,defaultPendingMinMs:0})}function J5(e,t){let n=B5({router:e,select:e=>e.location.search}),r=q8({from:K5.id,shouldThrow:!1});Yh(t,{canGoBack:V5(),onBack:()=>e.history.canGoBack()?(e.history.back(),!0):!1});let i=(0,q.useCallback)(t=>{e.navigate({to:`.`,search:{agent:t??void 0},replace:!0})},[e]),a=(0,q.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 Y5=Bn.check(Rn(1,{message:`Give your Agent a name.`}),K(256,{message:`Use at most 256 characters.`}));function X5({agentId:e,name:t,rename:n}){let[r,i]=(0,q.useState)(!1),a=M2({schema:(0,q.useMemo)(()=>U({name:Y5.annotate(o2({label:`Agent name`,render:e=>(0,X.jsx)(Zq,{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}=N2(a);return r?(0,X.jsxs)(I2,{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)(t2,{model:a,names:[`name`]})}),(0,X.jsx)(YE,{type:`submit`,size:`sm`,loading:o,disabled:o||!s,children:`Save`}),(0,X.jsx)(p1,{"aria-label":`Cancel rename`,type:`button`,icon:(0,X.jsx)(bK,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!1)}})]}):(0,X.jsx)(p1,{"aria-label":`Rename Agent`,icon:(0,X.jsx)(hK,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!0)}})}function Z5({status:e,approving:t,onApprove:n}){return e?.status===`pending`?(0,X.jsx)(YE,{variant:`outline`,size:`sm`,className:`flex-none`,loading:t,disabled:t,onClick:n,children:`Allow App tools`}):null}function Q5(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()}}]}function $5(e,t){let n=(0,q.useRef)(e);n.current=e;let r=(0,q.useMemo)(()=>Q5(()=>n.current),[]),i=(0,q.useMemo)(()=>bi(),[]);return(0,q.useEffect)(()=>{let e=i.contribute({sourceId:`grove`,namespace:`grove`,commands:r});return()=>{e.dispose()}},[r,i]),(0,q.useEffect)(()=>t?Za(t,r):void 0,[r,t]),i}function e7(e){let t=uo(),n=e?.capabilities.has(y_)===!0||e?.capabilities.has(b_)===!0,r=px(n?e:null),i=e&&!n?{...r,status:`live`}:r,a=lx.of(e,`agents`),o=zs({...fx(e,c_,a,e=>e.list()),enabled:e?.capabilities.has(c_)===!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,q.useEffect)(()=>{c!==`[]`&&i.items.length>0&&l()},[c,i.items,l]),{directory:o,inbox:i,createAgent:Hs({mutationFn:t=>{if(!e)throw Error(`No App connection`);return x_(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:Hs({mutationFn:t=>{if(!e)throw Error(`No App connection`);return f_(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}}),setAgentAvatar:Hs({mutationFn:t=>{if(!e)throw Error(`No App connection`);return h_(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}})}}function t7(e,t){let n=uo(),r=e?.capabilities.has(v_)===!0,i=lx.of(e,`agent-tool-policy`,t??`none`);return{canRead:r,status:zs({...fx(e,v_,i,e=>t===null?Promise.resolve(null):e.status({agentId:t})),enabled:r&&t!==null}),approve:Hs({mutationFn:t=>{if(!e)throw Error(`No App connection`);return e.capabilities.require(v_).approve({agentId:t.agentId,level:`write`,expectedRevision:t.expectedRevision})},onSuccess:e=>{`error`in e||n.setQueryData(i,e)}})}}function n7({agentId:e,name:t,avatar:n,setAvatar:r}){let[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(!1),c=(0,X.jsx)(qZ,{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)(YE,{variant:`ghost`,size:`sm`,"aria-label":`Change avatar`,className:`flex-none p-0`,onClick:()=>{a(n)},children:c}),(0,X.jsx)(WG,{open:i!==null,onOpenChange:e=>{!e&&!o&&a(null)},children:(0,X.jsxs)(YG,{className:`flex flex-col gap-lg`,keepMounted:!1,children:[(0,X.jsxs)(ZG,{children:[(0,X.jsxs)(QG,{children:[t,`'s avatar`]}),(0,X.jsxs)($G,{children:[`Every conversation with `,t,` shows this look.`]})]}),i===null?null:(0,X.jsx)(e4,{value:i,disabled:o,onChange:a}),(0,X.jsxs)(XG,{children:[(0,X.jsx)(YE,{type:`button`,variant:`ghost`,disabled:o,onClick:()=>{a(null)},children:`Cancel`}),(0,X.jsx)(YE,{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 r7=(0,q.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 i7(e,t=!0,n){let r=(0,q.useRef)(e);r.current=e;let i=(0,q.useRef)(null);return(0,q.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,q.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,q.createContext)(null);var a7=(0,q.createContext)(null);(0,q.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,q.useContext)(a7),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,q.useState)(!1);(0,q.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,q.useRef)(null);(0,q.useImperativeHandle)(i,()=>u.current);let d=(0,q.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,q.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 o7={min:224,max:480,initial:320},s7={agentRailOpen:!0,listRailOpen:!0,listWidth:o7.initial},c7=`fungi.grove.layout.v1`,l7=vr(dr(U({agentRailOpen:$r,listRailOpen:$r,listWidth:Pn.pipe(G(rn()))})));function u7(e){return Math.round(Math.min(o7.max,Math.max(o7.min,e)))}function d7(e){try{let t=e?.getItem(c7);if(t==null)return s7;let n=l7(t);return Ue(n)?{...n.value,listWidth:u7(n.value.listWidth)}:s7}catch(e){return console.warn(`Grove could not read its saved rail layout`,e),s7}}function f7(e,t){try{e?.setItem(c7,JSON.stringify(t))}catch(e){console.warn(`Grove could not save its rail layout`,e)}}function p7(){try{return globalThis.localStorage}catch(e){console.warn(`Grove rail layout storage is unavailable`,e);return}}function m7(){let[e,t]=(0,q.useState)(()=>d7(p7()));return(0,q.useEffect)(()=>{f7(p7(),e)},[e]),[e,t]}var h7={2:`h2`,3:`h3`,4:`h4`};function g7(e,t){let{reduced:n}=t,r=e&&!n,i=wC(t,600),[a,o]=(0,q.useState)(r);return(0,q.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var _7=(0,q.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,q.useId)(),p=(0,q.useRef)(null),m=CC(p),h=g7(l===`speech`,m)&&!a,g=h7[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)(YE,{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 v7({description:e,icon:t,label:n,density:r=`regular`,appearance:i=`plain`,iconSize:a=`default`,size:o,trailing:s,...c}){return(0,X.jsxs)(YE,{...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 y7(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=>[cQ(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:cQ(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:cQ(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 b7({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?cQ(o,s):null,[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),y=h||_,[b,x]=(0,q.useState)(0),[S,C]=(0,q.useState)({placements:null,openKey:m,reopened:b}),w=(0,q.useMemo)(()=>iQ(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,q.useEffect)(()=>{!y&&(S.placements!==w||S.openKey!==m||S.reopened!==b)&&C({placements:w,openKey:m,reopened:b})},[y,S,w,m,b]),(0,q.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,q.useMemo)(()=>y7(t,w,d,r,i),[t,w,d,r,i]),E=(0,q.useCallback)(e=>T[e]?.key??e,[T]),D=XK({count:T.length,getScrollElement:()=>e.current,getItemKey:E,estimateSize:e=>T[e]?.kind===`heading`?24:44,measureElement:(e,t,n)=>{let r=HK(e,t,n);return r>0?r:HK(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)(ZS,{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)(v7,{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)(LJ,{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)(xq,{size:`compact`,tone:`accent`,title:t.website.conversation.needsYou.reason}):null,onClick:()=>{p(t.website)},variant:`ghost`}):t.kind===`unavailable`?i?(0,X.jsx)(S7,{agent:i,row:t.session}):null:i?(0,X.jsx)(x7,{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 x7({agent:e,session:t,attention:n,pending:r,selected:i,onSelect:a,onDelete:o,deleting:s}){let c=ZZ(t.state),l=t.state===`errored`,u=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r||c||l?(0,X.jsx)(`span`,{className:`sr-only`,children:r?`Opening`:YZ[t.state]}):null,r||c?(0,X.jsx)(xq,{size:`compact`,title:r?`Opening`:YZ[t.state],motion:t.state===`running`||r?`pulse`:`none`,tone:r?`neutral`:t.state===`needs_you`?`accent`:`info`}):l?(0,X.jsx)(xq,{size:`compact`,title:YZ.errored,glyph:`bang`,tone:`error`}):n?(0,X.jsx)(xq,{size:`compact`,title:`Finished since your last visit`,tone:`neutral`}):null,(0,X.jsx)(`time`,{className:`inbox-row-age min-w-[3ch] text-right text-[0.6875rem] tabular-nums text-(--stipe-fg-muted)`,dateTime:new Date(t.lastActivityAt).toISOString(),children:C7(t.lastActivityAt)})]});return(0,X.jsxs)(`div`,{className:`relative group`,children:[(0,X.jsx)(v7,{"aria-current":i?`page`:void 0,"aria-label":`${t.title||`Untitled session`} — ${lQ(e)}${n?` — Finished since your last visit`:``}${t.ready?` — Ready`:c||l?` — ${YZ[t.state]}`:``}`,"aria-busy":r||void 0,appearance:`plain`,className:`inbox-row${o?` 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:lQ(e),label:t.title||`Untitled session`,onClick:a,trailing:u,variant:`ghost`}),o?(0,X.jsx)(p1,{"aria-label":`Delete conversation ${t.title||`Untitled session`}`,title:`Delete conversation`,icon:(0,X.jsx)(yK,{}),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 S7({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-0 px-2 py-1 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:[lQ(e),` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` This saved conversation could not be read.`]})]}),(0,X.jsx)(xq,{className:`inbox-row-status`,glyph:`bang`,tone:`error`,title:`This saved conversation could not be read`})]})}function C7(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 w7=z().min(1).max(256),T7=Fe().int().nonnegative();jt(`state`,[yt({state:Oe(`agent`),version:T7}),yt({state:Oe(`requested`),version:T7,reason:z().max(4e3),at:Fe().int().nonnegative()}),yt({state:Oe(`person`),version:T7,memberId:w7,memberName:z().min(1).max(128),since:Fe().int().nonnegative()})]);var E7=yt({bindingId:w7,agentId:w7,origins:_e(z().min(1).max(2048)).min(1).max(16),lifecycle:me([`active`,`suspended`])}),D7=yt({sessionId:w7,label:z().max(4096),lastEventAt:Fe().int().nonnegative(),needsYou:yt({at:Fe().int().nonnegative(),reason:z().max(4e3)}).nullable(),held:a(),heldByYou:a(),heldByName:z().min(1).max(128).nullable(),holdVersion:Fe().int().nonnegative()}),O7=yt({bindingId:w7}).extend({sessionId:w7});O7.extend({requestId:z().min(1).max(128),text:z().trim().min(1).max(4e3)});var k7=yt({expectedVersion:T7,confirm:a()});O7.extend(k7.shape),O7.extend({expectedVersion:T7});var A7=yt({websites:_e(E7).max(1e3)}),j7=yt({conversations:_e(D7).max(100)});yt({conversation:D7});var M7=yt({status:Oe(`sent`)}),N7=Qh(`channels.read`,1,Qe(()=>$h({list:tg(eg(A7)),conversations:tg(eg(j7))}))),P7=Qh(`channels.personal.manage`,1,Qe(()=>$h({hold:tg(eg(D7)),release:tg(eg(D7)),dismiss:tg(eg(D7)),reply:tg(eg(M7))})));function F7(e,t){let n=!1,r=async()=>{try{return await t.read()}catch(e){if(!(e instanceof Br)||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`);TL(e,t,r)}),close:()=>{n=!0,i()}}}function I7(e){return class{#e;constructor(t){this.#e=new J_(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 L7(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,p=!0)=>{if(s)return;let m={agentId:u,sessionId:d};if(c(i,m)||(i?.close(),i=null,e.onPending(null),e.onError(null),c(a,m)))return;let h=null,g=!1,_={...m,close:()=>{g||(g=!0,h?.())}};i=_,e.onPending(m),(async()=>{try{let s=await r.openAgent(t.capabilities,{agentId:u});if(!l(_)){await s.close();return}let c=r.createClient({baseUrl:s.baseUrl,eventSource:I7(s.fetch),fetch:s.fetch}),f=c.session(d),m=F7(n,f);if(h=()=>{m.close(),Promise.allSettled([c.close(),s.close()])},await m.ready,p&&e.reportsSelection!==!1&&await t.ui.reportAgentSessionSelection({agentId:u,sessionId:d}),!l(_))return;let g={agentId:u,sessionId:d,session:f},v=o;i=null,a=g,o=_.close,e.onConversation(g),e.onPending(null),v?.()}catch(t){console.error(`Chat Session opening failed`,t),_.close(),l(_)&&(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 R7(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 z7(e,t){(0,q.useSyncExternalStore)(t=>e?.capabilities.subscribe(t)??(()=>void 0),()=>e?.capabilities.version??0);let n=uo(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=e?.capabilities.has(N7)===!0,u=e?.capabilities.has(P7)===!0,d=zs({...fx(e,N7,lx.of(e,`websites`),e=>e.list()),enabled:l}),f=l?d.data?.websites??[]:[],p=Ls({queries:f.map(t=>({...fx(e,N7,lx.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,q.useMemo)(()=>e===null?null:L7({connection:e,queryClient:n,services:t,onPending:()=>void 0,onConversation:o,onError:c}),[e,n,t]);(0,q.useEffect)(()=>()=>{g?.close()},[g]),(0,q.useEffect)(()=>{l||g?.clear()},[l,g]);let _=Hs({mutationFn:t=>{if(e===null)throw Error(`No App connection`);let n=e.capabilities.require(P7);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(lx.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,q.useMemo)(()=>a===null||v===void 0||y===void 0||e===null?null:R7(a.session,{bindingId:v,sessionId:y,canReply:()=>b&&e.capabilities.has(P7),reply:t=>e.capabilities.require(P7).reply(t)}),[e,a,v,y,b]),S=(0,q.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 B7({inbox:e}){let{selected:t,session:n,action:r,canManage:i,openingError:a}=e,[o,s]=(0,q.useState)(null);if((0,q.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)(YE,{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)(WG,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(YG,{children:[(0,X.jsxs)(ZG,{children:[(0,X.jsxs)(QG,{children:[o?.name,` is replying — take over?`]}),(0,X.jsx)($G,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,X.jsxs)(XG,{children:[(0,X.jsx)(eK,{render:(0,X.jsx)(YE,{variant:`outline`}),children:`Cancel`}),(0,X.jsx)(YE,{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)(jZ,{authorOf:ti,disambiguateAuthors:!0,session:n,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${t.bindingId}:${c.sessionId}`)}):null]})}var V7=(0,q.lazy)(async()=>({default:(await ui(()=>import(`./parakeet-conversation-DFuwoFfN.js`),__vite__mapDeps([12,1,2,3,4,5,13]))).ParakeetConversation})),H7={openAgent:w_,createClient:sN},U7=[`agent.list`,`agent.manage`,`agent.read`,`agent.send`],W7=[`agent.read`,`agent.send`,`agent.manage`],G7=ri({family:`grove-session-create-request`,version:1,kinds:{request:{prefix:`request`}}});async function K7(e,t,n,r){let i=await n.openAgent(e.capabilities,{agentId:t}),a=n.createClient({baseUrl:i.baseUrl,eventSource:I7(i.fetch),fetch:i.fetch});try{return await r(a)}finally{Promise.allSettled([a.close(),i.close()])}}function q7({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,q.useEffect)(()=>{let e=sB(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)(q.Suspense,{fallback:(0,X.jsx)(`p`,{className:`p-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Opening conversation…`}),children:(0,X.jsx)(V7,{session:l,draftIdentity:{agentId:e.agentId,sessionId:e.sessionId},connection:n,commands:r,prefill:i,onPrefilled:a,onOpen:s})})})}function J7(e){return qh(e.connection),(0,X.jsx)(Y7,{...e},JSON.stringify(lx.of(e.connection)))}function Y7(e){let t=(0,q.useMemo)(q5,[e.connection]);return(0,X.jsx)(U5,{value:(0,X.jsx)(X7,{...e,router:t}),children:(0,X.jsx)(z5,{router:t})})}function X7({router:e,connection:t,services:n=H7}){let{agentFilterId:r,setFilter:i,selection:a,open:o}=J5(e,t?.window.navigation),s=uo(),c=z7(t,n),{directory:l,inbox:u,createAgent:d,renameAgent:f,setAgentAvatar:p}=e7(t),m=l.data??[],h=l.isPending&&(t?.capabilities.has(c_)??!0),g=l.error?.message??null,_=d.isPending,v=Hs({mutationFn:e=>{if(!t)throw Error(`No App connection`);return K7(t,e.agentId,n,t=>t.createSession(e.requestId))}}),y=Hs({mutationFn:e=>{if(!t)throw Error(`No App connection`);return K7(t,e.agentId,n,t=>t.deleteSession(e.sessionId))},onSuccess:(t,n)=>{a?.agentId===n.agentId&&a.sessionId===n.sessionId&&(_e?.clear(),e.navigate({to:`/`,search:!0,replace:!0})),u.refresh()}}),b=v.isPending?v.variables.agentId:null,[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(!1),D=C?.agentId??null,O=C?.sessionId??null,[k,A]=(0,q.useState)(null),j=(0,q.useRef)(null),[M,N]=m7(),{agentRailOpen:P,listRailOpen:ee,listWidth:te}=M,F=e=>{N(t=>({...t,agentRailOpen:e(t.agentRailOpen)}))},ne=e=>{N(t=>({...t,listRailOpen:e(t.listRailOpen)}))},re=e=>{N(t=>({...t,listWidth:u7(e(t.listWidth))}))},ie=i7({begin:()=>!0,move:e=>{re(t=>t+e)},end:()=>void 0}),[ae,I]=(0,q.useState)(!1),oe=gQ(),se=(0,q.useRef)(null),[L,ce]=(0,q.useState)(null),le=d.error?.message??null,R=d.data,ue=(0,q.useRef)(null),[de,fe]=(0,q.useState)(null),[pe,me]=(0,q.useState)(null),he=qh(t)?.openRequest??null,ge=(0,q.useRef)(null),_e=(0,q.useMemo)(()=>t===null?null:L7({connection:t,queryClient:s,services:n,onPending:S,onConversation:w,onError:fe}),[t,s,n]);(0,q.useEffect)(()=>{if(_e!==null)return()=>{ue.current=null,_e.close()}},[_e]);let[ve,ye]=(0,q.useState)(null),be=(0,q.useMemo)(()=>bi(),[]),xe=(0,q.useMemo)(()=>t===null?null:L7({connection:t,queryClient:s,services:n,onPending:()=>void 0,onConversation:ye,onError:fe,reportsSelection:!1}),[t,s,n]);(0,q.useEffect)(()=>xe===null?void 0:()=>{xe.close()},[xe]);let Se=(0,q.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&&xe?.select(n,r,!1,!1)},[xe]),Ce=(0,q.useRef)(null),we=(0,q.useCallback)((e,t,n=!1,r=!0)=>{_e!==null&&(v.isError&&v.reset(),c.clear(),E(!1),Ce.current={agentId:e,sessionId:t},_e.select(e,t,n,r),o(e,t))},[_e,o,c.clear,v.isError,v.reset]),Te=a?.agentId,Ee=a?.sessionId;(0,q.useEffect)(()=>{let e=Ce.current;Ce.current=null,Te===void 0||Ee===void 0?_e?.clear():(e?.agentId!==Te||e.sessionId!==Ee)&&_e?.select(Te,Ee)},[_e,Te,Ee]);let De=(0,q.useCallback)(e=>{C&&(we(C.agentId,e,!1,!1),u.refresh())},[C,we,u.refresh]);(0,q.useEffect)(()=>{if(!t||he===null){he===null&&(ge.current=null);return}if(he.kind!==`navigate`||ge.current===he.requestId)return;let e=he.params.find(e=>e.key===`agent`)?.value,n=he.params.find(e=>e.key===`session`)?.value;!e||!n||(ge.current=he.requestId,i(e),we(e,n,!0))},[t,he,we,i]);let Oe=(0,q.useCallback)(async e=>{if(!t||_||!t.capabilities.has(l_))return!1;try{let t=await d.mutateAsync(e);return i(t.agentId),ce(t.agentId),A(null),!0}catch{return!1}},[t,_,d.mutateAsync,i]),ke=(0,q.useCallback)(async e=>{if(!t||b!==null)return`Conversation creation is unavailable.`;fe(null);let n=ue.current?.agentId===e?ue.current:{agentId:e,requestId:G7.request.generate()};ue.current=n;try{let t=await v.mutateAsync(n);we(e,t,!1,!1),u.refresh(),A(null),I(!1),ue.current===n&&(ue.current=null);return}catch(e){return console.error(`Grove conversation creation failed`,e),e instanceof Error?e.message:`Couldn't start the conversation.`}},[t,we,b,v.mutateAsync,u.refresh]);(0,q.useEffect)(()=>{if(!(!t||he?.kind!==`compose`)&&ge.current!==he.requestId&&!(!C&&h)&&(ge.current=he.requestId,me({requestId:he.requestId,text:he.text}),!C)){let e=t.capabilities.has(b_)?m.find(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)):void 0;e?ke(e.agentId):A(`agent`)}},[m,t,h,C,he,ke]);let Ae=$5({newConversation:()=>{C&&ke(C.agentId)},openPermissions:()=>{t?.ui.requestAppPermissions({}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})}},t?.commands),je=new Set(c.rows.map(e=>`${e.agentId}:${e.conversation.sessionId}`)),Me=u.items.filter(e=>!(`kind`in e)).filter(e=>!je.has(`${e.agentId}:${e.sessionId}`)),Ne=Ls({queries:(C?[C.session]:[]).map(e=>({...wL(e),enabled:!1}))}).at(0)?.data?.snapshot,Pe=(0,q.useMemo)(()=>C&&Ne?{agentId:C.agentId,sessionId:C.sessionId,state:FP(Ne)}:void 0,[C,Ne]),Fe=(0,q.useMemo)(()=>oQ(m,T&&c.canRead?[]:Me,r,Pe),[r,m,Me,T,c.canRead,Pe]),Ie=(0,q.useMemo)(()=>{let e=new Map;for(let t of Me)`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},[Me]),Le=(0,q.useMemo)(()=>new Map(m.map(e=>[e.agentId,e])),[m]),Re=(0,q.useRef)(null),ze=Me.find(e=>e.agentId===D&&e.sessionId===O),Be=ze!==void 0&&ze.state!==`unavailable`,Ve=ze!==void 0&&ze.state!==`unavailable`?ze.settledAt:void 0;(0,q.useEffect)(()=>{!Be||D===null||O===null||u.visit(D,O).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},[Be,Ve,D,O,u.visit]);let He=u.status===`loading`,Ue=u.status===`error`,We=t?.capabilities.has(l_)??!1,Ge=t?.capabilities.has(b_)??!1,Ke=m.filter(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)),qe=Ke.find(e=>e.agentId===(L??r))??Ke.at(0),Je=Ge&&qe!==void 0,Ye=()=>{t?.ui.requestAppPermissions({agents:U7}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},Xe=R&&(!R.sessionOperations.includes(`agent.read`)||!R.sessionOperations.includes(`agent.send`)||!R.sessionOperations.includes(`agent.manage`))?`Agent created. Allow Grove to read, send messages and manage its sessions to start a conversation.`:pe&&!C&&!Je&&d.isIdle?`Choose an Agent to compose your game idea.`:null,Ze=(0,q.useMemo)(()=>oQ(m,Me,null,Pe),[m,Me,Pe]),Qe=(e,t)=>{I(!1),we(e,t)},$e=()=>{se.current=document.activeElement instanceof HTMLElement?document.activeElement:null,I(!0)};Jh(t,oe?[{kind:`button`,id:`agents`,text:`Agents`,expanded:P,title:P?`Hide Agents`:`Show Agents`},{kind:`button`,id:`conversations`,text:`Conversations`,expanded:ee,title:ee?`Hide conversations`:`Show conversations`}]:[{kind:`button`,id:`agents`,text:`Agents and conversations`,opens:`dialog`,expanded:ae}],e=>{if(k!==null)return!1;if(oe&&e.itemId===`agents`)F(e=>!e);else if(oe&&e.itemId===`conversations`)ne(e=>!e);else if(!oe&&e.itemId===`agents`)ae?I(!1):$e();else return!1;return!0});let et=e=>{i(e),ce(e);let t=[...Ze.active,...Ze.settled].filter(t=>t.agentId===e).sort((e,t)=>t.lastActivityAt-e.lastActivityAt).at(0);t&&Qe(e,t.sessionId)},tt={"--grove-list-width":`${String(te)}px`},nt=C?Le.get(C.agentId):void 0,rt=ve?Le.get(ve.agentId):void 0,it=t?.capabilities.has(d_)??!1,at=t?.capabilities.has(m_)??!1,ot=t7(t,nt?.agentId??null),st=ze!==void 0&&ze.state!==`unavailable`?ze.title||`Untitled conversation`:`Conversation`,ct=r===null?void 0:Le.get(r),lt=Fe.active.length+Fe.settled.length,z=(0,q.useCallback)(async(e,n)=>{if(!t)return!1;try{return await f.mutateAsync({agentId:e,name:n}),!0}catch{return!1}},[t,f.mutateAsync]),ut=(0,q.useCallback)(async(e,n)=>{if(!t)return!1;try{return await p.mutateAsync({agentId:e,avatar:n}),!0}catch{return!1}},[t,p.mutateAsync]),dt=(0,q.useCallback)(()=>{let e=ot.status.data;!nt||e==null||ot.approve.mutate({agentId:nt.agentId,expectedRevision:e.revision})},[nt,ot.status.data,ot.approve]),ft=(0,q.useCallback)(e=>{!t||_||b!==null||e===`agent`&&!We||(k===null&&(j.current=ae?se.current:document.activeElement instanceof HTMLElement?document.activeElement:null),I(!1),e===`session`&&ce(nt?.agentId??r??Ke.at(0)?.agentId??null),A(e))},[t,_,b,We,k,ae,nt?.agentId,r,Ke]);(0,q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||!e.ctrlKey||e.altKey||e.metaKey||e.key.toLowerCase()!==`n`||!t||e.shiftKey&&!We||(e.preventDefault(),ft(e.shiftKey?`agent`:`session`))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[t,We,ft]);let pt=v.isError?v.variables:null,mt=pt&&k!==`session`?(0,X.jsx)(JS,{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)(YE,{variant:`outline`,onClick:()=>void ke(pt.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)(o4,{open:k===`agent`,pending:_,error:le,canChooseComputer:t.capabilities.has(yQ),create:Oe,onClose:()=>{A(null)},returnFocus:j}),k===`session`?(0,X.jsx)(s4,{open:!0,agents:Ge?Ke:[],defaultAgentId:qe?.agentId??null,start:ke,pending:b!==null,onClose:()=>{A(null)},onNewAgent:We?()=>{A(`agent`)}:void 0,returnFocus:j}):null]}):null,(0,X.jsxs)(_Q,{open:ae,onOpenChange:I,returnFocus:se,children:[(0,X.jsx)(dQ,{open:P,agents:m,agentActivity:Ie,agentFilterId:r,websitesSelected:T,websitesVisible:c.canRead,canCreate:t!==null&&We,createOpen:k===`agent`,onAll:()=>{i(null),E(!1)},onWebsites:()=>{i(null),E(!0)},onAgent:e=>{E(!1),et(e)},onCreate:()=>{ft(`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 ${ee?`flex`:`flex min-[900px]:hidden`}`,style:tt,"aria-label":`Conversations`,children:[oe?(0,X.jsx)(r7,{"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 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100`,orientation:`vertical`,variant:`notch`,value:te,min:o7.min,max:o7.max,onValueChange:e=>{re(()=>e)},onDoubleClick:()=>{re(()=>o7.initial)},...ie}):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:[(0,X.jsx)(ZS,{className:`min-w-0 flex-1 truncate`,children:T&&c.canRead?`Websites`:ct?lQ(ct):`All Agents`}),t&&(Je||We)?(0,X.jsx)(p1,{"aria-label":`New conversation`,"aria-haspopup":`dialog`,icon:(0,X.jsx)(vK,{}),iconSize:`sm`,size:`sm`,onClick:()=>{ft(`session`)}}):null]}),Xe?(0,X.jsx)(JS,{tone:`info`,title:Xe,action:(0,X.jsx)(YE,{variant:`ghost`,onClick:()=>{t?.ui.requestAppPermissions({agents:W7}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},children:`Allow conversation access`})}):null,t&&m.length>0&&!Je&&!We?(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)(tC,{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)(YE,{size:`sm`,onClick:Ye,children:`Allow Agent access`})]}):null,y.error?(0,X.jsx)(JS,{tone:`error`,title:y.error.message}):null,g?(0,X.jsx)(JS,{className:`inbox-error`,tone:`error`,title:g,action:(0,X.jsx)(YE,{variant:`ghost`,size:`sm`,onClick:()=>{l.refetch()},children:`Try again`})}):null,Ue?(0,X.jsx)(JS,{className:`inbox-error`,tone:`error`,title:`Conversations are unavailable.`,action:(0,X.jsx)(YE,{variant:`ghost`,size:`sm`,onClick:()=>{u.refresh()},children:`Retry conversations`})}):null,(0,X.jsx)(Ij,{ref:Re,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)(b7,{viewport:Re,view:Fe,agents:Le,loading:He||c.loading,failed:!!g||Ue||c.failed,pendingSelection:x,selectedAgentId:D,selectedSessionId:O,onSelect:Qe,onDelete:Ge?(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=>{_e?.clear(),I(!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.jsxs)(`header`,{className:`grove-head flex h-10 flex-none items-center gap-2 border-b border-base-300 px-2 text-xs`,children:[oe||!c.selected&&!nt?null:(0,X.jsx)(YE,{variant:`outline`,size:`sm`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":ae,onClick:$e,children:`Agents and conversations`}),c.selected?(0,X.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,X.jsx)(LJ,{name:`internet`,size:14}),(0,X.jsx)(ZS,{className:`min-w-0 truncate`,children:c.selected.siteLabel}),(0,X.jsx)(lK,{"aria-hidden":`true`,size:12}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:c.selected.conversation.label||`Website visitor`})]}):nt?(0,X.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,X.jsx)(n7,{agentId:nt.agentId,name:lQ(nt),avatar:nt.avatar,...at?{setAvatar:ut}:{}},`avatar-${nt.agentId}`),(0,X.jsx)(ZS,{className:`flex-none`,children:lQ(nt)}),it?(0,X.jsx)(X5,{agentId:nt.agentId,name:nt.name,rename:z},nt.agentId):null,ot.canRead?(0,X.jsx)(Z5,{status:ot.status.data,approving:ot.approve.isPending,onApprove:dt}):null,(0,X.jsx)(lK,{"aria-hidden":`true`,className:`flex-none text-(--stipe-fg-muted)`,size:12}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-(--stipe-fg-muted)`,children:st})]}):null]}),(0,X.jsx)(fQ,{app:t}),de?(0,X.jsx)(JS,{className:`inbox-error m-2`,tone:`error`,title:de}):null,C||c.selected?mt:null,c.selected?(0,X.jsx)(B7,{inbox:c}):C?(0,X.jsx)(q7,{open:C,connection:t,commands:Ae,renderConversation:n.renderConversation,composeDraft:pe,onPrefilled:()=>{me(null)},onForked:De,onOpen:Se}):!t||h?null:m.length===0&&!g?(0,X.jsx)(_7,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`speech`,thinking:_,renderVisual:({speaking:e,thinking:t})=>(0,X.jsx)(JZ,{className:`h-full w-full`,state:{activity:t?`thinking`:e?`speaking`:`idle`,expression:`normal`}}),title:We?`No one's here yet.`:`Welcome to Grove`,description:We?`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:We?(0,X.jsx)(YE,{onClick:()=>{ft(`agent`)},children:`Name your first Agent`}):(0,X.jsx)(YE,{onClick:Ye,children:`Allow Agent access`})}):mt??(0,X.jsx)(_7,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`panel`,title:lt>0?`Pick up a conversation`:qe?`Say hello to ${lQ(qe)}`:`No conversations yet`,description:lt>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:[oe||lt===0?null:(0,X.jsx)(YE,{variant:`outline`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":ae,onClick:$e,children:`Agents and conversations`}),Je?(0,X.jsx)(YE,{variant:`outline`,loading:b===qe.agentId,disabled:b!==null,onClick:()=>void ke(qe.agentId),children:lt>0?`Ask ${lQ(qe)} something`:`Start a conversation`}):null]})})]}),ve===null?null:(0,X.jsxs)(`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.jsxs)(`header`,{className:`grove-head flex h-10 flex-none items-center gap-2 border-b border-base-300 px-2 text-xs`,children:[(0,X.jsx)(ZS,{className:`min-w-0 flex-1 truncate`,children:rt===void 0?ve.agentId:lQ(rt)}),(0,X.jsx)(p1,{"aria-label":`Close beside conversation`,icon:(0,X.jsx)(bK,{}),iconSize:`sm`,size:`sm`,onClick:()=>{xe?.clear()}})]}),(0,X.jsx)(q7,{open:ve,connection:t,commands:be,renderConversation:n.renderConversation,composeDraft:null,onPrefilled:()=>void 0,onForked:e=>{xe?.select(ve.agentId,e,!1,!1)},onOpen:Se,label:`Beside conversation`})]})]})}var Z7=document.getElementById(`inbox-root`);if(!Z7)throw Error(`Inbox root is missing`);Wh(Z7,{name:`Grove`,queryClient:dx()},({app:e})=>(0,q.createElement)(J7,{connection:e}));export{lx as $,Yw as A,vw as B,XT as C,_T as D,wT as E,xw as F,BC as G,VC as H,Cw as I,nC as J,PC as K,Tw as L,ww as M,Ew as N,dT as O,Sw as P,Q,Qw as R,YT as S,DT as T,qC as U,hw as V,dw as W,eC as X,rC as Y,tC as Z,SN as _,Zq as a,co as at,pE as b,uK as c,yz as d,eg as et,DR as f,ON as g,hF as h,IX as i,zs as it,$w as j,tT as k,sK as l,yR as m,B2 as n,tg as nt,Pq as o,_i as ot,_R as p,$S as q,wZ as r,Qh as rt,Nq as s,U2 as t,$h as tt,kz as u,YE as v,WT as w,QT as x,DE as y,Xw as z};