@deslop/auth 0.1.1249 → 0.1.1250

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.
@@ -0,0 +1,2 @@
1
+ import{n as e,t}from"./rolldown-runtime-WkwZ5CU-.js";import{$ as n,$i as r,$n as i,$r as a,$t as o,A as s,Ai as c,An as l,Ar as u,At as d,Ba as f,Bi as p,Bn as m,Br as h,Bt as g,C as _,Ca as v,Ci as y,Cn as b,Cr as x,Ct as S,D as C,Di as w,Dn as T,Dr as ee,Dt as te,E as ne,Ei as E,En as re,Er as ie,Et as ae,Fa as oe,Fi as se,Fn as ce,Fr as D,Ft as le,G as ue,Ga as O,Gi as de,Gn as fe,Gr as pe,Gt as me,H as he,Ha as k,Hi as ge,Hn as _e,Hr as ve,Ht as A,I as ye,Ia as be,Ii as xe,In as Se,Ir as j,It as Ce,J as we,Ja as Te,Ji as M,Jn as Ee,Jr as De,Jt as Oe,K as ke,Ka as Ae,Ki as je,Kn as Me,Kr as Ne,Kt as Pe,L as Fe,La as Ie,Li as Le,Ln as Re,Lr as ze,Lt as Be,Mi as Ve,Mn as He,Mr as Ue,Mt as We,N as Ge,Ni as Ke,Nn as qe,Nr as Je,Nt as Ye,O as Xe,Oa as Ze,Oi as Qe,On as $e,Ot as N,P as et,Pa as tt,Pi as nt,Pn as rt,Pr as P,Pt as it,Q as at,Qa as ot,Qi as st,Qn as ct,Qr as lt,Qt as ut,R as dt,Ra as ft,Ri as pt,Rn as mt,Rr as ht,Rt as gt,S as _t,Si as vt,Sn as yt,Sr as bt,St as xt,T as St,Ta as Ct,Ti as wt,Tn as Tt,Tr as Et,Tt as Dt,U as Ot,Ua as kt,Ui as At,Un as jt,Ur as Mt,Ut as Nt,V as Pt,Va as Ft,Vi as It,Vn as Lt,Vr as Rt,Vt as zt,W as Bt,Wa as Vt,Wi as Ht,Wn as Ut,Wr as F,Wt,X as Gt,Xa as Kt,Xi as qt,Xn as Jt,Xr as Yt,Xt,Y as Zt,Ya as Qt,Yi as $t,Yn as I,Yr as en,Yt as tn,Za as nn,Zi as rn,Zn as an,Zr as on,Zt as sn,_i as cn,_n as ln,_r as un,_t as dn,a as fn,aa as pn,ai as mn,an as hn,ao as L,ar as gn,b as _n,bi as vn,bn as yn,br as bn,bt as xn,c as Sn,ci as Cn,cn as wn,co as Tn,cr as En,ct as Dn,d as On,da as kn,di as An,dn as jn,do as Mn,dr as Nn,dt as Pn,ea as Fn,en as In,er as Ln,et as Rn,f as zn,fa as Bn,fn as Vn,fr as Hn,ft as Un,g as Wn,ga as Gn,gi as Kn,gn as qn,gr as Jn,gt as Yn,h as Xn,hi as Zn,hn as Qn,hr as $n,ht as er,i as tr,ia as nr,ii as rr,in as ir,io as ar,ir as or,it as sr,ji as cr,jn as lr,jr as ur,jt as dr,k as fr,ki as pr,kn as mr,kr as hr,kt as R,l as gr,la as _r,li as vr,ln as yr,lo as br,lr as z,lt as xr,m as Sr,ma as Cr,mi as wr,mn as Tr,mr as Er,mt as Dr,n as Or,ni as kr,nn as Ar,nr as jr,nt as Mr,o as Nr,oa as Pr,on as Fr,oo as Ir,or as Lr,ot as Rr,p as zr,pa as Br,pn as Vr,pr as Hr,pt as Ur,q as Wr,qa as Gr,qi as Kr,qn as qr,qr as Jr,qt as B,r as Yr,ra as Xr,ri as Zr,rn as Qr,ro as $r,rr as ei,rt as ti,s as ni,sa as ri,si as ii,sn as ai,sr as V,t as oi,ta as si,ti as ci,tn as li,tr as ui,tt as di,u as fi,ui as pi,un as mi,uo as H,ur as hi,ut as gi,v as _i,vi,vn as yi,vr as bi,vt as xi,w as Si,wa as Ci,wi,wn as Ti,wr as Ei,wt as Di,x as Oi,xa as ki,xi as Ai,xn as ji,xr as Mi,xt as Ni,y as Pi,yi as Fi,yn as Ii,yr as U,yt as Li,za as Ri,zi,zn as Bi,zr as Vi,zt as Hi}from"./effect-Cym5PIVz.js";import{a as Ui,i as Wi,n as Gi,o as Ki,r as qi}from"./react-COyt-gOi.js";var W=e(Ki(),1),Ji=W.use,Yi=W.useLayoutEffect,Xi=W.createContext(null);function Zi(e){return W.useContext(Xi)}function Qi(e){let t=Zi();return W.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function $i(e){let t=Zi(),n=Qi(),r=W.useRef(null);return Yi(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function ea(e){return e[e.length-1]}function ta(e,t){return typeof e==`function`?e(t):e}var na=Object.prototype.hasOwnProperty;function ra(e){for(let t in e)if(na.call(e,t))return!0;return!1}var ia=()=>Object.create(null),aa=(e,t)=>oa(e,t,!0);function oa(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(sa(e)&&sa(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&ea(a)!==`${o-1}`||c&&ea(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?oa(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?oa(d,o,n,r):o,i&&=u===d&&(a[l]===f||na.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?ia():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?oa(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function sa(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function ca(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!ca(a,o,n,r))return!1}return!0}if(sa(e)&&sa(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!ca(e[i],t[i],n,r))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++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!ca(e[a],t[a],n,r)))return!1;return i===0}return!1}function la(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var ua=/[\x00-\x1f\x7f"<>`{}]/g;function da(e){return e.replace(ua,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function fa(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 da(t)}var pa=[`http:`,`https:`,`mailto:`,`tel:`];function ma(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var ha=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function ga(e,t){if(!e)return!1;if(ha.test(e))return!0;let n=ma(e);return n?!t.has(n):!1}var _a={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},va=/[&><\u2028\u2029]/g;function ya(e){return e.replace(va,e=>_a[e])}function ba(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=fa(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=fa(r?e.slice(r):e)}return t}function xa(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Sa(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 Ca(){throw Error(`Invariant failed`)}function wa(e){return e.replace(/\/{2,}/g,`/`)}function Ta(e){return e===`/`?e:e.replace(/^\/+/,``)}function Ea(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Da(e){return Ea(Ta(e))}function Oa(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ka(e,t,n=`never`,r){if(t.includes(`//`)&&(t=wa(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=wa(e)),o=e.split(`/`);o.length>1&&ea(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(ea(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?wa(s):s)||`/`;return a&&r&&r.set(a,c),c}function Aa(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function ja(e){return e==null||e===``}function Ma(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Na(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&ja(f)){if(c===`/`&&!d)continue;f=``}o+=c+Ma(s,f,r)+(d||``)}}return o+a||`/`}function Pa(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function Fa(e){return e?.isNotFound===!0}var Ia=`__root__`;function La(e){e.statusCode=e.statusCode||e.code||307;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 Ra(e){return e instanceof Response&&!!e.options}function za(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var Ba=4,Va=5;function Ha(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function Ua(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function Wa(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=ea(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=Ua(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=Ka(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.slice(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=Ka(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.slice(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Ka(r,Va);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=Ka(r,Ba);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function Ga(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 Ka(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function qa(e,t){let n=Ka(),r=[];function i(e,t,n,a){let[o,s,c]=Wa(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Ga);t.masksTree=n,t.flatCache=za(1e3)}function Ja(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Qa(e,t.masksTree);return t.flatCache.set(e,r),r}function Ya(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ka(),Wa(t,{from:e},1,o),i.singleCache.set(a,o)),Qa(r,o,n)}function Xa(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=Qa(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=eo(a.route)),t.matchCache.set(r,a),a}function Za(e,t=!1){let n=Ka(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&Ca(),i[e.id]=e,o!==0&&e.path){let t=Ea(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Wa(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Ga);return{processedTree:{segmentTree:n,singleCache:za(1e3),matchCache:za(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Qa(e,t,n=!1){let r=e.split(`/`),i=no(e,r,t,n);if(!i)return null;let[a]=$a(e,r,i);return{route:i.node.route,rawParams:a}}function $a(e,t,n){let r=to(n.node),i=n.node.data&&Ha(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===Ba)break;if(u.kind===Va){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function eo(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function to(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function no(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ea(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&&!oo(l,n))continue;if(i.parse){if(!ao(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Ba&&oo(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Ba||i.kind===2)&&oo(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&&(ao(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&io(f,o))return n;oo(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(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+ro(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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+ro(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+ro(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+ro(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 ro(e,t){return 2**(e-t-1)}function io(e,t){return e===2**(t-1)-1}function ao(e,t,n){let r,i;try{[r,i]=$a(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 oo(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===Ba)>(e.node.kind===Ba)||t.node.kind===Ba==(e.node.kind===Ba)&&t.node.depth>e.node.depth)))}function so(){try{return sessionStorage}catch{return}}var co=`tsr-scroll-restoration-v1_3`,lo=so();function uo(){try{return JSON.parse(lo?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var fo=uo(),po=`data-scroll-restoration-id`,mo=e=>e.state.__TSR_key||e.href;function ho(e){let t=e.getAttribute(po);if(t)return`[${po}="${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 go=!1,_o=`window`;function vo(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function yo(e){let t=new Set;for(let n of e){if(n===_o)continue;let e=vo(n);e&&t.add(e)}return t}function bo(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||mo,a=new Set,o=e=>{let t=fo[e]||={};for(let e of a)e===document?t[_o]={scrollX,scrollY}:e.isConnected&&(t[ho(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,go=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{go||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{lo?.setItem(co,JSON.stringify(fo))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),r.r||(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!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.e&&d&&d!==u){let e=fo[d];if(e){let t=fo[u];for(let n in e){if(n===_o){if(s)continue}else{let e=vo(n);if(!e||s&&o&&(l??=yo(o),l.has(e)))continue}t||=fo[u]={},t[n]??=e[n]}}}go=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=yo(o));let t=e&&i&&c,s=r.e?fo[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===_o){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=vo(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{go=!1}}))}function xo(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function So(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Co(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]=So(r):Array.isArray(t)?t.push(So(r)):n[e]=[t,So(r)]}return n}var wo=/^(?:\s|["[{\d-]|fa|nu|tr)/,To=Do(JSON.parse),Eo=Oo(JSON.stringify,JSON.parse);function Do(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=Co(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!wo.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Oo(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&&!wo.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=xo(e,r);return t?`?${t}`:``}}function ko(e,t,n){let r=Da(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=wa(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Ao(n,s.input({url:e})),output:({url:e})=>s.output({url:jo(n,e)})}:s}function Ao(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 jo(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 Mo(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(()=>{Sa(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 No=`__TSR_index`,Po=`popstate`,Fo=`beforeunload`,Io=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function Lo(e){let t=Io.exec(e);return t?`/`+e.slice(t[0].length):e}function Ro(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
2
+ \r`.includes(e)?``:encodeURIComponent(e))),Lo(e)}function zo(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 n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=Ho(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};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[No];i=Bo(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[No];i=Bo(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,n?.ignoreBlocker??!1),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[No]!==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,_getBlockers:()=>e.getBlockers?.()??[]}}function Bo(e,t){let n=Uo();return{...t,key:n,__TSR_key:n,[No]:e}}function Vo(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=t=>Ro(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Ho(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Uo();t.history.replaceState({[No]: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=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=Ho(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[No]-l.state[No],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 r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),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||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=zo({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,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Fo,x,{capture:!0}),t.removeEventListener(Po,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Fo,x,{capture:!0}),t.addEventListener(Po,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 Ho(e,t){let n=Ro(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Uo();t={[No]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function Uo(){return(Math.random()+1).toString(36).slice(7)}function Wo(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Go(e){return e.pathname+e.search+e.hash}function Ko(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function qo(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Jo({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Yo(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Xo(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var Zo=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Vo()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&Da(n)?ko(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Mo(this.latestLocation,e),bo(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Za(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&qa(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:za(1e3)}},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},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:ba(e),external:!1,searchStr:o,search:aa(t?.search,i),hash:ba(r.slice(1)),state:oa(t?.state,a)}}let o=Ao(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:ba(Lo(o.pathname)),external:!!this.rewrite&&Wo(o,this.origin),searchStr:c,search:aa(t?.search,s),hash:ba(o.hash.slice(1)),state:oa(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},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=Xa(Ea(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=Ho(n.href,{});n={...n,to:Ao(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,c=ka(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[Ea(c)],u=c.includes(`$`),d;if(l)d=l._branch??=eo(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??Wa(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=ns(n.params,e),!ra(p))break;p===e&&(p=Object.assign(ia(),p));try{Object.assign(p,t(p))}catch{}}}p??=ns(n.params,rs(n.params,f)?o()[3]:is);let m=e.leaveParams?c:Lo(ba(f?Na(c,f,p,this.pathParamsDecoder):c)),h=as(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,ts(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?os(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||is,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:is,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=jo(this.rewrite,e);C=Go(e),Wo(n,t)?(w=n.href,T=!0):w=Lo(Go(n))}else C=xa(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Ja(r.pathname,this.processedTree);if(t){let i=Object.assign(ia(),t.rawParams),{from:a,params:o,...s}=t.route,c=ns(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return Qo(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Ea(this.latestLocation.href)===Ea(n.href)&&ca(Jo(n.state),Jo(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.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={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?ma(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return Qo(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await ec(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(qo(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,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Ko(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(ha.test(n)||(r=ma(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:Wo(e,this.origin)||(n=Go(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),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=ds,this.preloadRoute=e=>tc(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?ka(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):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=Ya(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ca(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?ca(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Aa(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Eo,parseSearch:e.parseSearch??To,protocolAllowlist:e.protocolAllowlist??pa}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=Wa(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:Ea(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?ss(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=ts(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof $o||(r=new $o(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 g=ia(),_=i._interpolation?Na(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{cs(i,d)}catch(e){if(x=Fa(e)||Ra(e)?e:new es(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:aa(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Ko(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?aa(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?oa(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`?aa(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=ea(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=ea(a),c={...e.search};for(let e of a)try{Object.assign(c,ts(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=o;for(let t of a)try{cs(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Qo(e,t,{replace:n,ignoreBlocker:r}){if(!ga(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var $o=class extends Error{},es=class extends Error{};function ts(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new $o(`Async validation not supported`);if(n.issues)throw new $o(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 ns(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function rs(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!na.call(e,t[1]))}var is=Object.freeze({});function as(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=ts(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function os(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=ta(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function ss(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 Ia}function cs(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function ls(e,t){return e.options[t]?.preload?.()}function us(e,t){let n=ls(e,`component`),r=ls(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function ds(e,t,n){let r=()=>t===!1?void 0:t?ls(e,t):us(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 fs(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function ps(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}function ms(e){let t=e.length;for(let n=0;n<t;n++){let r=e[n];if(r._assetEnd!==void 0)t=Math.min(t,Math.max(n+1,r._assetEnd));else if(r.status!==`success`||r._notFound){t=n+1;break}}return t<e.length?e.slice(0,t):e}var hs=0,gs=1,_s=2,vs=3,ys=[4];function bs(e){return typeof e[0]==`number`}function xs(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).then(()=>t.removeEventListener(`abort`,i))})}function Ss(e,t){return e.routesById[t.routeId]}function Cs(e,t,n){return Ra(e)?[vs,e]:Fa(e)?(e.routeId||=n,[_s,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[gs,e]):[hs,e]}function ws(e,t){let n=Cs(t,!0,e.id);if(n[0]!==gs)return n;try{e.options.onError?.(n[1])}catch(t){n=Cs(t,!0,e.id)}return n}function Ts(e,t,n,r,i){return i[0].signal.aborted?ys:Vs(e,t,n,ws(n,r),i)}async function Es(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Ss(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Os(e,r),[i,Ts(e,t,u,a,n)]}if(c.aborted)return[i,ys];let p=r.paramsError??r.searchError;if(p!==void 0)return Os(e,r),[i,Ts(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{js(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?xs(a,c):a);if(c.aborted)return[i,ys];let s=Vs(e,t,u,Cs(o,!1,u.id),n);if(s[0]!==hs)return Os(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Os(e,r),[i,Ts(e,t,u,a,n)]}finally{r.status=h,js(e,r,!1,n[0])}}i()}function Ds(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 Os(e,t){let n=t._flight;t._flight=void 0,Ds(e,t,n)?.abort()}function ks(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=Ds(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function As(e){for(let t of e){let e=t._flight;e&&e[2]++}}function js(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 Ms(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation: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 Ns(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return ys;if(!i)return[hs,void 0];let l=n._flight;js(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Ms(e,t,n,r,s,a,!!o[3]))).then(e=>Cs(e,!1,r.id),e=>Cs(e,!0,r.id)).then(t=>(t[0]!==hs&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===gs&&l[2]?ws(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Vs(e,t,r,await xs(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Os(e,n),ys}finally{js(e,n,!1,s)}}function Ps(e,t,n){t[0]!==vs&&(e.status=`success`,e.error=void 0,t[0]===hs?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Fs(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&&Os(e,r)}function Is(e,t){return t[0]===gs||t[0]===_s?{...e,status:t[0]===gs?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Ls(e,t,n,r,i,a,o){let s=t[1][n],c=Ss(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Ms(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=ys)),!p){if(s.status!==`success`)f=!0;else{let t=l||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[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Os(e,s),p=Ts(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Ds(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Ns(e,t,s,c,g,i,a).then(t=>(Ps(s,t,l),t[0]===hs&&(m&&!a[0].signal.aborted&&Fs(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[hs,s.loaderData]),T=(async()=>{try{let e=ds(c,void 0,C);e&&await xs(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Ts(e,t,c,r,a)]}let r=await w;x&&r[0]===hs&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Is(s,e));let ee={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let te=Ns(e,t,ee,c,g,i,a).then(e=>(s.isFetching=!1,Ps(ee,e,!1),e));return(t[2]??=[]).push([n,te,T,ee]),te.then(e=>Is(ee,e))}async function Rs(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=Ss(e,t[n]);try{let e=ds(i,!1);e&&await xs(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function zs(e,t){t[2]&&=(ks(e,t[2].map(e=>e[3])),void 0)}async function Bs(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]>=vs)throw[a,t];!i&&t[0]!==hs&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===vs)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Vs(e,t,n,r,i,a){for(;r[0]===vs;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[vs,t]:[vs,t,a]}return[vs,o,n]}catch(e){r=a?[gs,e]:ws(n,e),a=!0}}return r}async function Hs(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===_s?Rs(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=vs)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==hs&&t[0]<vs&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=vs){let n=s[1];if(n[0]!==vs||n[1].options.reloadDocument||n[2])return zs(e,t),n;c=!0,s=[0,[gs,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===gs?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)};p(),i||a?.();let m=Ss(e,u);try{await xs(i?Promise.resolve().then(()=>ds(m,l===gs?`errorComponent`:`notFoundComponent`)):Promise.all([ds(m),ds(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return zs(e,t),ys}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),zs(e,t),ks(e,o),p()):u.status=`success`}return t}async function Us(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=Ss(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 xs(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&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function Ws(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Rs(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Ls(e,i,t,u,f,r,l)},m=await Es(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===_s){let t=await Rs(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=vs&&(c=0);p()}if(!a.aborted&&!r[3]){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 h=Hs(e,i,u,r[0],Bs(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Bs(i[2],void 0,void 0,h.then(e=>bs(e)?0:fs(n).length,()=>0))),o=await h}catch(t){if(zs(e,i),t===a&&a.aborted)return ys;throw t}return bs(o)?o:Us(e,o,a,r[6]===n.length?r[6]:0)}function Gs(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Ss(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Gs(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Ks(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function qs(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!fs(t[3]).some(e=>e.id===n[1]))return;let i;try{await xs(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Js(e,t){e._committed=t,e.stores.setMatches(t)}function Ys(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=fs(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Ss(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=Yo(n);Js(e,n),ks(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Xo(e,i,n,a,l,t)}async function Xs(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Zs(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Qs(e,t,n,r,i){let a=n.map(e=>({...e}));As(a);for(let t of r)Os(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Hs(e,o,r,t[0],i)}catch(t){throw ks(e,a),t}if(bs(s))ks(e,a),s[0]===vs&&e._tx===t&&e._committed===n&&await Zs(e,t,s);else if(await Us(e,s,t[0].signal),e._tx!==t||e._committed!==n)ks(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Os(e,n))}Js(e,a),ks(e,n,a)}}async function $s(e,t,n,r,i,a){let o=await Ws(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(bs(o)){let n=o[0]===vs&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Ks(e,t),ks(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Ks(e,t);return}await Zs(e,t,o);return}let s=o[1];if(e._tx===t&&await qs(e,t),e._tx!==t){Ks(e,t),ks(e,s),zs(e,o);return}let c=t[2],l=qo(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await qs(e,t),e._tx!==t){Ks(e,t),ks(e,s),zs(e,o);return}let n=await e.startTransition(()=>{Ks(e,t),Ys(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&Qs(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):zs(e,o)})}async function ec(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){let t=qo(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Xs(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});As(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){ks(e,m),await Xs(e,n);return}e._preflight=void 0;let g,_=()=>$s(e,y,f,()=>Gs(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>Xs(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&js(e,t,!1)}n[0].abort(),ks(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Gs(e,y),g?.(_()),await y[5]):(ks(e,y[3]),y[3]=[],g?.(),await Xs(e,y))}async function tc(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),As(a),o=(e._preloads??=new Map).set(i,a),s=await Ws(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),ks(e,a)),i.abort()}if(!bs(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Fa(e)||console.error(e);return}}}function nc(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{ps(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var rc=W.createContext(void 0),ic=W.createContext(void 0),ac=t((e=>{var t=Ki();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})),oc=t(((e,t)=>{t.exports=ac()})),sc=t((e=>{var t=Ki(),n=oc();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}})),cc=t(((e,t)=>{t.exports=sc()}))();function lc(e,t){return e===t}function uc(e,t=e=>e,n){let r=n?.compare??lc,i=(0,W.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,W.useCallback)(()=>e.get(),[e]);return(0,cc.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function dc({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;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}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(1)}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 fc(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 pc=[],mc=0,{link:hc,unlink:gc,propagate:_c,checkDirty:vc,shallowPropagate:yc}=dc({update(e){return e._update()},notify(e){pc[xc++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Tc(e))}}),bc=0,xc=0,Sc,Cc=0;function wc(e){try{++Cc,e()}finally{--Cc||Ec()}}function Tc(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=gc(n,e)}function Ec(){if(!(Cc>0)){for(;bc<xc;){let e=pc[bc];pc[bc++]=void 0,e.notify()}bc=0,xc=0}}function Dc(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 Sc!==void 0&&hc(i,Sc,mc),i._snapshot},subscribe(e){let t=fc(e),n={current:!1},r=Oc(()=>{i.get(),n.current?(Sc=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Sc,o=t?.compare??Object.is;if(n)Sc=i,++mc,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{Sc=a,n&&(i.flags&=-5),Tc(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&vc(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&yc(e)}}else e&32&&(i.flags=e&-33);return Sc!==void 0&&hc(i,Sc,mc),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(_c(e),yc(e),Ec())}},i}function Oc(e){let t=()=>{let t=Sc;Sc=n,++mc,n.depsTail=void 0,n.flags=6;try{return e()}finally{Sc=t,n.flags&=-5,Tc(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&&vc(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Tc(this)}};return t(),n}var G=Ui(),kc=class extends W.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?W.createElement(this.props.errorComponent??Ac,{error:e[0],reset:this.reset}):this.props.children}};function Ac({error:e}){let[t,n]=W.useState(!1);return(0,G.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,G.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,G.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,G.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,G.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,G.jsx)(`div`,{children:(0,G.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,G.jsx)(`code`,{children:e.message}):null})}):null]})}var jc=()=>!0,Mc=()=>!1;function Nc({children:e,fallback:t=null}){return(0,G.jsx)(W.Fragment,{children:Pc()?e:t})}function Pc(e=!0){return W.useSyncExternalStore(Fc,jc,e?Mc:jc)}function Fc(){return()=>{}}function Ic(e){let t=Zi(),n=`not-found-${uc(t.stores.location,e=>e.pathname)}-${uc(t.stores.status)}`;return(0,G.jsx)(kc,{getResetKey:()=>n,onCatch:(t,n)=>{if(Fa(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Fa(t))return e.fallback?.(t);throw t},children:e.children})}function Lc(){return(0,G.jsx)(`p`,{children:`Not Found`})}function Rc(e,t,n){return t.options.notFoundComponent?(0,G.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,G.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,G.jsx)(Lc,{})}function zc(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,G.jsx)(n,{}):null}var Bc=(e,t)=>e[0]===t[0]&&e[1]===t[1],Vc=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Hc=W.memo(function({routeId:e}){let t=Zi();return Uc(t,uc(t.stores.getMatchStore(e)))});function Uc(e,t){let n=e.routesById[t.routeId],r=zc(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=Vc(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,G.jsx)(Wc,{match:t});s&&(l=(0,G.jsx)(Nc,{fallback:r,children:l})),o&&(l=(0,G.jsx)(Ic,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return W.createElement(o,e)},children:l})),i&&(l=(0,G.jsx)(kc,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Fa(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,G.jsx)(W.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,G.jsx)(rc.Provider,{value:t.routeId,children:(0,G.jsxs)(u,{children:[l,null]})}):(0,G.jsxs)(rc.Provider,{value:t.routeId,children:[l,null]})}var Wc=W.memo(function({match:e}){let t=Zi(),n=e.routeId,r=t.routesById[n],i=W.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=W.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,G.jsx)(e,{},i):(0,G.jsx)(Gc,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Vc(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return zc(t,r)}if(e.status===`notFound`)return Rc(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Gc=W.memo(function(){let e=Zi(),t=W.useContext(rc),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=uc(a,e=>[!!e._notFound,e.error],{compare:Bc}),i=uc(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Rc(e,e.routesById[t],r);if(!i)return null;let a=(0,G.jsx)(Hc,{routeId:i});return t===`__root__`?(0,G.jsx)(W.Suspense,{fallback:zc(e),children:a}):a});function Kc(e,t){let n=e[1];e.length=0,n?.(t)}function qc({t:e}){let t=Zi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Kc(n,!1),n.push(i,a),e(t),W.startTransition(r)}),Yi(()=>{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(Ea(r.publicHref)!==Ea(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`,...qo(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Jc(){let e=Zi(),t=e.routesById[Ia],n=zc(e,t),r=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qc,{t:W.useState()[1]}),e.ssr?(0,G.jsx)(Yc,{}):(0,G.jsx)(W.Suspense,{fallback:n,children:(0,G.jsx)(Yc,{})})]});return e.options.InnerWrap?(0,G.jsx)(e.options.InnerWrap,{children:r}):r}function Yc(){let e=Zi(),t=e._rendered,n=uc(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Yi(()=>{t[0]===n&&Kc(t,!0)},[t,n]);let a=i?(0,G.jsx)(Hc,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,G.jsx)(kc,{getResetKey:()=>r,onCatch:void 0,children:a})}function Xc(){let e=Zi();return W.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e,uc(e.stores.location,e=>e.href),uc(e.stores.resolvedLocation,e=>e?.href),uc(e.stores.status)])}var Zc=e=>({createMutableStore:Dc,createReadonlyStore:Dc,batch:wc}),Qc=e=>new $c(e),$c=class extends Zo{constructor(e){super(e,Zc)}};function el({router:e,children:t,...n}){ra(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,G.jsx)(Xi.Provider,{value:e,children:t});return e.options.Wrap?(0,G.jsx)(e.options.Wrap,{children:r}):r}function tl({router:e,...t}){return(0,G.jsx)(el,{router:e,...t,children:(0,G.jsx)(Jc,{})})}var nl=(0,W.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),rl=W.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:o,children:s,weights:c,...l}=e,{color:u=`currentColor`,size:d,weight:f=`regular`,mirrored:p=!1,...m}=W.useContext(nl);return W.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??d,height:i??d,fill:r??u,viewBox:`0 0 256 256`,transform:o||p?`scale(-1, 1)`:void 0,...m,...l},!!n&&W.createElement(`title`,null,n),s,c.get(a??f))});rl.displayName=`IconBase`;var il=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),al=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:il}));al.displayName=`CheckCircleIcon`;var ol=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M216,120v96H152V152H104v64H40V120a8,8,0,0,1,2.34-5.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,216,120Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M217.9,110.1l-80-80a14,14,0,0,0-19.8,0l-80,80A13.92,13.92,0,0,0,34,120v96a6,6,0,0,0,6,6h64a6,6,0,0,0,6-6V158h36v58a6,6,0,0,0,6,6h64a6,6,0,0,0,6-6V120A13.92,13.92,0,0,0,217.9,110.1ZM210,210H158V152a6,6,0,0,0-6-6H104a6,6,0,0,0-6,6v58H46V120a2,2,0,0,1,.58-1.42l80-80a2,2,0,0,1,2.84,0l80,80A2,2,0,0,1,210,120Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M216.49,111.51l-80-80a12,12,0,0,0-17,0l-80,80A12,12,0,0,0,36,120v96a4,4,0,0,0,4,4h64a4,4,0,0,0,4-4V156h40v60a4,4,0,0,0,4,4h64a4,4,0,0,0,4-4V120A12,12,0,0,0,216.49,111.51ZM212,212H156V152a4,4,0,0,0-4-4H104a4,4,0,0,0-4,4v60H44V120a4,4,0,0,1,1.17-2.83l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,212,120Z`}))]]),sl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:ol}));sl.displayName=`HouseIcon`;var cl=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),ll=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:cl}));ll.displayName=`InfoIcon`;var ul=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M144,180a16,16,0,1,1-16-16A16,16,0,0,1,144,180Zm92-52A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128ZM128,64c-24.26,0-44,17.94-44,40v4a12,12,0,0,0,24,0v-4c0-8.82,9-16,20-16s20,7.18,20,16-9,16-20,16a12,12,0,0,0-12,12v8a12,12,0,0,0,23.73,2.56C158.31,137.88,172,122.37,172,104,172,81.94,152.26,64,128,64Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,168a12,12,0,1,1,12-12A12,12,0,0,1,128,192Zm8-48.72V144a8,8,0,0,1-16,0v-8a8,8,0,0,1,8-8c13.23,0,24-9,24-20s-10.77-20-24-20-24,9-24,20v4a8,8,0,0,1-16,0v-4c0-19.85,17.94-36,40-36s40,16.15,40,36C168,125.38,154.24,139.93,136,143.28Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M138,180a10,10,0,1,1-10-10A10,10,0,0,1,138,180ZM128,74c-21,0-38,15.25-38,34v4a6,6,0,0,0,12,0v-4c0-12.13,11.66-22,26-22s26,9.87,26,22-11.66,22-26,22a6,6,0,0,0-6,6v8a6,6,0,0,0,12,0v-2.42c18.11-2.58,32-16.66,32-33.58C166,89.25,149,74,128,74Zm102,54A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M136,180a8,8,0,1,1-8-8A8,8,0,0,1,136,180ZM128,76c-19.85,0-36,14.36-36,32v4a4,4,0,0,0,8,0v-4c0-13.23,12.56-24,28-24s28,10.77,28,24-12.56,24-28,24a4,4,0,0,0-4,4v8a4,4,0,0,0,8,0v-4.2c18-1.77,32-15.36,32-31.8C164,90.36,147.85,76,128,76Zm100,52A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),dl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:ul}));dl.displayName=`QuestionIcon`;var fl=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z`}))]]),pl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:fl}));pl.displayName=`SpinnerIcon`;var ml=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z`}))]]),hl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:ml}));hl.displayName=`WarningIcon`;var gl=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),_l=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:gl}));_l.displayName=`WarningCircleIcon`;var vl=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z`}))]]),yl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:vl}));yl.displayName=`XIcon`;var bl=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),xl=W.forwardRef((e,t)=>W.createElement(rl,{ref:t,...e,weights:bl}));xl.displayName=`XCircleIcon`;function Sl(){return typeof window<`u`}function Cl(e){return El(e)?(e.nodeName||``).toLowerCase():`#document`}function wl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Tl(e){return((El(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function El(e){return Sl()?e instanceof Node||e instanceof wl(e).Node:!1}function Dl(e){return Sl()?e instanceof Element||e instanceof wl(e).Element:!1}function Ol(e){return Sl()?e instanceof HTMLElement||e instanceof wl(e).HTMLElement:!1}function kl(e){return!Sl()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof wl(e).ShadowRoot}function Al(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Vl(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function jl(e){return/^(table|td|th)$/.test(Cl(e))}function Ml(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Nl=/transform|translate|scale|rotate|perspective|filter/,Pl=/paint|layout|strict|content/,Fl=e=>!!e&&e!==`none`,Il;function Ll(e){let t=Dl(e)?Vl(e):e;return Fl(t.transform)||Fl(t.translate)||Fl(t.scale)||Fl(t.rotate)||Fl(t.perspective)||!zl()&&(Fl(t.backdropFilter)||Fl(t.filter))||Nl.test(t.willChange||``)||Pl.test(t.contain||``)}function Rl(e){let t=Ul(e);for(;Ol(t)&&!Bl(t);){if(Ll(t))return t;if(Ml(t))return null;t=Ul(t)}return null}function zl(){return Il??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Il}function Bl(e){return/^(html|body|#document)$/.test(Cl(e))}function Vl(e){return wl(e).getComputedStyle(e)}function Hl(e){return Dl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ul(e){if(Cl(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||kl(e)&&e.host||Tl(e);return kl(t)?t.host:t}function Wl(e){let t=Ul(e);return Bl(t)?(e.ownerDocument||e).body:Ol(t)&&Al(t)?t:Wl(t)}function Gl(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Wl(e),i=r===e.ownerDocument?.body,a=wl(r);if(i){let e=Kl(a);return t.concat(a,a.visualViewport||[],Al(r)?r:[],e&&n?Gl(e):[])}return t.concat(r,Gl(r,[],n))}function Kl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var ql={...W},Jl={};function Yl(e,t){let n=W.useRef(Jl);return n.current===Jl&&(n.current=e(t)),n}var Xl=ql.useInsertionEffect,Zl=Xl&&Xl!==ql.useLayoutEffect?Xl:e=>e();function Ql(e){let t=Yl($l).current;return t.next=e,Zl(t.effect),t.trampoline}function $l(){let e={next:void 0,callback:eu,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function eu(){}var tu=typeof document<`u`?W.useLayoutEffect:()=>{};function nu(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var ru={};function iu(e,t,n,r,i){if(!n&&!r&&!i&&!e)return ou(t);let a=ou(e);return t&&(a=su(a,t)),n&&(a=su(a,n)),r&&(a=su(a,r)),i&&(a=su(a,i)),a}function au(e){if(e.length===0)return ru;if(e.length===1)return ou(e[0]);let t=ou(e[0]);for(let n=1;n<e.length;n+=1)t=su(t,e[n]);return t}function ou(e){return du(e)?{...e(ru)}:cu(e)}function su(e,t){return du(t)?t(e):lu(e,t)}function cu(e){let t={...e};for(let e in t){let n=t[e];uu(e,n)&&(t[e]=pu(n))}return t}function lu(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=nu(e.style,r);break;case`className`:e[n]=hu(e.className,r);break;default:e[n]=uu(n,r)?fu(e[n],r):r}}return e}function uu(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 du(e){return typeof e==`function`}function fu(e,t){return t?e?(...n)=>{let r=n[0];if(gu(r)){let i=r;mu(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:pu(t):e}function pu(e){return e&&((...t)=>{let n=t[0];return gu(n)&&mu(n),e(...t)})}function mu(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function hu(e,t){return t?e?t+` `+e:t:e}function gu(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function _u(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 vu=_u(`https://base-ui.com/production-error`,`Base UI`),yu=W.createContext(void 0);function bu(e=!1){let t=W.useContext(yu);if(t===void 0&&!e)throw Error(vu(16));return t}function xu(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:W.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 Su(e){return e?.ownerDocument||document}function Cu(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(wl(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 wu(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=W.useRef(null),s=bu(!0),c=a??s!==void 0,{props:l}=xu({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=W.useCallback(()=>{let e=o.current;Tu(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return tu(u,[u]),{getButtonProps:W.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return iu({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(mu(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Tu(r),s=!i&&Eu(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(),Cu(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Cu(r,e)))},onKeyUp(e){t||(mu(e),a?.(e),e.target===e.currentTarget&&i&&c&&Tu(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),Cu(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Ql(e=>{o.current=e,u()})}}function Tu(e){return Ol(e)&&e.tagName===`BUTTON`}function Eu(e){return Ol(e)&&e.tagName===`A`&&!!e.href}function Du(e,t,n,r){let i=Yl(ku).current;return Au(i,e,t,n,r)&&Mu(i,[e,t,n,r]),i.callback}function Ou(e){let t=Yl(ku).current;return ju(t,e)&&Mu(t,e),t.callback}function ku(){return{callback:null,cleanup:null,refs:[]}}function Au(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function ju(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Mu(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null: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 Nu=19;function Pu(e){return Nu>=e}function Fu(e){if(!W.isValidElement(e))return null;let t=e,n=t.props;return(Pu(19)?n?.ref:t.ref)??null}function Iu(){}var Lu=Object.freeze([]),Ru=Object.freeze({});function zu(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)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Bu(e,t){return typeof e==`function`?e(t):e}function Vu(e,t){return typeof e==`function`?e(t):e}function Hu(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Ku(r));let i=Uu(t,n,r);if(n.enabled===!1)return null;let a=n.state??Ru;return qu(e,r,i,a)}function Uu(e,t,n){let{className:r,style:i}=e,{state:a=Ru,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Bu(r,a):void 0,d=l?Vu(i,a):void 0,f=l?zu(a,c):Ru,p=l&&s?Wu(s):void 0,m=l?nu(f,p)??{}:Ru;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Ou([m.ref,Fu(n),...o]):Du(m.ref,Fu(n),o):Du(null,null)),l?(u!==void 0&&(m.className=hu(m.className,u)),d!==void 0&&(m.style=nu(m.style,d)),m):Ru}function Wu(e){return Array.isArray(e)?au(e):iu(void 0,e)}var Gu=Symbol.for(`react.lazy`);function Ku(e){if(e?.$$typeof!==Gu)return e;let t=W.Children.toArray(e)[0];return W.isValidElement(t)?t:e}function qu(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=iu(n,t.props);return e.ref=n.ref,W.cloneElement(t,e)}return Ju(e,n)}function Ju(e,t){return e===`button`?(0,W.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,W.createElement)(`img`,{alt:``,...t,key:t.key}):W.createElement(e,t)}var Yu=W.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=wu({disabled:i,focusableWhenDisabled:a,native:o});return Hu(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Xu=oc(),Zu=e(Wi(),1),Qu=Gi();function $u(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=$u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ed(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$u(e))&&(r&&(r+=` `),r+=t);return r}var td=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,nd=ed,rd=(e,t)=>n=>{if(t?.variants==null)return nd(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=td(t)||td(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 nd(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)},id=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ad=(e,t)=>({classGroupId:e,validator:t}),od=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sd=`-`,cd=[],ld=`arbitrary..`,ud=e=>{let t=pd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return fd(e);let n=e.split(sd);return dd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?id(i,t):t:i||cd}return n[e]||cd}}},dd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=dd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(sd):e.slice(t).join(sd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},fd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ld+r:void 0})(),pd=e=>{let{theme:t,classGroups:n}=e;return md(n,t)},md=(e,t)=>{let n=od();for(let r in e){let i=e[r];hd(i,n,r,t)}return n},hd=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];gd(i,t,n,r)}},gd=(e,t,n,r)=>{typeof e==`string`?_d(e,t,n):typeof e==`function`?vd(e,t,n,r):yd(e,t,n,r)},_d=(e,t,n)=>{let r=e===``?t:bd(t,e);r.classGroupId=n},vd=(e,t,n,r)=>{xd(e)?hd(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(ad(n,e)))},yd=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];hd(o,bd(t,a),n,r)}},bd=(e,t)=>{let n=e,r=t.split(sd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=od(),n.nextPart.set(t,i)),n=i}return n},xd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Sd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Cd=`!`,wd=`:`,Td=[],Ed=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Dd=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Cd)?(c=s.slice(0,-1),l=!0):s.startsWith(Cd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Ed(t,l,c,u)};if(t){let e=t+wd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ed(Td,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Od=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},kd=e=>({cache:Sd(e.cacheSize),parseClassName:Dd(e),sortModifiers:Od(e),postfixLookupClassGroupIds:Ad(e),...ud(e)}),Ad=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},jd=/\s+/,Md=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(jd),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Cd:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Nd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Pd(n))&&(i&&(i+=` `),i+=r);return i},Pd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Pd(e[r]))&&(n&&(n+=` `),n+=t);return n},Fd=(e,...t)=>{let n,r,i,a,o=o=>(n=kd(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Md(e,n);return i(e,a),a};return a=o,(...e)=>a(Nd(...e))},Id=[],Ld=e=>{let t=t=>t[e]||Id;return t.isThemeGetter=!0,t.themeKey=e,t},Rd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Bd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Vd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hd=/\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$/,Ud=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Wd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kd=e=>Bd.test(e),K=e=>!!e&&!Number.isNaN(Number(e)),qd=e=>!!e&&Number.isInteger(Number(e)),Jd=e=>e.endsWith(`%`)&&K(e.slice(0,-1)),Yd=e=>Vd.test(e),Xd=()=>!0,Zd=e=>Hd.test(e)&&!Ud.test(e),Qd=()=>!1,$d=e=>Wd.test(e),ef=e=>Gd.test(e),tf=e=>!q(e)&&!J(e),nf=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)),rf=e=>yf(e,Cf,Qd),q=e=>Rd.test(e),af=e=>yf(e,wf,Zd),of=e=>yf(e,Tf,K),sf=e=>yf(e,Df,Xd),cf=e=>yf(e,Ef,Qd),lf=e=>yf(e,xf,Qd),uf=e=>yf(e,Sf,ef),df=e=>yf(e,Of,$d),J=e=>zd.test(e),ff=e=>bf(e,wf),pf=e=>bf(e,Ef),mf=e=>bf(e,xf),hf=e=>bf(e,Cf),gf=e=>bf(e,Sf),_f=e=>bf(e,Of,!0),vf=e=>bf(e,Df,!0),yf=(e,t,n)=>{let r=Rd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bf=(e,t,n=!1)=>{let r=zd.exec(e);return r?r[1]?t(r[1]):n:!1},xf=e=>e===`position`||e===`percentage`,Sf=e=>e===`image`||e===`url`,Cf=e=>e===`length`||e===`size`||e===`bg-size`,wf=e=>e===`length`,Tf=e=>e===`number`,Ef=e=>e===`family-name`,Df=e=>e===`number`||e===`weight`,Of=e=>e===`shadow`,kf=Fd(()=>{let e=Ld(`color`),t=Ld(`font`),n=Ld(`text`),r=Ld(`font-weight`),i=Ld(`tracking`),a=Ld(`leading`),o=Ld(`breakpoint`),s=Ld(`container`),c=Ld(`spacing`),l=Ld(`radius`),u=Ld(`shadow`),d=Ld(`inset-shadow`),f=Ld(`text-shadow`),p=Ld(`drop-shadow`),m=Ld(`blur`),h=Ld(`perspective`),g=Ld(`aspect`),_=Ld(`ease`),v=Ld(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),J,q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[J,q,c],T=()=>[Kd,`full`,`auto`,...w()],ee=()=>[qd,`none`,`subgrid`,J,q],te=()=>[`auto`,{span:[`full`,qd,J,q]},qd,J,q],ne=()=>[qd,`auto`,J,q],E=()=>[`auto`,`min`,`max`,`fr`,J,q],re=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ie=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ae=()=>[`auto`,...w()],oe=()=>[Kd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],se=()=>[s,Kd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ce=()=>[Kd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],D=()=>[e,J,q],le=()=>[...b(),mf,lf,{position:[J,q]}],ue=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],O=()=>[`auto`,`cover`,`contain`,hf,rf,{size:[J,q]}],de=()=>[Jd,ff,af],fe=()=>[``,`none`,`full`,l,J,q],pe=()=>[``,K,ff,af],me=()=>[`solid`,`dashed`,`dotted`,`double`],he=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],k=()=>[K,Jd,mf,lf],ge=()=>[``,`none`,m,J,q],_e=()=>[`none`,K,J,q],ve=()=>[`none`,K,J,q],A=()=>[K,J,q],ye=()=>[Kd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Yd],breakpoint:[Yd],color:[Xd],container:[Yd],"drop-shadow":[Yd],ease:[`in`,`out`,`in-out`],font:[tf],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Yd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Yd],shadow:[Yd],spacing:[`px`,K],text:[Yd],"text-shadow":[Yd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Kd,q,J,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,J,q]}],"container-named":[nf],columns:[{columns:[K,`auto`,q,J,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[qd,`auto`,J,q]}],basis:[{basis:[Kd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[K,Kd,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,K,J,q]}],shrink:[{shrink:[``,K,J,q]}],order:[{order:[qd,`first`,`last`,`none`,J,q]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...re(),`normal`]}],"justify-items":[{"justify-items":[...ie(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ie()]}],"align-content":[{content:[`normal`,...re()]}],"align-items":[{items:[...ie(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ie(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...ie(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ie()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ae()}],mx:[{mx:ae()}],my:[{my:ae()}],ms:[{ms:ae()}],me:[{me:ae()}],mbs:[{mbs:ae()}],mbe:[{mbe:ae()}],mt:[{mt:ae()}],mr:[{mr:ae()}],mb:[{mb:ae()}],ml:[{ml:ae()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:oe()}],"inline-size":[{inline:[`auto`,...se()]}],"min-inline-size":[{"min-inline":[`auto`,...se()]}],"max-inline-size":[{"max-inline":[`none`,...se()]}],"block-size":[{block:[`auto`,...ce()]}],"min-block-size":[{"min-block":[`auto`,...ce()]}],"max-block-size":[{"max-block":[`none`,...ce()]}],w:[{w:[s,`screen`,...oe()]}],"min-w":[{"min-w":[s,`screen`,`none`,...oe()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...oe()]}],h:[{h:[`screen`,`lh`,...oe()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...oe()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...oe()]}],"font-size":[{text:[`base`,n,ff,af]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,vf,sf]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Jd,q]}],"font-family":[{font:[pf,cf,t]}],"font-features":[{"font-features":[q]}],"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:[i,J,q]}],"line-clamp":[{"line-clamp":[K,`none`,J,of]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,J,q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,J,q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...me(),`wavy`]}],"text-decoration-thickness":[{decoration:[K,`from-font`,`auto`,J,af]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[K,`auto`,J,q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[qd,J,q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,J,q]}],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`,J,q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:O()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qd,J,q],radial:[``,J,q],conic:[``,qd,J,q]},gf,uf]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:pe()}],"border-w-x":[{"border-x":pe()}],"border-w-y":[{"border-y":pe()}],"border-w-s":[{"border-s":pe()}],"border-w-e":[{"border-e":pe()}],"border-w-bs":[{"border-bs":pe()}],"border-w-be":[{"border-be":pe()}],"border-w-t":[{"border-t":pe()}],"border-w-r":[{"border-r":pe()}],"border-w-b":[{"border-b":pe()}],"border-w-l":[{"border-l":pe()}],"divide-x":[{"divide-x":pe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":pe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...me(),`hidden`,`none`]}],"divide-style":[{divide:[...me(),`hidden`,`none`]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...me(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[K,J,q]}],"outline-w":[{outline:[``,K,ff,af]}],"outline-color":[{outline:D()}],shadow:[{shadow:[``,`inner`,`none`,u,_f,df]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":[`none`,d,_f,df]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:pe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[K,af]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":[`none`,f,_f,df]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[K,J,q]}],"mix-blend":[{"mix-blend":[...he(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":he()}],"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":[K]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[J,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[K]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,J,q]}],filter:[{filter:[``,`none`,J,q]}],blur:[{blur:ge()}],brightness:[{brightness:[K,J,q]}],contrast:[{contrast:[K,J,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,_f,df]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:[``,K,J,q]}],"hue-rotate":[{"hue-rotate":[K,J,q]}],invert:[{invert:[``,K,J,q]}],saturate:[{saturate:[K,J,q]}],sepia:[{sepia:[``,K,J,q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,J,q]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[K,J,q]}],"backdrop-contrast":[{"backdrop-contrast":[K,J,q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,K,J,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[K,J,q]}],"backdrop-invert":[{"backdrop-invert":[``,K,J,q]}],"backdrop-opacity":[{"backdrop-opacity":[K,J,q]}],"backdrop-saturate":[{"backdrop-saturate":[K,J,q]}],"backdrop-sepia":[{"backdrop-sepia":[``,K,J,q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,J,q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[K,`initial`,J,q]}],ease:[{ease:[`linear`,`initial`,_,J,q]}],delay:[{delay:[K,J,q]}],animate:[{animate:[`none`,v,J,q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,J,q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":[`scale-3d`],skew:[{skew:A()}],"skew-x":[{"skew-x":A()}],"skew-y":[{"skew-y":A()}],transform:[{transform:[J,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[qd,J,q]}],accent:[{accent:D()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:D()}],"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`,J,q]}],"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":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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`,J,q]}],fill:[{fill:[`none`,...D()]}],"stroke-w":[{stroke:[K,ff,af,of]}],stroke:[{stroke:[`none`,...D()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},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":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`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-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`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-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`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-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`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-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Af(...e){return kf(ed(e))}var jf=rd(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5`,sm:`h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4`,icon:`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-xs":`size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5`,"icon-sm":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-lg":`size-8 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`,size:`default`}});function Mf(e){let t=(0,Qu.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=Af(jf({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,G.jsx)(Yu,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Nf=qi();function Pf(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ff(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`flex max-w-sm flex-col items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var If=rd(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function Lf(e){let t=(0,Qu.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Af(If({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,G.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function Rf(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`text-sm font-medium tracking-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`empty-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zf(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Bf(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2 text-xs/relaxed text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Vf(){let e=(0,Qu.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(dl,{weight:`light`,className:`text-muted-foreground/40 size-6`}),n=jf({size:`icon`,variant:`ghost`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsxs)(Pf,{"aria-label":`Page not found`,children:[t,(0,G.jsx)(`a`,{className:n,href:`/`,"aria-label":`Go home`,title:`Go home`,children:(0,G.jsx)(sl,{className:`size-4`})})]}),e[2]=r):r=e[2],r}function Hf(e){let t=(0,Qu.c)(9),n=e.label??`Unavailable`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsx)(_l,{"aria-hidden":!0,className:`text-destructive size-4 shrink-0`}),t[0]=r):r=t[0];let i=e.label??`Can’t load this view.`,a;t[1]===i?a=t[2]:(a=(0,G.jsxs)(`p`,{className:`flex items-center gap-2`,children:[r,(0,G.jsx)(`span`,{children:i})]}),t[1]=i,t[2]=a);let o;t[3]===e.reset?o=t[4]:(o=(0,G.jsx)(Mf,{variant:`destructive`,className:`max-sm:h-11`,onClick:e.reset,children:`Retry`}),t[3]=e.reset,t[4]=o);let s;return t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-3`,children:(0,G.jsxs)(`div`,{role:`alert`,"aria-label":n,className:`flex flex-col items-center gap-2`,children:[a,o]})}),t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}var Y=class extends d()(`AuthError`,{cause:Pe(Yn()),error:B(Ni([`invalid_request`,`invalid_client`,`invalid_client_metadata`,`invalid_redirect_uri`,`invalid_grant`,`invalid_target`,`invalid_scope`,`unsupported_grant_type`,`unsupported_response_type`,`access_denied`,`temporarily_unavailable`])),message:N}){},Uf=R({id:S,name:S}),Wf=N.check(zt(/^https:\/\/[a-z\d-]+\.mp281x\.xyz(?:\/mcp)?$/u));R({accessToken:S,clientId:S,expiresAt:dn,refreshToken:S}),R({client_id:S}),R({access_token:S,expires_in:dn,refresh_token:S});var Gf=N.check(Wt(e=>Ie(tt(Mr(e)),e=>_r([`http:`,`https:`],e.protocol)&&e.username===``&&e.password===``&&e.hash===``),{expected:`an HTTP(S) URL without credentials or a fragment`})).check(Wt(e=>Ie(tt(Mr(e)),e=>e.pathname===`/`&&e.search===``),{expected:`an HTTP(S) origin without a path or query`})),Kf=Gf.check(Wt(e=>Ie(tt(Mr(e)),e=>e.protocol===`https:`||_r([`localhost`,`127.0.0.1`,`[::1]`],e.hostname)),{expected:`HTTPS outside loopback`}));N.check(zt(/^\d{1,5}$/u),Wt(e=>Ie(Kn(e),e=>e>=1&&e<=65535),{expected:`a port between 1 and 65535`}));var qf=N.check(zt(/^0\.1\.\d+$/u)),Jf=`/api/runtime`,Yf=R({auth:B(Gf),name:N,traces:N,version:qf}),Xf=`/api/rpc`;R({...Uf.fields,signOut:er}),R({config:R({port:xi}),name:N,version:qf});function Zf(e,t,n,r){return H(wt(Er(function*(){let i=`${yield*Kr}`,a=yield*jn,o={attributes:{"scope.run.started_unix_nano":i,"scope.runtime":n,"service.instance.id":i},serviceName:e,serviceVersion:kt(Ae(r,e=>e!==`0.1.0`))};return H(vn(Bt({resource:o,url:new URL(`/v1/traces`,t).href}),ue({resource:o,url:new URL(`/v1/logs`,t).href}),y(jn)([...a,`code`,`state`,`request`,`access_token`,`refresh_token`,`id_token`,`client_secret`,`client_assertion`,`code_verifier`,`session`,`token`])),Ai([ke,we]))})),cn(e=>rn(e)?vi($n):vi(bi(`Telemetry is unavailable`))))}function Qf(e){return wt(Er(function*(){let t=yield*H((yield*Zt).get(Jf),z(at),z(n(Yf)),Vi(`3 seconds`),x);return Te(t,{onNone:()=>Fi,onSome:t=>t.traces===``?Fi:Zf(`${e}-client`,t.traces,`web`,t.version)})}))}var $f=jt(Qt()),ep=new WeakSet,tp=Wn(e=>{let t=un(`Web error`,$t(e.error),...ot(f(e.stack)));return Te(_e($f),{onNone:()=>t,onSome:n=>Ei(H(t,I(or(e.error)),Ne(`Web.error`,{attributes:{"web.error.source":e.source,"web.route.id":e.route},root:!0}),Lr),n)})});function np(e,t){let n=document.querySelector(`#root`);if(Ir(n))throw TypeError(`Missing application mount element with id "root"`);return{root:n,router:Qc({context:{},defaultErrorComponent:Hf,defaultNotFoundComponent:Vf,defaultPreload:`intent`,getScrollRestorationKey:t,routeTree:e,scrollRestoration:!0})}}function rp(e){return t=>k(it(e)(t),()=>le(e)({}))}function ip(e){let t=s();function n(n,r,i){if(Tn(n)){if(ep.has(n))return;ep.add(n)}t.set(tp,{error:n,route:H(Gn(e.router.state.matches,e=>e.error===n),Kt(()=>Ci(e.router.state.matches)),Ri(e=>Ae(e.routeId,rr)),k(()=>`__root__`)),source:r,stack:i})}e.router.update({defaultOnCatch:(e,t)=>n(e,`route`,t.componentStack)}),(0,Nf.createRoot)(e.root,{onCaughtError:(e,t)=>n(e,`caught`,t.componentStack),onUncaughtError:(e,t)=>n(e,`uncaught`,t.componentStack)}).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(tl,{router:e.router})}))}function ap(e){return H(e,$e(e=>H(e(lt(`1 second`)),a(e=>e.input._tag===`RpcClientError`||gt(Y)(e.input)&&e.input.error===`temporarily_unavailable`))))}var op=H(gr({pingTimeout:`15 seconds`,retryTransientErrors:!0}),Ai(H(zn(j(()=>`${location.origin}${Xf}`)),Ai(zr))),vt(fi()));function sp(e){return _t.addGlobalLayer(H(Qf(e),Ai(we),wi(e=>Vt(ri(e,Wr))?F:qr(j(()=>Ut($f,nn(e))),()=>j(()=>fe($f,ft(t=>t!==e))))))),op}function cp(e){W.useEffect(e,Lu)}var lp=W.createContext(void 0);function up(){let e=W.useContext(lp);if(!e)throw Error(vu(73));return e}var dp=[],fp=void 0;function pp(){return fp}function mp(e){dp.push(e)}function hp(e){let t=(t,n)=>{let r=Yl(_p).current,i;try{fp=r;for(let e of dp)e.before(r);i=e(t,n);for(let e of dp)e.after(r);r.didInitialize=!0}finally{fp=void 0}return i};return t.displayName=e.displayName||e.name,t}function gp(e){return W.forwardRef(hp(e))}function _p(){return{didInitialize:!1}}var vp=Pu(19)?xp:Sp;function yp(e,t,n,r,i){return vp(e,t,n,r,i)}function bp(e,t,n,r,i){let a=W.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Xu.useSyncExternalStore)(e.subscribe,a,a)}mp({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,Xu.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function xp(e,t,n,r,i){let a=pp();if(!a)return bp(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 Sp(e,t,n,r,i){return(0,cc.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Cp=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 yp(this,e,t,n,r)}},wp=class extends Cp{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){W.useDebugValue(e);let n=this;tu(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;tu(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;tu(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){W.useDebugValue(e);let n=this,r=t!==void 0;tu(()=>{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 W.useDebugValue(e),yp(this,this.selectors[e],t,n,r)}useContextCallback(e,t){W.useDebugValue(e);let n=Ql(t??Iu);this.context[e]=n}useStateSetter(e){let t=W.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)}})}},Tp=0;function Ep(e){return Tp+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Tp}`}var Dp=0,Op=class e{static create(){return new e}currentId=Dp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Dp,t()},e)}isStarted(){return this.currentId!==Dp}clear=()=>{this.currentId!==Dp&&(clearTimeout(this.currentId),this.currentId=Dp)};disposeEffect=()=>this.clear};function kp(){let e=Yl(Op.create).current;return cp(e.disposeEffect),e}function Ap(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function jp(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Mp,platform:Np,maxTouchPoints:Pp}=jp(),Fp=Mp.toLowerCase(),Ip=Np.toLowerCase(),Lp=/^i(os$|p)/.test(Ip)||Ip===`macintel`&&Pp>1,Rp=`android`,zp=Ip===Rp||Fp.includes(Rp),Bp=!Lp&&Ip.startsWith(`mac`);Ip.startsWith(`win`),!zp&&/^(linux|chrome os)/.test(Ip);var Vp=Bp||Lp,Hp=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Hp&&Fp.includes(`firefox`),!Hp&&Fp.includes(`chrom`);var Up=Vp,Wp=/jsdom|happydom/.test(Fp);function Gp(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Kp(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&kl(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function qp(e,t){let n=e;for(;n;){if(Dl(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(kl(n)?n.host:null)}return null}function Jp(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Yp=`data-base-ui-focusable`,Xp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Zp=`ArrowLeft`,Qp=`ArrowRight`,$p=`ArrowUp`,em=`ArrowDown`,tm=`data-starting-style`,nm=`data-ending-style`,rm={[tm]:``},im={[nm]:``},am={transitionStatus(e){return e===`starting`?rm:e===`ending`?im:null}},om=`data-popup-open`,sm=`data-pressed`,cm=`data-trigger-disabled`;function lm(e,t){if(!Dl(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(cm);for(let[,e]of t.entries())if(Kp(e,n))return!e.hasAttribute(cm);return!1}function um(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 dm(e){return e.matches(`html,body`)}function fm(e){return Ol(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function pm(e){return qp(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Xp}`)!=null}function mm(e){return e?e.getAttribute(`role`)===`combobox`&&fm(e):!1}function hm(e){if(!e||Wp)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function gm(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function _m(e,t){return t<0||t>=e.length}function vm(e,t){return xm(e.current,{disabledIndices:t})}function ym(e,t){return xm(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function bm(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>xm(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:_m(e,u)?-1:u,wrapped:d}}function xm(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Sm(e,a,r));return a}function Sm(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!wm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Cm(e){return e.visibility===`hidden`||e.visibility===`collapse`}function wm(e,t=e?Vl(e):null){return!e||!e.isConnected||!t||Cm(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Tm=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Em(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return kl(n)?n.host:null}function Dm(e){for(let t of Array.from(e.children))if(Cl(t)===`summary`)return t;return null}function Om(e,t){let n=Dm(t);return!!n&&(e===n||Kp(n,e))}function km(e){let t=e?Cl(e):``;return e!=null&&e.matches(Tm)&&(t!==`summary`||e.parentElement!=null&&Cl(e.parentElement)===`details`&&Dm(e.parentElement)===e)&&(t!==`details`||Dm(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Am(e){if(!km(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Em(t)){let n=t!==e,r=Cl(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Cl(t)===`details`&&!t.open&&!Om(e,t)||t.hasAttribute(`hidden`)||!r&&!jm(t,n))return!1}return!0}function jm(e,t){let n=Vl(e);return t?n.display!==`none`:wm(e,n)}function Mm(e){let t=e.tabIndex;if(t<0){let t=Cl(e);if(t===`details`||t===`audio`||t===`video`||Ol(e)&&e.isContentEditable)return 0}return t}function Nm(e){if(Cl(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Pm(e,t){let n=Nm(e);if(!n)return!0;let r=t.find(e=>{let t=Nm(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Nm(e);return t?.name===n.name&&t.form===n.form})===n}function Fm(e){if(Ol(e)&&Cl(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ol(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Im(e,t){Fm(e).forEach(e=>{km(e)&&t.push(e),Im(e,t)})}function Lm(e,t,n){Fm(e).forEach(e=>{Ol(e)&&e.matches(t)&&n.push(e),Lm(e,t,n)})}function Rm(e){return Am(e)&&Mm(e)>=0}function zm(e){let t=[];return Im(e,t),t.filter(Am)}function Bm(e){let t=zm(e);return t.filter(e=>Mm(e)>=0&&Pm(e,t))}function Vm(e,t){let n=Bm(e),r=n.length;if(r===0)return;let i=Gp(Su(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Hm(e){return Vm(Su(e).body,1)||e}function Um(e){return Vm(Su(e).body,-1)||e}function Wm(e,t,n){if(!e)return null;let r=[];Im(Su(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Am);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Kp(n,o)&&Rm(o)&&Pm(o,a))return o}return r[i]}function Gm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kp(n,r)}function Km(e){Bm(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function qm(e){let t=[];Lm(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Jm(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}function Ym(e,t){let n=0;return e.map(e=>{if(e.transitionStatus===`ending`)return e;let r=n>=t;return n+=1,e.limited===r?e:{...e,limited:r}})}var Xm={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement},Zm=class extends wp{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Jm(e.toasts)},{},Xm)}setViewport=e=>{this.set(`viewport`,e)};syncProviderProps(e,t){let n=this.state.limit!==t;if(this.state.timeout===e&&!n)return;let r={timeout:e,limit:t};if(n){let e=Ym(this.state.toasts,t);r.toasts=e,r.toastMetadata=Jm(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=Xm.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||Ep(`toast`);if(e.id){let t=Xm.toast(this.state,e.id);if(t){if(t.transitionStatus===`ending`)this.removeToast(e.id,!0);else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,!0,!0),e.id}}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts];this.setToasts(Ym(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),Xm.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{let n=Xm.toast(this.state,e);n&&n.transitionStatus!==`ending`&&this.updateToastInternal(e,typeof t==`function`?t(n):t,!1,!0)};updateToastInternal=(e,t,n=!1,r=!1)=>{let{timeout:i,toasts:a}=this.state,o=Xm.toast(this.state,e);if(!o||o.transitionStatus===`ending`)return;let s={...o,...t,...r&&{updateKey:o.updateKey+1}};this.setToasts(a.map(t=>t.id===e?s:t));let c=s.timeout??i,l=o.timeout??i,u=Object.hasOwn(t,`timeout`),d=s.transitionStatus!==`ending`&&s.type!==`loading`&&c>0,f=this.timers.has(e),p=l!==c,m=o.type===`loading`;!d&&f?this.clearTimer(e):d&&(!f||p||u||m||n)&&(this.clearTimer(e),this.scheduleTimer(e,c,()=>this.closeToast(e)),Xm.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.clearTimers();else{let t=Xm.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=Ym(r.map(n=>t||n.id===e?{...n,transitionStatus:`ending`,height:0}:n),n);this.setToasts(a,!a.some(e=>e.transitionStatus!==`ending`)),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=Ap(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Ap(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Ap(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=Op.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=Jp(e);Kp(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=Xm.expandedOrOutOfFocus(this.state)?void 0:Op.create();i?.start(t,()=>{this.handleTimerFired(e),n()}),this.timers.set(e,{timeout:i,start:r,delay:t,remaining:t,callback:n})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,t=e.length===0){let n={toasts:e,toastMetadata:Jm(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=Gp(Su(this.state.viewport));if(!this.state.viewport||!Kp(this.state.viewport,t)||!hm(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=Xm.toasts(this.state),r=Xm.toastIndex(this.state,e),i=(e,t)=>{for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].transitionStatus!==`ending`)return n[r];return null},a=i(r+1,1)??i(r-1,-1);a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},Qm=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=Yl(()=>new Zm({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return cp(a.disposeEffect),W.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t.updates):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),(0,G.jsxs)(lp.Provider,{value:a,children:[(0,G.jsx)($m,{store:a,timeout:n,limit:r}),t]})};function $m(e){let{store:t,timeout:n,limit:r}=e;return tu(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}function eh(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function th(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}var nh={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},rh={...nh,position:`fixed`,margin:0,top:0,left:0};({...nh});var ih=W.forwardRef(function(e,t){let[n,r]=W.useState();tu(()=>{Up&&Hp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,G.jsx)(`span`,{...e,ref:t,style:rh,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),ah=`--toast-frontmost-height`,oh=W.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=up(),c=kp(),l=W.useRef(!1),u=W.useRef(!1),d=W.useRef(!1),f=s.useState(`isEmpty`),p=s.useState(`toasts`),m=s.useState(`focused`),h=s.useState(`expanded`),g=s.useState(`prevFocusElement`),_=p[0]?.height,v=p.some(e=>e.transitionStatus===`ending`),y=p.filter(e=>e.priority===`high`);W.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=wl(e),n=Su(e);function r(t){t.key===`F6`&&Jp(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,Gp(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){Jp(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=Jp(n),i=Gp(Su(e));r!==t&&Kp(e,r)&&hm(i)||s.resumeTimers(),c.start(0,()=>s.set(`isWindowFocused`,!0))}return th(eh(t,`keydown`,r),eh(t,`blur`,i,!0),eh(t,`focus`,a,!0),eh(n,`pointerdown`,s.handleDocumentPointerDown,!0))},[s,c,f]);function b(e){l.current=!0;let t=e.relatedTarget===s.state.viewport?p.find(e=>e.transitionStatus!==`ending`&&!e.limited):void 0;t?t.ref?.current?.focus():s.restoreFocusToPrevElement()}function x(e){e.key===`Tab`&&e.shiftKey&&Jp(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement())}function S(){s.state.toasts.some(e=>e.transitionStatus===`ending`)||d.current||!u.current||(s.set(`hovering`,!1),s.select(`expandedOrOutOfFocus`)||s.resumeTimers(),u.current=!1)}W.useEffect(S,[v,s]);function C(){s.pauseTimers(),s.set(`hovering`,!0),u.current=!1}function w(){u.current=!0,S()}function T(e){e.pointerType===`touch`&&(d.current=!0)}function ee(e){e.pointerType===`touch`&&(d.current=!1,S())}function te(){l.current?l.current=!1:m||hm(Gp(Su(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function ne(e){m&&!Kp(s.state.viewport,e.relatedTarget)&&(s.set(`focused`,!1),s.select(`expandedOrOutOfFocus`)||s.resumeTimers())}let E={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:C,onMouseMove:C,onMouseLeave:w,onFocus:te,onBlur:ne,onKeyDown:x,onClick:te,onPointerDown:T,onPointerUp:ee,onPointerCancel:ee,style:{[ah]:_?`${_}px`:void 0}},re={expanded:h},ie=!f&&g&&(0,G.jsx)(ih,{onFocus:b}),ae=Hu(`div`,e,{ref:[t,s.setViewport],state:re,props:[E,o,{children:(0,G.jsxs)(W.Fragment,{children:[ie,a,ie]})}]});return(0,G.jsxs)(W.Fragment,{children:[ie,ae,!m&&y.length>0&&(0,G.jsx)(`div`,{style:rh,children:y.map(e=>(0,G.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,G.jsx)(`div`,{children:e.title}),(0,G.jsx)(`div`,{children:e.description})]},e.id))})]})});function sh(e){return Pu(19)?e:e?`true`:void 0}var ch=W.createContext(void 0);function lh(){let e=W.useContext(ch);if(!e)throw Error(vu(66));return e}var uh=null;globalThis.requestAnimationFrame;var dh=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)}},fh=class e{static create(){return new e}static request(e){return dh.request(e)}static cancel(e){return dh.cancel(e)}currentId=uh;request(e){this.cancel(),this.currentId=dh.request(()=>{this.currentId=uh,e()})}cancel=()=>{this.currentId!==uh&&(dh.cancel(this.currentId),this.currentId=uh)};disposeEffect=()=>this.cancel};function ph(){let e=Yl(fh.create).current;return cp(e.disposeEffect),e}function mh(e){return e==null?e:`current`in e?e.current:e}function hh(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var gh=null;function _h(e){if(!gh){let e=[];gh=e,queueMicrotask(()=>{gh=null,Zu.flushSync(()=>{for(let t of e)t()})})}gh.push(e)}function vh(e,t=!1,n=!1){let r=ph();return Ql((i,a=null)=>{r.cancel();let o=mh(e);if(o==null)return;let s=o,c=()=>{n?_h(()=>{a?.aborted||i()}):Zu.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(hh(s).map(e=>e.finished.then(Iu))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(hh(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=tm;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})}else r.request(l)})}function yh(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=Ql(a),s=vh(r,n,i);W.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var bh={style:{transition:`none`}},xh=`data-base-ui-click-trigger`,Sh=`data-base-ui-swipe-ignore`,Ch=`data-swipe-ignore`,wh=`[${Sh}]`,Th=`[${Ch}]`,Eh={fallbackAxisSide:`none`},Dh={fallbackAxisSide:`end`},Oh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function kh(e,t){let n=(t??wl(e).getComputedStyle(e)).transform,r=0,i=0,a=1;if(n&&n!==`none`){let e=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(r=t[4],i=t[5],a=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(r=t[12],i=t[13],a=t[0])}}return{x:r,y:i,scale:a}}function Ah(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}var jh=`--toast-index`,Mh=`--toast-offset-y`,Nh=`--toast-height`,Ph=`--toast-swipe-movement-x`,Fh=`--toast-swipe-movement-y`,Ih=`data-swipe-direction`,Lh={...am,swipeDirection(e){return e?{[Ih]:e}:null}},Rh=40,zh=10,Bh=.5,Vh=1,Hh=`${wh},${Th}`,Uh=W.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,c=n.positionerProps?.anchor!==void 0,l=[];c||(l=Array.isArray(a)?a:[a]);let u=l.length>0,d=up(),[f,p]=W.useState(void 0),[m,h]=W.useState(!1),[g,_]=W.useState(!1),[v,y]=W.useState({x:0,y:0}),[b,x]=W.useState({x:0,y:0,scale:1}),[S,C]=W.useState(),[w,T]=W.useState(),[ee,te]=W.useState(null),ne=W.useRef(null),E=W.useRef(void 0),re=W.useRef({x:0,y:0}),ie=W.useRef({x:0,y:0,scale:1}),ae=W.useRef(void 0),oe=W.useRef(0),se=W.useRef(!1),ce=W.useRef({x:0,y:0}),D=W.useRef(!1),le=W.useRef({x:0,y:0}),ue=W.useRef(null),O=W.useRef(null),de=d.useState(`toastIndex`,n.id),fe=d.useState(`toastVisibleIndex`,n.id),pe=d.useState(`toastOffsetY`,n.id),me=d.useState(`focused`),he=d.useState(`expanded`);yh({open:n.transitionStatus!==`ending`,ref:ne,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let k=Ql((e=!1)=>{let t=ne.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){d.updateToastInternal(n.id,{ref:ne,height:i,transitionStatus:void 0})}e?Zu.flushSync(a):a()});tu(()=>{let e=E.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),x({x:0,y:0,scale:1}),ge({x:0,y:0})),E.current=n.id,k())},[k,n.id,n.transitionStatus]);function ge(e){le.current=e,y(e)}tu(()=>()=>{O.current?.abort()},[]);function _e(e,t){let n=e=>e>0?e**Bh:-(Math.abs(e)**Bh),r=e>0&&!l.includes(`right`)||e<0&&!l.includes(`left`),i=t>0&&!l.includes(`down`)||t<0&&!l.includes(`up`);return{x:r?n(e):e,y:i?n(t):t}}let ve=Ql(e=>{if(e.pointerId!==ue.current)return;ue.current=null,O.current?.abort(),O.current=null,h(!1),_(!1),te(null);let t=ie.current;if(e.type===`pointercancel`||se.current){ge({x:t.x,y:t.y}),p(void 0);return}let r=le.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(Ah(e,i,a)>Rh){o=e;break}o?(p(o),d.closeToast(n.id)):(ge({x:t.x,y:t.y}),p(void 0))});function A(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),qp(Jp(e.nativeEvent),`button,a,input,textarea,[role="button"],${Hh}`)))return;se.current=!1,ae.current=void 0,oe.current=0,ue.current=e.pointerId,re.current={x:e.clientX,y:e.clientY},ce.current=re.current;let t=e.currentTarget,n=kh(t);ie.current=n,x(n),ge({x:n.x,y:n.y}),d.set(`hovering`,!0),h(!0),_(!1),te(null),D.current=!0,O.current?.abort();let r=new AbortController;O.current=r;let i=Su(t);i.addEventListener(`pointerup`,ve,{signal:r.signal}),i.addEventListener(`pointercancel`,ve,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function ye(e){if(e.pointerId!==ue.current)return;e.preventDefault(),D.current&&=(re.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>ce.current.y||i>0&&t<ce.current.y)&&(ce.current={x:ce.current.x,y:t}),(r<0&&n>ce.current.x||r>0&&n<ce.current.x)&&(ce.current={x:n,y:ce.current.y});let a=n-re.current.x,o=t-re.current.y,s=t-ce.current.y,c=n-ce.current.x,u=ee;if(!g&&Math.sqrt(a*a+o*o)>=Vh){_(!0);let e=l.includes(`left`)||l.includes(`right`),t=l.includes(`up`)||l.includes(`down`);e&&t&&(u=Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`,te(u))}let d;if(!ae.current)u===`vertical`?o>0?d=`down`:o<0&&(d=`up`):u===`horizontal`?a>0?d=`right`:a<0&&(d=`left`):d=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,d&&l.includes(d)&&(ae.current=d,oe.current=Ah(d,a,o),p(d));else{let e=ae.current,t=Ah(e,c,s);t>Rh?(se.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&oe.current-t>=zh&&(se.current=!0)}let f=_e(a,o),m=ie.current.x,h=ie.current.y,v=l.includes(`left`)||l.includes(`right`),y=l.includes(`up`)||l.includes(`down`);u!==`vertical`&&v&&(m+=f.x),u!==`horizontal`&&y&&(h+=f.y),ge({x:m,y:h})}function be(e){if(e.key===`Escape`){if(!ne.current||!Kp(ne.current,Gp(Su(ne.current))))return;d.closeToast(n.id)}}W.useEffect(()=>{let e=ne.current;if(!u||!e)return;function t(t){ue.current!==null&&Kp(e,Jp(t))&&t.preventDefault()}return eh(e,`touchmove`,t,{passive:!1})},[u]);function xe(){let e=v.x-b.x,t=v.y-b.y;return{transition:m?`none`:void 0,transform:m?`translateX(${v.x}px) translateY(${v.y}px) scale(${b.scale})`:void 0,[Ph]:`${e}px`,[Fh]:`${t}px`}}let Se=n.priority===`high`,j={role:Se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":S,"aria-describedby":w,"aria-hidden":Se&&!me?!0:void 0,onPointerDown:u?A:void 0,onPointerMove:u?ye:void 0,onPointerUp:u?ve:void 0,onPointerCancel:u?ve:void 0,onKeyDown:be,inert:sh(n.limited),style:{...xe(),[jh]:n.transitionStatus===`ending`?de:fe,[Mh]:`${pe}px`,[Nh]:n.height?`${n.height}px`:void 0}},Ce=W.useMemo(()=>({toast:n,setTitleId:C,setDescriptionId:T,recalculateHeight:k,visibleIndex:fe,expanded:he}),[n,C,T,k,fe,he]),we={transitionStatus:n.transitionStatus,expanded:he,limited:n.limited||!1,type:n.type,swiping:m,swipeDirection:f},Te=Hu(`div`,e,{ref:[t,ne],state:we,stateAttributesMapping:Lh,props:[j,s]});return(0,G.jsx)(ch.Provider,{value:Ce,children:Te})}),Wh=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=lh(),l=W.useRef(null);return tu(()=>{c();let e=l.current;if(!e||typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`)return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),Hu(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function Gh(){let[,e]=W.useState({});return W.useCallback(()=>{e({})},[])}var Kh=0;function qh(e,t=`mui`){let n=W.useRef(void 0),r=Gh(),i=e??n.current;return W.useEffect(()=>{n.current??(Kh+=1,n.current=`${t}-${Kh}`,e??r())},[e,t,r]),i}var Jh=ql.useId;function Yh(e,t){if(Jh!==void 0){let n=Jh();return e??(t?`${t}-${n}`:n)}return qh(e,t)}function Xh(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(Xh)}function Zh(e){return W.isValidElement(e)&&Xh(e.props.children)}function Qh(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=lh(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:Yh(e),children:s,type:r.type,setId:o}}function $h(e,t,n){let r=Zh(e);return tu(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var eg=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=Qh(a,o,`description`);return $h(Hu(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),tg=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=Qh(a,o,`title`);return $h(Hu(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),ng=W.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=up(),{toast:l,expanded:u}=lh(),[d,f]=W.useState(!1),{getButtonProps:p,buttonRef:m}=wu({disabled:a,native:o}),h={type:l.type};return Hu(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),rg=W.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=lh(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=wu({disabled:a,native:o}),f={type:c.type},p=Hu(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return Zh(p)?p:null});function ig(e,t,n,r){let i=!1,a=!1,o=r??Ru;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}}function ag(e,t,n){let r=n??Ru;return{reason:e,event:t??new Event(`base-ui`),...r}}var og=`none`,sg=`trigger-press`,cg=`trigger-hover`,lg=`trigger-focus`,ug=`outside-press`,dg=`item-press`,fg=`close-press`,pg=`focus-out`,mg=`escape-key`,hg=`list-navigation`,gg=`keyboard`,_g=`pointer`,vg=`cancel-open`,yg=`sibling-open`,bg=`imperative-action`;function xg(e){return`data-base-ui-${e}`}var Sg=W.createContext(null),Cg=()=>W.useContext(Sg),wg=xg(`portal`);function Tg(e={}){let{ref:t,container:n,componentProps:r=Ru,elementProps:i}=e,a=Yh(),o=Cg()?.portalNode,[s,c]=W.useState(null),[l,u]=W.useState(null),d=Ql(e=>{e!==null&&u(e)}),f=W.useRef(null);tu(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(El(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Hu(`div`,r,{ref:[t,d],props:[{id:a,[wg]:``},i]}),m=s&&p?Zu.createPortal(p,s):null;return{node:l,nodeId:W.isValidElement(p)?p.props.id:void 0,subtree:m}}var Eg=W.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}=Tg({container:o,ref:t,componentProps:e,elementProps:c}),f=W.useRef(null),p=W.useRef(null),m=W.useRef(null),h=W.useRef(null),[g,_]=W.useState(null),v=W.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;W.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Gm(e)&&(e.type===`focusin`?v.current&&=(qm(l),!1):(Km(l),v.current=!0))}return th(eh(l,`focusin`,e,!0),eh(l,`focusout`,e,!0))},[l,y]),tu(()=>{l&&b===!0&&v.current&&(qm(l),v.current=!1)},[b,l]);let S=W.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,G.jsxs)(W.Fragment,{children:[d,(0,G.jsxs)(Sg.Provider,{value:S,children:[x&&l&&(0,G.jsx)(ih,{"data-type":`outside`,ref:f,onFocus:e=>{Gm(e,l)?m.current?.focus():Um(g?g.domReference:null)?.focus()}}),x&&l&&(0,G.jsx)(`span`,{role:s,"aria-owns":u,style:Oh}),l&&Zu.createPortal(a,l),x&&l&&(0,G.jsx)(ih,{"data-type":`outside`,ref:p,onFocus:e=>{Gm(e,l)?h.current?.focus():(Hm(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,ig(`focus-out`,e.nativeEvent)))}})]})]})}),Dg=W.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=Tg({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,G.jsxs)(W.Fragment,{children:[l,c&&Zu.createPortal(n,c)]})}),Og=W.forwardRef(function(e,t){return(0,G.jsx)(Dg,{ref:t,...e})});function kg(){let e=up(),t=e.useState(`toasts`);return W.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function Ag(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||Ep(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{id:e,updates:n}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var jg=Ag();function Mg(e){let t=(0,Qu.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Qm,{...n}),t[2]=n,t[3]=r),r}function Ng(e){let t=(0,Qu.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Og,{"data-slot":`toast-portal`,...n}),t[2]=n,t[3]=r),r}function Pg(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(oh,{"data-slot":`toast-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fg(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-md border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]`,`h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]`,`after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']`,`data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]`,`data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]`,`[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]`,`data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Uh,{"data-slot":`toast`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ig(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Wh,{"data-slot":`toast-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lg(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`text-sm font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(tg,{"data-slot":`toast-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rg(e){let t=(0,Qu.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Af(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(eg,{"data-slot":`toast-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zg({className:e,render:t=(0,G.jsx)(Mf,{variant:`outline`,size:`sm`}),...n}){return(0,G.jsx)(rg,{"data-slot":`toast-action`,render:t,className:Af(`shrink-0`,e),...n})}function Bg({className:e,children:t,render:n=(0,G.jsx)(Mf,{variant:`ghost`,size:`icon-sm`}),...r}){return(0,G.jsx)(ng,{"data-slot":`toast-close`,"aria-label":`Close toast`,render:n,className:Af(`relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground`,e),...r,children:t??(0,G.jsx)(yl,{"aria-hidden":`true`})})}function Vg(e){let t=(0,Qu.c)(7),{type:n}=e,r=null;if(n===`success`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(al,{"aria-hidden":`true`}),t[0]=e):e=t[0],r=e}if(n===`info`){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ll,{"aria-hidden":`true`}),t[1]=e):e=t[1],r=e}if(n===`warning`){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(hl,{"aria-hidden":`true`}),t[2]=e):e=t[2],r=e}if(n===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(xl,{className:`text-destructive`,"aria-hidden":`true`}),t[3]=e):e=t[3],r=e}if(n===`loading`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(pl,{className:`animate-spin`,"aria-hidden":`true`}),t[4]=e):e=t[4],r=e}if(!r)return null;let i;return t[5]===r?i=t[6]:(i=(0,G.jsx)(`span`,{"data-slot":`toast-icon`,className:`shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,children:r}),t[5]=r,t[6]=i),i}function Hg(){let e=(0,Qu.c)(2),{toasts:t}=kg(),n;return e[0]===t?n=e[1]:(n=t.map(Ug),e[0]=t,e[1]=n),n}function Ug(e){return(0,G.jsx)(Fg,{toast:e,children:(0,G.jsxs)(Ig,{children:[(0,G.jsx)(Vg,{type:e.type}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,G.jsx)(Lg,{}),(0,G.jsx)(Rg,{})]}),(0,G.jsx)(zg,{}),(0,G.jsx)(Bg,{})]})},e.id)}function Wg(e){let t=(0,Qu.c)(9),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,toastManager:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?jg:i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(Ng,{children:(0,G.jsx)(Pg,{children:(0,G.jsx)(Hg,{})})}),t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==r||t[7]!==a?(s=(0,G.jsxs)(Mg,{toastManager:a,...r,children:[n,o]}),t[5]=n,t[6]=r,t[7]=a,t[8]=s):s=t[8],s}function Gg(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Kg(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function qg(){return Jg.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var Jg={stubThis:e=>e};function Yg(e){let{id:t}=e;return{...e,id:Kg(t),transports:e.transports,type:e.type}}function Xg(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var Zg=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function Qg({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Zg({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new Zg({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new Zg({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new Zg({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new Zg({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Zg({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new Zg({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Zg({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Xg(t))return new Zg({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Zg({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new Zg({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new Zg({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var $g=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},e_=[`cross-platform`,`platform`];function t_(e){if(e&&!(e_.indexOf(e)<0))return e}async function n_(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!qg())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Kg(t.challenge),user:{...t.user,id:Kg(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Yg)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=$g.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Qg({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){r_(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Gg(e))}catch(e){r_(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Gg(c.getAuthenticatorData())}catch(e){r_(`getAuthenticatorData()`,e)}return{id:o,rawId:Gg(s),response:{attestationObject:Gg(c.attestationObject),clientDataJSON:Gg(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:t_(a.authenticatorAttachment)}}function r_(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function i_(){if(!qg())return a_.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?a_.stubThis(new Promise(e=>e(!1))):a_.stubThis(e.isConditionalMediationAvailable())}var a_={stubThis:e=>e};function o_({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Zg({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Zg({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Xg(t))return new Zg({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Zg({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new Zg({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function s_(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!qg())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(Yg));let a={...t,challenge:Kg(t.challenge),allowCredentials:i},o={};if(n){if(!await i_())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=$g.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw o_({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Gg(u.userHandle)),{id:c,rawId:Gg(l),response:{authenticatorData:Gg(u.authenticatorData),clientDataJSON:Gg(u.clientDataJSON),signature:Gg(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:t_(s.authenticatorAttachment)}}Xr(`MachineSchemaEncodeError`);var X=class extends Xr(`MachineSchemaDecodeError`){},c_=class extends Xr(`InfiniteTransitionError`){},l_=class extends Xr(`StartupError`){},u_=class extends Xr(`ChildAlreadyExistsError`){};Xr(`ProcessLocalError`);var d_=class extends Xr(`StoppedError`){},f_=e=>e instanceof c_||e instanceof X,p_=e=>f_(e)?V(e):or(e),m_=e=>f_(e)||e instanceof l_?e:new l_({cause:M(e)}),h_=e=>e,g_=`~effect/Machine/Target`,__=Symbol(`effect/Machine/TargetSnapshot`),v_=Symbol(`effect/Machine/StateInput`),y_=Symbol(`effect/Machine/HistoryTarget`),b_=Symbol(`effect/Machine/InitialTarget`),x_=Symbol(`effect/Machine/ChoiceTarget`),S_=Symbol(`effect/Machine/NoTarget`),C_=Symbol(`effect/Machine/Declined`),w_=Symbol(`effect/Machine/TargetSelection`),T_=Symbol(`effect/Machine/StateUpdate`),E_=Symbol(`effect/Machine/CombinedTarget`),D_=Symbol(`effect/Machine/SelectedBranch`),O_=(e,t,n,r)=>Object.freeze({[w_]:w_,kind:e,scope:n,path:t,...r===void 0?{}:{updatePath:r}}),k_=O_(`none`,void 0,`local`),A_=e=>L(e,w_),j_=(e,t)=>Object.freeze({[T_]:T_,path:e,value:t}),M_=e=>L(e,T_),N_=(e,t)=>Object.freeze({[E_]:E_,target:e,update:t}),P_=e=>L(e,E_),F_=(e,t,n,r)=>Object.freeze({[D_]:D_,owner:e,branchIndex:t,branchKey:n,result:r}),I_=e=>L(e,D_),L_=Object.freeze({[S_]:S_}),R_=()=>L_,z_=e=>L(e,S_),B_=Object.freeze({[C_]:C_}),V_=()=>B_,H_=e=>L(e,C_),U_=(e,t)=>({[y_]:y_,path:e,parent:t}),W_=e=>L(e,y_),G_=(e,t,n)=>({[b_]:b_,_tag:`InitialTarget`,path:e,value:t,...n===void 0?{}:{values:n}}),K_=e=>L(e,b_),q_=(e,t,n)=>({[x_]:x_,path:e,parent:t,...n===void 0?{}:{values:n}}),J_=e=>L(e,x_),Y_=(e,t)=>{if(!A(t)&&t.type===`history`)return{schema:void 0,output:void 0,annotations:t.annotations,type:`history`,history:t.history===`deep`?`deep`:`shallow`,initial:void 0,states:void 0};if(!A(t)&&t.type===`choice`)return{schema:void 0,output:void 0,annotations:t.annotations,type:`choice`,history:void 0,initial:void 0,states:void 0};if(A(t))return{schema:t,output:void 0,annotations:Oe(t),type:`atomic`,history:void 0,initial:void 0,states:void 0};let n=L(t,`schema`)&&A(t.schema)?t.schema:void 0,r=n===void 0?t.annotations:Oe(n);if(t.type===`parallel`&&!L(t,`states`))throw Error(`Machine.make expected parallel state "${e}" to declare child regions`);if(L(t,`states`)){if(t.type===`final`)throw Error(`Machine.make expected compound state "${e}" to be active`);if(t.type===`parallel`)return{schema:n,output:A(t.output)?t.output:void 0,annotations:r,type:`parallel`,history:void 0,initial:void 0,states:t.states};let i=`initial`in t?t.initial:void 0;if(typeof i!=`string`)throw Error(`Machine.make expected compound state "${e}" to declare an initial child`);return{schema:n,output:void 0,annotations:r,type:`compound`,history:void 0,initial:i,states:t.states}}let i=A(t.output)?t.output:void 0;return t.type===`final`?{schema:n,output:i,annotations:r,type:`final`,history:void 0,initial:void 0,states:void 0}:{schema:n,output:void 0,annotations:r,type:`atomic`,history:void 0,initial:void 0,states:void 0}},X_=e=>{let t=new Map,n=0,r=(e,i)=>{let a=[];for(let o of Object.keys(e)){if(o.includes(`.`))throw Error(`Machine state keys cannot contain ".": "${o}"`);let s=i===void 0||i===``?o:`${i}.${o}`,c=Y_(s,e[o]),l,u,d={path:s,key:o,annotations:c.annotations,order:n};switch(c.type){case`atomic`:l={...d,type:`atomic`,schema:c.schema,output:void 0,history:void 0,parent:i,children:[],initial:void 0};break;case`compound`:l={...d,type:`compound`,schema:c.schema,output:void 0,history:void 0,parent:i,children:[],initial:s===``?c.initial:`${s}.${c.initial}`},u=c.states;break;case`parallel`:l={...d,type:`parallel`,schema:c.schema,output:c.output,history:void 0,parent:i,children:[],initial:void 0},u=c.states;break;case`final`:l={...d,type:`final`,schema:c.schema,output:c.output,history:void 0,parent:i,children:[],initial:void 0};break;case`history`:if(i===void 0)throw Error(`Machine history state "${s}" must belong to a parent state`);l={...d,type:`history`,schema:void 0,output:void 0,history:c.history,parent:i,children:[],initial:void 0};break;case`choice`:if(i===void 0)throw Error(`Machine choice state "${s}" must belong to a parent state`);l={...d,type:`choice`,schema:void 0,output:void 0,history:void 0,parent:i,children:[],initial:void 0}}if(t.set(s,l),n+=1,c.type!==`history`&&c.type!==`choice`&&(a.push(s),u!==void 0)){let e=r(u,s);if(l.type===`compound`){if(!e.includes(l.initial)&&t.get(l.initial)?.type!==`choice`)throw Error(`Machine.make expected compound state "${s}" initial child to exist`);l={...l,children:e}}else if(l.type===`parallel`)l={...l,children:e};else throw Error(`Machine state "${s}" cannot declare child states`);t.set(s,l)}}return a};return{byPath:t,roots:r(e,void 0)}},Z_=e=>typeof e==`object`&&e&&`branches`in e&&Array.isArray(e.branches)?Array.from(e.branches):[],Q_=e=>typeof e==`object`&&e&&`declinable`in e&&e.declinable===!0?`declinable`:`required`,$_=e=>{let t=[];for(let n of e.stateNodes.byPath.values()){let r=h_(e).handlers[n.path];if(r===void 0)continue;if(n.type===`choice`){let e=r.choice;e!==void 0&&t.push({source:n.path,trigger:{type:`choice`},reenter:!1,acceptance:`required`,branches:Z_(e)});continue}for(let e of Reflect.ownKeys(r.on??{})){let i=r.on?.[e];t.push({source:n.path,trigger:{type:`event`,event:e},reenter:L(i,`reenter`)&&i.reenter===!0,acceptance:Q_(i),branches:Z_(i)})}r.always!==void 0&&t.push({source:n.path,trigger:{type:`always`},reenter:!1,acceptance:Q_(r.always),branches:Z_(r.always)}),r.onDone!==void 0&&t.push({source:n.path,trigger:{type:`done`},reenter:!1,acceptance:Q_(r.onDone),branches:Z_(r.onDone)});let i=r.invoke===void 0?[]:Array.isArray(r.invoke)?r.invoke:[r.invoke];for(let e of i){let r=`child`in e?String(e.child.id):String(e.id);for(let i of[`element`,`done`,`failure`,`snapshot`]){let a=i===`element`?e.onElement:i===`done`?e.onDone:i===`failure`?e.onFailure:e.onSnapshot;a!==void 0&&t.push({source:n.path,trigger:{type:`invoke`,id:r,outcome:i},reenter:typeof a==`object`&&!!a&&a.reenter===!0,acceptance:Q_(a),branches:Z_(a)})}}}return t},ev=(e,t,n)=>({[g_]:g_,[__]:n?.snapshot,path:e,value:t,values:n?.values}),tv=e=>L(e,g_),nv=e=>({[v_]:v_,input:e}),rv=e=>L(e,v_),iv=e=>L(e,`path`)&&L(e,`value`),av=(e,t,n)=>{if(e.path===t)return nn(e);if(e.path!==``&&!t.startsWith(`${e.path}.`))return Qt();if(n!==void 0&&e.value!==void 0&&(n[e.path]=e.value),L(e,`state`)&&iv(e.state))return av(e.state,t,n);if(L(e,`states`)&&typeof e.states==`object`&&e.states!==null){for(let r of Object.values(e.states))if(iv(r)){let e=av(r,t,n);if(O(e))return e}}return Qt()},Z=(e,t)=>{let n=e.stateNodes.byPath.get(t);if(n===void 0)throw Error(`Machine expected state path "${t}" to exist`);return n},ov=e=>{if(e.schema===void 0)throw Error(`Machine state "${e.path}" has no value schema`);return e.schema},sv=new WeakMap,cv=Symbol(`effect/Machine/EventConstruction`),lv=new WeakMap,uv=new WeakMap,dv=new WeakMap,fv=e=>{let t=e,n=uv.get(t);if(n!==void 0)return n;let r=Ce(Xt(e));return uv.set(t,r),r},pv=e=>{let t=e,n=dv.get(t);if(n!==void 0)return n;let r=Be(Xt(e));return dv.set(t,r),r},mv=Symbol.for(`effect/Machine/protocol`),hv=e=>{let t=e[mv];if(t===void 0)throw Error(`Machine protocol is unavailable`);return t},gv=(e,t)=>{Object.defineProperty(e,mv,{value:t,enumerable:!1})},_v=e=>{let t=new Set,n=e=>{let r=e;if(!t.has(r)&&(t.add(r),L(e,`cases`)&&typeof e.cases==`object`&&e.cases!==null))for(let t of Object.values(e.cases))(typeof t==`object`&&t||typeof t==`function`)&&L(t,`make`)&&n(t)};for(let t of e)n(t);return t},vv=(e,t)=>{let n=sv.get(e);if(n===void 0)throw Error(`Machine expected an event protocol created with Machine.events, Machine.internalEvents, or Machine.emittedEvents`);if(t!==void 0&&n.kind!==t)throw Error(`Machine expected a ${t} event protocol`);return n},yv=e=>vv(e.events,`public`).schemas,bv=e=>vv(e.internalEvents,`internal`).schemas,xv=e=>vv(e.emittedEvents,`emitted`).schemas,Sv=e=>{let t=yv(e),n=bv(e),r=xv(e),i=new Set(Reflect.ownKeys(e.events));for(let t of Reflect.ownKeys(e.internalEvents))if(i.has(t))throw Error(`Public and internal machine event tags must be disjoint: ${String(t)}`);let a=[...t,...n];gv(e,{event:Ye(a),emit:Ye(r),eventConstructors:_v(a),emissionConstructors:_v(r)})},Cv=(e,t)=>gv(t,hv(e)),wv=e=>L(e,`_tag`)?String(e._tag):void 0,Tv=(e,t,n,r)=>{let i=r,a;if(typeof r==`object`&&r)try{i={...r}}catch(e){i=void 0,a=e}let o={[cv]:cv,_tag:n};return lv.set(o,{kind:e,schema:t,input:i,...a===void 0?{}:{inputError:a}}),Object.freeze(o)},Ev=e=>typeof e==`object`&&!!e&&lv.has(e),Dv=(e,t)=>{let n=[],r=e=>{if(L(e,`cases`)&&typeof e.cases==`object`&&e.cases!==null)for(let t of Reflect.ownKeys(e.cases))r(Reflect.get(e.cases,t));else if(L(e,`members`)&&Array.isArray(e.members))for(let t of e.members)r(t);else n.push(e)};for(let e of t)r(e);let i=Object.create(null),a=e=>In(e)?typeof e.literal==`string`||typeof e.literal==`number`?[e.literal]:[]:yr(e)?[e.symbol]:o(e)?e.enums.map(([,e])=>e):wn(e)?e.types.flatMap(a):hn(e)?a(e.thunk()):[],s=e=>{let t=mi(e.ast);if(Ar(t)){let e=t.propertySignatures.find(({name:e})=>e===`_tag`),n=e===void 0?[]:a(e.type);if(n.length>0)return n}try{return Ye([e]).pipe(tn(`_tag`)).discriminants}catch{return[]}};for(let t of n){let n=s(t);if(n.length!==0)for(let r of n){if(L(i,r))throw Error(`Duplicate machine event constructor tag: ${String(r)}`);Object.defineProperty(i,r,{value:(...n)=>Tv(e,t,r,n.length===0?{}:n[0]),enumerable:!0})}}return i},Ov=(e,t)=>{let n=Object.freeze(Array.from(t)),r=Dv(e,n);return sv.set(r,{kind:e,schemas:n}),Object.freeze(r)},kv=(e,t,n,r)=>fv(t)(n).pipe(bn(t=>new X({machineId:e.id,boundary:r.boundary,cause:t,...r.state===void 0?{}:{state:r.state},...r.event===void 0?{}:{event:r.event}}))),Av=(e,t,n,r)=>{let i=pv(t)(n);if(oe(i))throw new X({machineId:e.id,boundary:r.boundary,cause:i.failure,...r.state===void 0?{}:{state:r.state},...r.event===void 0?{}:{event:r.event}});return i.success},jv=(e,t,n,r)=>{try{return t.make(n)}catch(t){let n=t instanceof Error?t.cause:void 0;throw new X({machineId:e.id,boundary:r.boundary,cause:Nt(t)?t:L(n,`~effect/SchemaIssue/Issue`)?new te(n):M(t),...r.state===void 0?{}:{state:r.state},...r.event===void 0?{}:{event:r.event}})}},Mv=(e,t,n)=>new X({machineId:e.id,boundary:n,event:String(t._tag),cause:M(Error(`Constructed ${n} schema does not belong to the machine ${n} protocol`))}),Nv=(e,t)=>{if(t.inputError!==void 0)throw t.inputError;return typeof t.input==`object`&&t.input!==null?{...t.input,_tag:e._tag}:{_tag:e._tag}},Pv=(e,t,n,r)=>new X({machineId:e.id,boundary:n,event:String(t._tag),cause:M(r)}),Fv=(e,t,n,r)=>{let i=lv.get(n),a=r===`event`?t.eventConstructors:t.emissionConstructors;return i===void 0||(r===`emission`?i.kind!==`emitted`:i.kind===`emitted`)||!a.has(i.schema)?V(Mv(e,n,r)):Rt({try:()=>Nv(n,i),catch:t=>Pv(e,n,r,t)}).pipe(z(t=>i.schema.makeEffect(t).pipe(bn(t=>new X({machineId:e.id,boundary:r,event:String(n._tag),cause:new te(t)})))))},Iv=(e,t,n,r)=>{let i=lv.get(n),a=r===`event`?t.eventConstructors:t.emissionConstructors;if(i===void 0||(r===`emission`?i.kind!==`emitted`:i.kind===`emitted`)||!a.has(i.schema))throw Mv(e,n,r);let o;try{o=Nv(n,i)}catch(t){throw Pv(e,n,r,t)}return jv(e,i.schema,o,{boundary:r,event:String(n._tag)})},Lv=(e,t)=>{let n=hv(e);if(Ev(t))return Fv(e,n,t,`event`);let r=wv(t);return kv(e,n.event,t,r===void 0?{boundary:`event`}:{boundary:`event`,event:r})},Rv=(e,t)=>{let n=hv(e);if(Ev(t))return Iv(e,n,t,`event`);let r=wv(t);return Av(e,n.event,t,r===void 0?{boundary:`event`}:{boundary:`event`,event:r})},zv=(e,t)=>{let n=hv(e);if(Ev(t))return Fv(e,n,t,`emission`);let r=wv(t);return kv(e,n.emit,t,r===void 0?{boundary:`emission`}:{boundary:`emission`,event:r})},Bv=(e,t)=>{let n=hv(e);if(Ev(t))return Iv(e,n,t,`emission`);let r=wv(t);return Av(e,n.emit,t,r===void 0?{boundary:`emission`}:{boundary:`emission`,event:r})},Vv=(e,t,n)=>Av(e,t,n,{boundary:`input`}),Hv=(e,t,n)=>rv(n)?ov(t).makeEffect(n.input).pipe(bn(n=>new X({machineId:e.id,boundary:`state`,state:t.path,cause:new te(n)}))):kv(e,ov(t),n,{boundary:`state`,state:t.path}),Uv=(e,t,n)=>rv(n)?jv(e,ov(t),n.input,{boundary:`state`,state:t.path}):Av(e,ov(t),n,{boundary:`state`,state:t.path}),Wv=(e,t,n)=>t.output===void 0?P(n):kv(e,t.output,n,{boundary:`output`,state:t.path}),Gv=(e,t,n)=>t.output===void 0?n:Av(e,t.output,n,{boundary:`output`,state:t.path}),Kv=(e,t)=>{let n=new Set(ny(e,t.parent)),r=n=>{let i=Z(e,n);if(i.type===`compound`){let e=i.children.filter(e=>t.active.has(e));if(e.length!==1)throw Error(`Machine history expected compound state "${n}" to retain one active child`);t.mode===`deep`&&r(e[0])}else if(i.type===`parallel`)for(let e of i.children){if(!t.active.has(e))throw Error(`Machine history expected parallel state "${n}" to retain region "${e}"`);t.mode===`deep`&&r(e)}};r(t.parent);for(let r of t.active){if(!n.has(r)&&!ty(r,t.parent))throw Error(`Machine history contains state "${r}" outside parent "${t.parent}"`);if(t.mode===`shallow`&&ey(r,t.parent)&&Z(e,r).parent!==t.parent)throw Error(`Machine shallow history contains deep descendant "${r}"`)}},qv=(e,t)=>{let n=new Map;for(let[r,i]of Object.entries(t.history??{})){let t=Z(e,r);if(t.type!==`history`||t.parent===void 0||t.history!==i.mode)throw Error(`Machine snapshot contains invalid history record "${r}"`);let a=new Set,o=new Map;for(let n of i.active){if(a.has(n))throw Error(`Machine snapshot contains invalid remembered state "${n}"`);let r=Z(e,n);if(r.type===`history`||r.type===`choice`||!(ty(n,t.parent)||ny(e,t.parent).includes(n)))throw Error(`Machine snapshot contains invalid remembered value for "${n}"`);a.add(n);let s=Object.prototype.hasOwnProperty.call(i.values,n);if(r.schema===void 0){if(s)throw Error(`Machine snapshot contains a value for structural state "${n}"`)}else{if(!s)throw Error(`Machine snapshot omits remembered value for "${n}"`);o.set(n,Uv(e,r,i.values[n]))}}if(!a.has(t.parent)||Object.keys(i.values).length!==o.size)throw Error(`Machine snapshot contains incomplete history record "${r}"`);n.set(r,{mode:i.mode,parent:t.parent,active:a,values:o}),Kv(e,n.get(r))}return n},Jv=hi(function*(e,t){let n=new Map;for(let[r,i]of Object.entries(t.history??{})){let t=e.stateNodes.byPath.get(r);if(t===void 0||t.type!==`history`||t.parent===void 0||t.history!==i.mode)return yield*V(new X({machineId:e.id,boundary:`history`,state:r,cause:M(Error(`Machine snapshot contains invalid history record "${r}"`))}));let a=new Set,o=new Map;for(let n of i.active){let r=e.stateNodes.byPath.get(n);if(a.has(n)||r===void 0||r.type===`history`||r.type===`choice`||!(ty(n,t.parent)||ny(e,t.parent).includes(n)))return yield*V(new X({machineId:e.id,boundary:`history`,state:n,cause:M(Error(`Machine snapshot contains invalid remembered state "${n}"`))}));a.add(n);let s=Object.prototype.hasOwnProperty.call(i.values,n);if(r.schema===void 0){if(s)return yield*V(new X({machineId:e.id,boundary:`history`,state:n,cause:M(Error(`Machine snapshot contains a value for structural state "${n}"`))}))}else{if(!s)return yield*V(new X({machineId:e.id,boundary:`history`,state:n,cause:M(Error(`Machine snapshot omits remembered value for "${n}"`))}));o.set(n,yield*kv(e,ov(r),i.values[n],{boundary:`history`,state:n}))}}if(!a.has(t.parent)||Object.keys(i.values).length!==o.size)return yield*V(new X({machineId:e.id,boundary:`history`,state:r,cause:M(Error(`Machine snapshot contains incomplete history record "${r}"`))}));n.set(r,{mode:i.mode,parent:t.parent,active:a,values:o});try{Kv(e,n.get(r))}catch(t){return yield*V(new X({machineId:e.id,boundary:`history`,state:r,cause:M(t)}))}}return n}),Yv=(e,t)=>{let n={};for(let[r,i]of t){let t=Array.from(i.active).sort((t,n)=>iy(e,t,n));n[r]={mode:i.mode,active:t,values:Object.fromEntries(i.values)}}return n},Xv=(e,t)=>({...e,machineReferences:{self:t.self,parent:t.parent}}),Zv=e=>e.machineReferences,Qv=new WeakMap,$v=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ey=(e,t)=>e!==t&&(t===``||e.startsWith(`${t}.`)),ty=(e,t)=>e===t||ey(e,t),ny=(e,t)=>{let n=Qv.get(e.stateNodes);n===void 0&&(n=new Map,Qv.set(e.stateNodes,n));let r=n.get(t);if(r!==void 0)return r;let i=[],a=t;for(;a!==void 0;)i.unshift(a),a=Z(e,a).parent;return n.set(t,i),i},ry=(e,t)=>ny(e,t).length,iy=(e,t,n)=>Z(e,t).order-Z(e,n).order,ay=(e,t,n)=>Z(e,n).children.some(e=>t.active.has(e)),oy=(e,t)=>{let n=Array.from(t.active).filter(n=>!ay(e,t,n)).sort((t,n)=>iy(e,t,n));if(n.length===0)throw Error(`Machine expected an active leaf state`);return n},sy=(e,t)=>oy(e,t)[0],cy=(e,t,n)=>{let r=oy(e,t).filter(e=>ty(e,n));if(r.length===0)throw Error(`Machine expected state "${n}" to have an active leaf state`);return r[0]},ly=(e,t)=>{for(let n of t.active)if(Z(e,n).parent===void 0)return n;throw Error(`Machine expected an active root state`)},uy=(e,t,n)=>{let r={},i=ny(e,n);for(let e=0;e<i.length-1;e++){let n=i[e];t.values.has(n)&&(r[n]=t.values.get(n))}return r},dy=(e,t,n)=>{let r=Z(e,n).parent;return r===void 0?void 0:t.values.get(r)},fy=(e,t)=>{let n=r=>t.active.has(r)?[r,...Z(e,r).children.flatMap(n)]:[];return e.stateNodes.roots.flatMap(n)},py=(e,t,n)=>{let r=Z(e,n),i={path:n,value:t.values.get(n)};if(r.type===`compound`){let a=r.children.find(e=>t.active.has(e));if(a===void 0)throw Error(`Machine expected compound state "${n}" to have an active child`);i.state=py(e,t,a)}if(r.type===`parallel`){let a={};for(let i of r.children){if(!t.active.has(i))throw Error(`Machine expected parallel state "${n}" to have active child region "${i}"`);let r=Z(e,i);a[r.key]=py(e,t,i)}i.states=a}return i},my=(e,t)=>{let n=py(e,t,ly(e,t)),r=Array.from(t.outputs).map(([e,t])=>({path:e,output:t}));return r.length>0&&(n.completed=r),t.history.size>0&&Object.assign(n,{history:Yv(e,t.history)}),n},hy=(e,t,n)=>{let r=py(e,t,n);return t.history.size>0&&Object.assign(r,{history:Yv(e,t.history)}),r},gy=(e,t,n)=>{if(!L(n,`state`)||!iv(n.state))throw Error(`Machine expected compound snapshot "${t.path}" to include an active child state`);let r=Z(e,String(n.state.path));if(r.parent!==t.path)throw Error(`Machine expected snapshot "${r.path}" to be a child of "${t.path}"`);return n.state},_y=(e,t)=>{if(!L(t,`states`)||typeof t.states!=`object`||t.states===null)throw Error(`Machine expected parallel snapshot "${e.path}" to include active child regions`);return t.states},vy=(e,t,n,r)=>{let i=Z(e,n),a=r[i.key];if(!$v(r,i.key)||!iv(a))throw Error(`Machine expected parallel snapshot "${t.path}" to include region "${i.key}"`);let o=Z(e,String(a.path));if(o.path!==i.path)throw Error(`Machine expected snapshot "${o.path}" to be region "${i.path}"`);return a},yy=(e,t)=>{let n=new Set,r=new Map,i=t.completed,a=t=>{let i=Z(e,String(t.path));if(n.add(i.path),i.schema===void 0){if(t.value!==void 0)throw Error(`Machine structural snapshot "${i.path}" cannot contain a value`)}else r.set(i.path,Uv(e,i,t.value));if(i.type===`compound`&&a(gy(e,i,t)),i.type===`parallel`){let n=_y(i,t);for(let t of i.children)a(vy(e,i,t,n))}};a(t);let o=new Map;if(i!==void 0)for(let{output:e,path:t}of i)n.has(t)&&o.set(t,e);return{active:n,values:r,outputs:o,history:qv(e,t)}},by=(e,t)=>yy(e,t),xy=(e,t)=>{try{return yy(e,t)}catch(t){throw t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:M(t)})}},Sy=hi(function*(e,t){let n=new Set,r=new Map,i=t.completed,a=hi(function*(t){let i=Z(e,String(t.path));if(n.add(i.path),i.schema===void 0){if(t.value!==void 0)throw Error(`Machine structural snapshot "${i.path}" cannot contain a value`)}else r.set(i.path,yield*Hv(e,i,t.value));if(i.type===`compound`&&(yield*a(gy(e,i,t))),i.type===`parallel`){let n=_y(i,t);for(let t of i.children)yield*a(vy(e,i,t,n))}});yield*a(t);let o=new Map;if(i!==void 0)for(let{output:e,path:t}of i)n.has(t)&&o.set(t,e);return{active:n,values:r,outputs:o,history:yield*Jv(e,t)}}),Cy=(e,t)=>Sy(e,t).pipe(Ln(t=>{if(rn(t))return En(si(t,t=>t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:$t(t)})));let n=qt(t);return O(n)&&n.value instanceof X?V(n.value):V(new X({machineId:e.id,boundary:`configuration`,cause:t}))})),wy=(e,t,n,r)=>{if(r.length===0)return n;let i=new Set(r),a=new Map(n.history);for(let n of e.stateNodes.byPath.values()){if(n.type!==`history`||n.parent===void 0||!i.has(n.parent))continue;let r=n.history===`deep`?`deep`:`shallow`,o=new Set;for(let r of ny(e,n.parent))t.active.has(r)&&o.add(r);for(let i of t.active)(i===n.parent||r===`deep`&&ey(i,n.parent)||r===`shallow`&&Z(e,i).parent===n.parent)&&o.add(i);let s=new Map;for(let e of o)t.values.has(e)&&s.set(e,t.values.get(e));a.set(n.path,{mode:r,parent:n.parent,active:o,values:s})}return{active:n.active,values:n.values,outputs:n.outputs,history:a}},Ty=(e,t)=>e.history.get(t),Ey=(e,t,n)=>{let r=new Set(n.active),i=new Map(n.values),a=new Map,o=ny(e,n.parent),s=new Set(o);for(let c of o){let o=Z(e,c);if(o.type===`parallel`){for(let e of o.children)if(!(s.has(e)||n.active.has(e)||!t.active.has(e)))for(let n of t.active)ty(n,e)&&(r.add(n),t.values.has(n)&&i.set(n,t.values.get(n)),t.outputs.has(n)&&a.set(n,t.outputs.get(n)))}}return{active:r,values:i,outputs:a,history:t.history}};hi(function*(e,t,n,r,i){let a=Z(e,n),o=new Set,s=new Map,c=new Map,l=ny(e,a.path),u=new Set(l);for(let n of l){let c=Z(e,n);if(o.add(n),c.schema===void 0){if((n===a.path?r:i!==void 0&&$v(i,n)?i[n]:void 0)!==void 0)throw Error(`Machine structural target "${n}" cannot contain a value`)}else if(n===a.path)s.set(n,yield*Hv(e,c,r));else if(i!==void 0&&$v(i,n))s.set(n,yield*Hv(e,c,i[n]));else if(t.values.has(n))s.set(n,t.values.get(n));else throw Error(`Machine target "${a.path}" requires a value for ancestor state "${n}"`)}for(let n of l){let r=Z(e,n);if(r.type===`parallel`){for(let e of r.children)if(!u.has(e)&&t.active.has(e))for(let n of t.active)ty(n,e)&&(o.add(n),t.values.has(n)&&s.set(n,t.values.get(n)),t.outputs.has(n)&&c.set(n,t.outputs.get(n)))}}if(a.type===`compound`||a.type===`parallel`)throw Error(`Machine target "${a.path}" must include an active child state`);return{active:o,values:s,outputs:c,history:t.history}}),hi(function*(e,t,n,r){let i=yield*Sy(e,n),a=new Set(i.active),o=new Map(i.values),s=new Map(i.outputs),c=ny(e,String(n.path)),l=new Set(c);for(let i of c.slice(0,-1)){let s=Z(e,i);if(a.add(i),s.schema===void 0){if(r!==void 0&&$v(r,i))throw Error(`Machine structural target "${i}" cannot contain a value`)}else if(r!==void 0&&$v(r,i))o.set(i,yield*Hv(e,s,r[i]));else if(t.values.has(i))o.set(i,t.values.get(i));else throw Error(`Machine target "${n.path}" requires a value for ancestor state "${i}"`)}for(let n of c.slice(0,-1)){let i=Z(e,n);if(i.type===`parallel`){for(let n of i.children)if(!l.has(n)){if(t.active.has(n))for(let e of t.active)ty(e,n)&&(a.add(e),t.values.has(e)&&o.set(e,t.values.get(e)),t.outputs.has(e)&&s.set(e,t.outputs.get(e)));else if(r!==void 0&&$v(r,n))for(let[t,i]of Object.entries(r)){if(!ty(t,n))continue;let r=Z(e,t);if(a.add(t),r.schema===void 0)throw Error(`Machine structural target "${t}" cannot contain a value`);o.set(t,yield*Hv(e,r,i))}}}}return{active:a,values:o,outputs:s,history:new Map([...t.history,...i.history])}});var Dy=(e,t,n,r,i,a=!1)=>{let o=Z(e,n),s=new Set,c=new Map,l=new Map,u=ny(e,o.path),d=new Set(u);for(let n of u){let a=Z(e,n);if(s.add(n),a.schema===void 0){if((n===o.path?r:i!==void 0&&$v(i,n)?i[n]:void 0)!==void 0)throw Error(`Machine structural target "${n}" cannot contain a value`)}else if(n===o.path)c.set(n,Uv(e,a,r));else if(i!==void 0&&$v(i,n))c.set(n,Uv(e,a,i[n]));else if(t.values.has(n))c.set(n,t.values.get(n));else throw Error(`Machine target "${o.path}" requires a value for ancestor state "${n}"`)}for(let n of u){let r=Z(e,n);if(r.type===`parallel`&&n!==o.path){for(let e of r.children)if(!d.has(e)&&t.active.has(e))for(let n of t.active)ty(n,e)&&(s.add(n),t.values.has(n)&&c.set(n,t.values.get(n)),t.outputs.has(n)&&l.set(n,t.outputs.get(n)))}}if(!a&&(o.type===`compound`||o.type===`parallel`))throw Error(`Machine target "${o.path}" must include an active child state`);return{active:s,values:c,outputs:l,history:t.history}},Oy=(e,t,n)=>{let r=Dy(e,t,n.path,n.value,n.values,!0);if(n.children===void 0)return r;let i=new Set(r.active),a=new Map(r.values);for(let[t,r]of n.children){let n=Z(e,t);i.add(t),n.schema!==void 0&&a.set(t,Uv(e,n,r))}return{...r,active:i,values:a}},ky=(e,t,n,r)=>{let i=yy(e,n),a=new Set(i.active),o=new Map(i.values),s=new Map(i.outputs),c=ny(e,String(n.path)),l=new Set(c);for(let i of c.slice(0,-1)){let s=Z(e,i);if(a.add(i),s.schema===void 0){if(r!==void 0&&$v(r,i))throw Error(`Machine structural target "${i}" cannot contain a value`)}else if(r!==void 0&&$v(r,i))o.set(i,Uv(e,s,r[i]));else if(t.values.has(i))o.set(i,t.values.get(i));else throw Error(`Machine target "${n.path}" requires a value for ancestor state "${i}"`)}for(let n of c.slice(0,-1)){let i=Z(e,n);if(i.type===`parallel`){for(let n of i.children)if(!l.has(n)){if(t.active.has(n))for(let e of t.active)ty(e,n)&&(a.add(e),t.values.has(e)&&o.set(e,t.values.get(e)),t.outputs.has(e)&&s.set(e,t.outputs.get(e)));else if(r!==void 0&&$v(r,n))for(let[t,i]of Object.entries(r)){if(!ty(t,n))continue;let r=Z(e,t);if(a.add(t),r.schema===void 0)throw Error(`Machine structural target "${t}" cannot contain a value`);o.set(t,Uv(e,r,i))}}}}return{active:a,values:o,outputs:s,history:new Map([...t.history,...i.history])}},Ay=(e,t,n)=>{if(tv(n)){let r=n[__];if(r!==void 0){if(String(r.path)!==String(n.path))throw Error(`Machine expected target snapshot path to be "${n.path}"`);return ky(e,t,r,n.values)}return Dy(e,t,n.path,n.value,n.values)}if(iv(n)){let r=xy(e,n);return{...r,history:new Map([...t.history,...r.history])}}throw Error(`Machine expected transition target to be a snapshot or target builder result`)},jy=(e,t)=>h_(e).handlers[t],My=(e,t,n)=>Z(e,n).children.find(e=>t.active.has(e)),Ny=(e,t)=>Z(e,t).type===`final`,Py=(e,t)=>jy(e,t)?.onDone!==void 0,Fy=(e,t,n)=>{if(!t.active.has(n))return!1;let r=Z(e,n);if(r.type===`compound`){let r=My(e,t,n);return r!==void 0&&(n===``?!Py(e,r)&&Fy(e,t,r):Ny(e,r))}if(r.type===`parallel`){for(let n of r.children)if(!Fy(e,t,n))return!1;return!0}return Ny(e,n)},Iy=(e,t)=>{let n=ly(e,t);return Fy(e,t,n)&&!Py(e,n)},Ly=(e,t,n)=>e.has(t)?{path:t,output:e.get(t),isNew:!1}:(e.set(t,n),{path:t,output:n,isNew:!0}),Ry=hi(function*(e,t,n,r,i){let a=Z(e,n),o=jy(e,n)?.output?.({state:t.values.get(n),containingState:dy(e,t,n),ancestors:uy(e,t,n),event:r,outputs:i});return yield*Wv(e,a,o)}),zy=hi(function*(e,t,n,r,i,a){if(!t.active.has(n))return;if(i.has(n))return{path:n,output:i.get(n),isNew:!1};let o=Z(e,n);if(o.type===`compound`){let o=My(e,t,n);if(o===void 0||(n===``?Py(e,o):!Ny(e,o)))return;let s=yield*zy(e,t,o,r,i,a);if(s===void 0)return;let c=Ly(i,n,s.output);return c.isNew&&a.push(c),c}if(o.type===`parallel`){let s={},c=!0;for(let n of o.children){let o=yield*zy(e,t,n,r,i,a);o===void 0?c=!1:s[Z(e,n).key]=o.output}if(!c)return;let l=Ly(i,n,yield*Ry(e,t,n,r,s));return l.isNew&&a.push(l),l}if(!Ny(e,n))return;let s=Ly(i,n,yield*Ry(e,t,n,r));return s.isNew&&a.push(s),s}),By=hi(function*(e,t,n){let r=new Map(t.outputs),i=[],a={active:t.active,values:t.values,outputs:r,history:t.history};for(let t of Array.from(a.active).sort((t,n)=>{let r=ry(e,n)-ry(e,t);return r===0?iy(e,t,n):r}))yield*zy(e,a,t,n,r,i);return{configuration:a,completions:i}}),Vy=(e,t,n,r,i)=>{let a=Z(e,n),o=jy(e,n)?.output?.({state:t.values.get(n),containingState:dy(e,t,n),ancestors:uy(e,t,n),event:r,outputs:i});return Gv(e,a,o)},Hy=(e,t,n,r,i,a)=>{if(!t.active.has(n))return;if(i.has(n))return{path:n,output:i.get(n),isNew:!1};let o=Z(e,n);if(o.type===`compound`){let o=My(e,t,n);if(o===void 0||(n===``?Py(e,o):!Ny(e,o)))return;let s=Hy(e,t,o,r,i,a);if(s===void 0)return;let c=Ly(i,n,s.output);return c.isNew&&a.push(c),c}if(o.type===`parallel`){let s={},c=!0;for(let n of o.children){let o=Hy(e,t,n,r,i,a);o===void 0?c=!1:s[Z(e,n).key]=o.output}if(!c)return;let l=Ly(i,n,Vy(e,t,n,r,s));return l.isNew&&a.push(l),l}if(!Ny(e,n))return;let s=Ly(i,n,Vy(e,t,n,r));return s.isNew&&a.push(s),s},Uy=(e,t,n)=>{let r=new Map(t.outputs),i=[],a={active:t.active,values:t.values,outputs:r,history:t.history};for(let t of Array.from(a.active).sort((t,n)=>{let r=ry(e,n)-ry(e,t);return r===0?iy(e,t,n):r}))Hy(e,a,t,n,r,i);return{configuration:a,completions:i}},Wy=e=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Machine construction must be an object`);return e},Gy=(e,t)=>{if(t.decoded!==void 0&&typeof t.decoded!=`boolean`)throw Error(`Machine decoded construction flag must be a boolean`);if(e.schema===void 0){if(Object.hasOwn(t,`data`)||Object.hasOwn(t,`decoded`))throw Error(`Machine structural state "${e.path}" cannot construct data`)}else{if(t.decoded===!0){if(!Object.hasOwn(t,`data`))throw Error(`Machine decoded construction requires data`);return t.data}return nv(Object.hasOwn(t,`data`)?t.data:{})}},Ky=(e,t,n={},r)=>{let i=e.byPath.get(t);if(i?.type===`atomic`||i?.type===`final`){let e=Wy(n);if(Reflect.ownKeys(e).some(e=>e!==`data`&&e!==`decoded`))throw Error(`Machine leaf construction accepts only data and decoded`);return ev(t,Gy(i,e))}let a=new Map,o=(t,n)=>{let i=Wy(n);if(Reflect.ownKeys(i).some(e=>e!==`data`&&e!==`decoded`&&e!==`states`))throw Error(`Machine state construction accepts only data, decoded, and states`);let s=e.byPath.get(t);if(s===void 0||s.type===`history`)throw Error(`Machine invalid construction state "${t}"`);let c=Gy(s,i);if(Object.hasOwn(i,`states`)){if(s.type!==`compound`&&s.type!==`parallel`)throw Error(`Machine state "${t}" has no child construction`);let n=Wy(i.states),c=Reflect.ownKeys(n),l=s.children.filter(t=>e.byPath.get(t)?.type!==`history`);if(s.type===`compound`?c.length!==1:c.length!==l.length&&(c.length!==1||r===void 0||r!==t&&!r.startsWith(`${t}.`)))throw Error(`Machine explicit states for "${t}" must select ${s.type===`compound`?`one child`:`every region`}`);for(let r of c){let i=t===``?String(r):`${t}.${String(r)}`;if(typeof r!=`string`||e.byPath.get(i)?.parent!==t||e.byPath.get(i)?.type===`history`)throw Error(`Machine unknown child "${String(r)}"`);a.set(i,o(i,n[r]))}}return c},s=o(t,n),c=new Map(a);c.set(t,s);let l=t,u=Wy(n);for(;u.states!==void 0;){let t=e.byPath.get(l),n=Wy(u.states),i=Object.keys(n);if(i.length!==1||t.type===`parallel`&&(r===void 0||r!==l&&!r.startsWith(`${l}.`)))break;let a=i[0];l=l===``?a:`${l}.${a}`,u=Wy(n[a])}let d=e.byPath.get(l),f=c.get(l),p=Object.fromEntries([...c].filter(([e,t])=>t!==void 0&&e!==l&&!e.startsWith(`${l}.`)));if(d.type===`choice`)return q_(l,d.parent??``,p);if(d.type===`atomic`||d.type===`final`)return ev(l,f,{values:p});let m=new Map([...a].filter(([e])=>e.startsWith(`${l}.`)));return{...G_(l,f,p),...m.size===0?{}:{children:m}}},qy=(e,t,n)=>{let r=Wy(n);if(Reflect.ownKeys(r).some(e=>e!==`data`&&e!==`decoded`))throw Error(`Machine update construction accepts only data and decoded`);let i=e.byPath.get(t);if(i?.schema===void 0)throw Error(`Machine update requires a valued state`);return j_(t,Gy(i,r))},Jy=(e,t,n=``)=>{let r=Wy(t),i=e.byPath.get(n);Ky(e,n,r);let a=Gy(i,r);if(i.type===`choice`)return q_(n,i.parent);if(i.type===`atomic`||i.type===`final`)return{path:n,value:a};if(r.states===void 0)throw Error(`Machine history fallback requires a complete explicit tree`);let o=Wy(r.states),s=Object.fromEntries(Object.entries(o).map(([t,r])=>[t,Jy(e,r,n===``?t:`${n}.${t}`)]));return i.type===`parallel`?{path:n,value:a,states:s}:{path:n,value:a,state:Object.values(s)[0]}},Yy=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(t);return e},Xy=`root`,Zy=e=>{let t=new Map,n=(e,r)=>{let i=!A(e)&&`type`in e?e.type:void 0;if(t.set(r,i===`history`||i===`choice`?i:`state`),!A(e)&&`states`in e)for(let[t,i]of Object.entries(e.states))n(i,r===``?t:`${r}.${t}`)};if(n(e.node,``),t.has(`root`))throw Error(`Machine top-level state name "${Xy}" is reserved for the root`);return t},Qy=(e,t)=>{let n=Zy(e),r=t.input!==void 0,i=new Map;for(let e of[`effects`,`streams`,`timers`,`logic`,`children`])if(t[e]!==void 0)for(let[n,r]of Object.entries(Yy(t[e],`Machine ${e} must be a source map`))){if(i.has(n))throw Error(`Machine source name "${n}" is registered more than once`);i.set(n,Object.freeze({kind:e,value:r}))}let a=new Map;if(t.branches!==void 0)for(let[o,s]of Object.entries(Yy(t.branches,`Machine branches must be a map`))){let t=Yy(s,`Machine branches "${o}" must be a branch record`);for(let e of Reflect.ownKeys(t)){if(typeof e!=`string`)throw Error(`Machine branches cannot use symbol keys`);if(e.length===0||String(Number(e))===e)throw Error(`Machine branches require non-index string branch keys`)}let c=Object.entries(t);if(c.length===0)throw Error(`Machine branches "${o}" requires a branch`);a.set(o,Object.freeze(Object.fromEntries(c.map(([t,s])=>{let c={...Yy(s,`Machine branch "${o}.${t}" must be a declaration`)};for(let e of Reflect.ownKeys(c))if(typeof e!=`string`||![`target`,`update`,`history`,`none`,`initialize`,`title`].includes(e))throw Error(`Machine branch "${o}.${t}" contains an unknown declaration field`);if(c.initialize!==void 0&&c.initialize!==!0)throw Error(`Machine branch "${o}.${t}" declares initialize: true; its resolver supplies input`);if(c.title!==void 0&&(typeof c.title!=`string`||c.title.length===0))throw Error(`Machine branch title must be a non-empty string`);return eb({root:e,input:r,paths:n,sources:i,branches:a},c),[t,Object.freeze(c)]}))))}return{root:e,input:r,paths:n,sources:i,branches:a}},$y=(e,t)=>{let n=e===`root`?``:typeof e==`string`&&e!==``?e:void 0,r=n===void 0?void 0:t.paths.get(n);if(n===void 0||r===void 0)throw Error(`Machine target ${String(e)} is not a declared state path`);return{path:n,kind:r}},eb=(e,t)=>{let n=[`target`,`history`,`none`,`initialize`].filter(e=>t[e]!==void 0);if(n.length===0&&t.update!==void 0){let n=$y(t.update,e);if(n.kind!==`state`)throw Error(`Machine update requires an active state reference`);return O_(`update`,n.path,`branch`)}if(n.length!==1)throw Error(`Machine transition must declare exactly one destination operation`);let r=n[0];if(r===`none`){if(t.none!==!0||t.update!==void 0)throw Error(`Machine targetless transition requires none: true`);return k_}if(r===`initialize`){if(t.update!==void 0)throw Error(`Machine initialize cannot update a retained owner`);return O_(`state`,``,`branch`)}let i=$y(t[r],e);if(r===`target`&&i.path===``)throw Error(`Machine root is not a destination; use initialize to reconstruct it from machine input`);if(r===`history`!=(i.kind===`history`))throw Error(`Machine history references require a history transition`);let a=t.update===void 0?void 0:$y(t.update,e).path;if(a!==void 0&&r!==`target`)throw Error(`Machine owner updates require an ordinary destination`);return O_(i.kind,i.path,r===`history`?`full`:`branch`,a)},tb=(e,t,n,r)=>{let i=Yy(t,`Machine invocation for "${n}" must be an object`),a=typeof i.src==`string`?e.sources.get(i.src):void 0;if(a===void 0)throw Error(`Machine invocation for "${n}" names an unknown source`);let{src:o,input:s,...c}=i,l=typeof s==`function`?e=>s(r(e)):s;if(a.kind===`children`)return{...c,child:a.value,...l===void 0?{}:{input:l}};let u=typeof a.value==`function`&&!(a.kind===`effects`&&Jn(a.value))&&!(a.kind===`streams`&&yt(a.value));if(u!==(typeof l==`function`))throw Error(`Machine invocation "${o}" requires input exactly when its source takes an argument`);let d=u?e=>a.value(l(e)):()=>a.value,f={effects:`effect`,streams:`stream`,timers:`after`,logic:`logic`}[a.kind];return{...c,sourceName:o,id:c.id??o,[f]:!u&&(a.kind===`timers`||a.kind===`logic`)?a.value:d}},nb=Symbol(`effect/Machine/InitialEvent`),rb=Symbol(`effect/Machine/SnapshotBuilderState`),ib=Symbol(`effect/Machine/ChildMachineLogic`),ab=new WeakSet,ob=e=>ab.has(e),sb=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Machine ${t} must be an object`);return e},cb=e=>typeof e==`function`?e:()=>e,lb=e=>{if(typeof e==`object`&&e&&L(e,`decoded`)&&e.decoded===!0&&L(e,`data`)){let t=sb(e,`decoded construction`);if(Reflect.ownKeys(t).some(e=>e!==`decoded`&&e!==`data`))throw Error(`Machine decoded construction accepts only decoded and data`);return cb(t.data)}let t=cb(e);return n=>nv(e===void 0?{}:t(n))},ub=e=>{if(e.decoded!==void 0&&typeof e.decoded!=`boolean`)throw Error(`Machine decoded construction flag must be a boolean`);if(e.decoded===!0){if(!L(e,`data`))throw Error(`Machine decoded construction requires data`);return cb(e.data)}let t=cb(e.data);return n=>nv(L(e,`data`)?t(n):{})},db=(e,t)=>{let n=(e,t,r)=>{if(L(t,`initialize`))throw Error(`Machine child construction belongs in initial declarations`);if(r!==``&&L(t,`root`))throw Error(`Machine root construction belongs at the root handler`);let{initial:i,root:a,states:o,...s}=t;if(A(e)||!(`states`in e)){if(i!==void 0)throw Error(`Machine state "${r}" cannot declare initial children`);if(o!==void 0)throw Error(`Machine state "${r}" has no children`);return{node:e,handlers:s}}let c=o===void 0?{}:sb(o,`child handlers`);for(let t of Object.keys(c))if(!Object.prototype.hasOwnProperty.call(e.states,t))throw Error(`Machine unknown child "${t}"`);let l=Object.create(null),u=Object.create(null),d=Object.create(null),f=e.type===`parallel`,p;if(f){let t=i===void 0?{}:sb(i,`parallel initial regions`);for(let[n,r]of Object.entries(t)){let t=e.states[n];if(t===void 0||!A(t)&&(t.type===`history`||t.type===`choice`))throw Error(`Machine invalid initial region "${n}"`);if(!A(t)&&(!(`schema`in t)||t.schema===void 0))throw Error(`Machine schema-less region "${n}" cannot construct data`);d[n]=lb(r)}}else{let t=sb(i,`initial edge for "${r}"`);if(Reflect.ownKeys(t).some(e=>![`target`,`data`,`decoded`].includes(String(e))))throw Error(`Machine initial edge accepts only target, data, and decoded`);let n=r===``?``:`${r}.`,a=typeof t.target==`string`&&t.target.startsWith(n)?t.target.slice(n.length):void 0,o=a===void 0||!Object.hasOwn(e.states,a)?void 0:e.states[a],s=o===void 0||A(o)?`state`:o.type;if(a===void 0||o===void 0||s===`history`)throw Error(`Machine initial target must be a direct child of "${r===``?`root`:r}"`);if(p=a,s===`choice`&&(L(t,`data`)||L(t,`decoded`)))throw Error(`Machine choice initial edges cannot construct data`);let c=ub(t),l=e.states[a];if(L(t,`data`)&&!A(l)&&(!(`schema`in l)||l.schema===void 0))throw Error(`Machine schema-less initial child "${a}" cannot construct data`);L(t,`data`)&&(d[a]=c)}for(let[t,i]of Object.entries(e.states)){let e=r===``?t:`${r}.${t}`,a=n(i,c[t]===void 0?{}:sb(c[t],`state handler`),e);l[t]=a.node,(A(i)||i.type!==`history`)&&(c[t]!==void 0||!A(i)&&`states`in i)&&(u[t]=a.handlers)}let m=Object.freeze({...e,states:Object.freeze(l),...f?{}:{initial:p}}),h=Object.entries(d),g=e=>{let t=typeof e.ancestors==`object`&&e.ancestors!==null?e.ancestors:{},n={...e,root:r===``?e.state:t[``]},i=Object.fromEntries(h.map(([e,t])=>[e,t(n)]));return{[rb]:i}};return ab.add(g),{node:m,handlers:{...s,...h.length===0?{}:{initialize:g},states:u}}};return n(e.node,t,``)},fb=(e,t)=>{let n=[`effect`,`stream`,`after`,`logic`,`child`].filter(t=>t in e);if(n.length!==1)throw Error(`Machine invocation for state "${t}" must define exactly one source`);if(n[0]!==`child`&&typeof e.id!=`string`)throw Error(`Machine invocation for state "${t}" requires a string id`);if((n[0]===`effect`||n[0]===`stream`)&&typeof e[n[0]]!=`function`)throw Error(`Machine invocation for state "${t}" requires a source callback`);return Object.freeze(e)},pb=e=>`child`in e?e.child.id:e.id,mb=(e,t)=>{let n=new Set;for(let r of e){let e=pb(r);if(n.has(e))throw Error(`Machine invocations for state "${t}" must have distinct ids; "${e}" is declared twice`);n.add(e)}},hb=e=>e===void 0?[]:Array.isArray(e)?e:[e],gb=e=>{let t=[],n=[],r=[];return{commands:t,raisedEvents:n,emittedEvents:r,enqueue:{raise:t=>{n.push(Rv(e,t))},emit:t=>{r.push(Bv(e,t))},sendTo:(e,n)=>{t.push({_tag:`SendTo`,target:e,event:n})},stop:e=>{t.push({_tag:`Stop`,child:e})}}}},_b=(e,t)=>{let n=e.stateNodes.byPath.get(t);if(n===void 0)throw Error(`Machine expected state path "${t}" to exist`);return n},vb=e=>{let t={};return Object.defineProperty(t,"decoded",{value:e,enumerable:!1}),Object.defineProperty(t,"from",{value:(...t)=>e(nv(t.length===0?{}:t[0])),enumerable:!1}),t},yb=e=>{let t={};return Object.defineProperty(t,rb,{value:e,enumerable:!1}),t},bb=(e,t,n)=>{let r=yb(n);for(let i of t.children){let a=_b(e,i);a.schema===void 0||L(n,a.key)||(r[a.key]=vb(r=>{let i=Object.assign({},n);return i[a.key]=r,bb(e,t,i)}))}return r},xb=(e,t)=>{let n=_b(e,t);if(n.type===`parallel`)return bb(e,n,{});if(n.type!==`compound`)throw Error(`Machine state "${t}" cannot initialize child states`);let r=_b(e,n.initial);if(r.schema===void 0)throw Error(`Machine state "${t}" has no schema-valued initial child`);return vb(e=>yb({[r.key]:e}))},Sb=(e,t)=>{if(typeof t!=`object`||!t||!L(t,rb))throw Error(`Machine initialize handler for "${e}" must return its builder result`);return t[rb]},Cb=Symbol(`effect/Machine/InvocationEvent`),wb=(e,t,n)=>({[Cb]:!0,path:e,id:t,type:`done`,output:n}),Tb=(e,t,n)=>({[Cb]:!0,path:e,id:t,type:`element`,element:n}),Eb=(e,t,n)=>({[Cb]:!0,path:e,id:t,type:`failure`,error:n}),Db=(e,t,n)=>({[Cb]:!0,path:e,id:t,type:`snapshot`,snapshot:n}),Ob=e=>typeof e==`object`&&!!e&&Cb in e,kb=new WeakMap,Ab=new WeakMap,jb=(e,t)=>e.parent===void 0?{self:t.self}:{self:t.self,parent:t.parent},Mb=(e,t)=>{let n=Object.create(e);return Ab.set(n,jb(e,t)),n},Nb=(e,t)=>{let n=t.machineReferences;if(n!==void 0)return jb(e,n);let r=Ab.get(e);if(r!==void 0)return r;let i=kb.get(e);if(i!==void 0)return i;let a=jb(e,{self:{id:e.id??`Machine`,sessionId:`Machine.plan`,send:()=>V(new d_)},parent:void 0});return kb.set(e,a),a},Pb=e=>{if(e!==void 0)return typeof e==`function`?{reenter:!1,declinable:!1,targets:void 0,transition:e,evaluate:void 0}:{reenter:e.reenter===!0,declinable:e.declinable===!0,targets:e.targets,transition:e.transition,evaluate:e.evaluate}},Fb=(e,t,n)=>{let r=gb(e);return t===void 0||t(n,r.enqueue),{commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents}},Ib=(e,t,n,r)=>{let i=gb(e),a=r===void 0?{result:t(n,i.enqueue),branchIndex:0,branchKey:void 0}:r(n,i.enqueue);return H_(a.result)?{declined:!0}:{declined:!1,state:z_(a.result)?void 0:a.result,branchIndex:a.branchIndex,branchKey:a.branchKey,commands:i.commands,raisedEvents:i.raisedEvents,emittedEvents:i.emittedEvents}},Lb=(e,t,n)=>{let r=gb(e);return{value:t(n,r.enqueue),commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents}},Rb=(e,t,n,r)=>{let i=new Set(t.active),a=new Map(t.values),o=[],s=[],c=[],l=[],u=!0;for(;u;){u=!1;for(let d of Array.from(i).sort((t,n)=>iy(e,t,n))){let f=Z(e,d);if(f.type===`compound`&&!f.children.some(e=>i.has(e))){if(f.initial===void 0)throw Error(`Machine shallow history expected compound state "${d}" to have an initial child`);let p=Z(e,f.initial),m={active:i,values:a,outputs:t.outputs,history:t.history,machineReferences:t.machineReferences};if(p.type===`choice`){let t=mx(e,m,q_(p.path,d,Object.fromEntries(a)),n),r=m;for(let i of[t.target,...t.additionalTargets]){if(i===void 0)throw Error(`Machine initial choice "${p.path}" must resolve to an active state target`);let t=K_(i)?Bb(e,r,i,n):W_(i)?Vb(e,r,i,n):void 0;r=Ay(e,r,t?.target??i),t!==void 0&&(o.push(...t.commands),s.push(...t.raisedEvents),c.push(...t.emittedEvents),l.push(...t.transitions))}i.clear(),a.clear();for(let e of r.active)i.add(e);for(let[e,t]of r.values)a.set(e,t);o.push(...t.commands),s.push(...t.raisedEvents),c.push(...t.emittedEvents),l.push(...t.transitions),u=!0;continue}if(i.add(p.path),p.schema!==void 0){let t=h_(e).handlers[d]?.initialize;if(t===void 0){a.set(p.path,Uv(e,p,nv({}))),u=!0;continue}let i=Lb(e,t,{...Nb(e,m),state:m.values.get(d),containingState:dy(e,m,d),ancestors:uy(e,m,d),event:n,...d===``&&r!==void 0?{input:r.value}:{},...ob(t)?{}:{builder:xb(e,d)}}),l=Sb(d,i.value);a.set(p.path,Uv(e,p,l[p.key])),o.push(...i.commands),s.push(...i.raisedEvents),c.push(...i.emittedEvents)}u=!0}if(f.type===`parallel`){let l=f.children.filter(e=>!i.has(e));if(l.length>0){let f=l.filter(t=>Z(e,t).schema!==void 0),p={active:i,values:a,outputs:t.outputs,history:t.history,machineReferences:t.machineReferences},m=f.length===0?void 0:h_(e).handlers[d]?.initialize,h=m===void 0?void 0:Lb(e,m,{...Nb(e,p),state:p.values.get(d),containingState:dy(e,p,d),ancestors:uy(e,p,d),event:n,...d===``&&r!==void 0?{input:r.value}:{},...ob(m)?{}:{builder:xb(e,d)}}),g=h===void 0?void 0:Sb(d,h.value);for(let t of l){let n=Z(e,t);if(i.add(n.path),n.schema!==void 0){if(h===void 0){a.set(n.path,Uv(e,n,nv({})));continue}if(g===void 0||!Object.prototype.hasOwnProperty.call(g,n.key)){if(m!==void 0&&ob(m)){a.set(n.path,Uv(e,n,nv({})));continue}throw Error(`Machine parallel state initializer for "${d}" must return region "${n.key}"`)}a.set(n.path,Uv(e,n,g[n.key]))}}h!==void 0&&(o.push(...h.commands),s.push(...h.raisedEvents),c.push(...h.emittedEvents)),u=!0}}}}return{configuration:{active:i,values:a,outputs:new Map,history:t.history},commands:o,raisedEvents:s,emittedEvents:c,transitions:l}};function zb(e,t,n,r){let i=Oy(e,t,n);if(n.children===void 0||![...n.children.keys()].some(t=>Z(e,t).type===`choice`))return Rb(e,i,r,n.input);let a=[],o=[],s=[],c=[];for(let t of n.children?.keys()??[]){let n=Z(e,t);if(n.type!==`choice`)continue;let l=mx(e,i,q_(t,n.parent),r);for(let t of[l.target,...l.additionalTargets]){let n=K_(t)?Bb(e,i,t,r):W_(t)?Vb(e,i,t,r):void 0;i=Ay(e,i,n?.target??t),n!==void 0&&(a.push(...n.commands),o.push(...n.raisedEvents),s.push(...n.emittedEvents),c.push(...n.transitions))}a.push(...l.commands),o.push(...l.raisedEvents),s.push(...l.emittedEvents),c.push(...l.transitions)}let l=Rb(e,i,r,n.input);return c.length===0?l:{...l,commands:[...a,...l.commands],raisedEvents:[...o,...l.raisedEvents],emittedEvents:[...s,...l.emittedEvents],transitions:[...c,...l.transitions]}}function Bb(e,t,n,r){let i=zb(e,t,n,r),a=hy(e,i.configuration,n.path);return{target:ev(n.path,a.value,{snapshot:a,values:n.values}),commands:i.commands,raisedEvents:i.raisedEvents,emittedEvents:i.emittedEvents,transitions:i.transitions}}function Vb(e,t,n,r){let i=Z(e,n.path);if(i.type!==`history`||i.parent!==n.parent)throw Error(`Machine expected history target "${n.path}" to resolve to its declared parent`);let a=Ty(t,n.path);if(a!==void 0){let i=Rb(e,Ey(e,t,a),r),o=hy(e,i.configuration,n.parent),s=Object.fromEntries(i.configuration.values);return n.parent!==``&&t.active.has(``)&&delete s[``],{target:ev(n.parent,o.value,{snapshot:o,values:s}),commands:i.commands,raisedEvents:i.raisedEvents,emittedEvents:i.emittedEvents,transitions:i.transitions}}let o=i.key,s=h_(e).handlers[n.parent]?.history?.[o]?.default;if(s===void 0)throw Error(`Machine history state "${n.path}" requires a default implementation`);let c=Ib(e,s,{event:r,target:t=>Jy(e.stateNodes,t),owner:n.parent});if(c.state===void 0||W_(c.state)||!iv(c.state))throw Error(`Machine history default for "${n.path}" must return a complete snapshot containing its owner`);let l=fx(c.state)===void 0?void 0:mx(e,{active:new Set,values:new Map,outputs:new Map,history:t.history},c.state,r),u=l===void 0?xy(e,c.state):Ay(e,{active:new Set,values:new Map,outputs:new Map,history:t.history},l.target);for(let t of l?.additionalTargets??[])u=Ay(e,u,t);if(!u.active.has(n.parent))throw Error(`Machine history default for "${n.path}" returned a configuration that does not contain owner state "${n.parent}"`);let d=hy(e,u,n.parent),f=Object.fromEntries(u.values);return n.parent!==``&&t.active.has(``)&&delete f[``],{target:ev(n.parent,d.value,{snapshot:d,values:f}),commands:[...c.commands,...l?.commands??[]],raisedEvents:[...c.raisedEvents,...l?.raisedEvents??[]],emittedEvents:[...c.emittedEvents,...l?.emittedEvents??[]],transitions:l?.transitions??[]}}var Hb=(e,t)=>{if(!t.transition.declinable)return t;let n=Ib(e,t.transition.transition,t.context,t.transition.evaluate);return n.declined?void 0:{...t,collected:n}},Ub=(e,t)=>[...ny(e,t)].reverse(),Wb=(e,t,n)=>{let r=ny(e,t),i=ny(e,n),a,o=Math.min(r.length,i.length);for(let e=0;e<o&&r[e]===i[e];e++)a=r[e];return a},Gb=(e,t)=>{if(e!==void 0&&t!==void 0)return e===t||ey(e,t)?t:e},Kb=(e,t,n)=>Yb(e,Array.from(t.active).filter(e=>n===void 0||ey(e,n))),qb=(e,t,n)=>Xb(e,Array.from(t.active).filter(e=>n===void 0||ey(e,n))),Jb=(e,t)=>e.active.size===t.active.size&&Array.from(e.active).every(e=>t.active.has(e)),Yb=(e,t)=>Array.from(new Set(t)).sort((t,n)=>{let r=ny(e,n).length-ny(e,t).length;return r===0?Z(e,n).order-Z(e,t).order:r}),Xb=(e,t)=>Array.from(new Set(t)).sort((t,n)=>{let r=ny(e,t).length-ny(e,n).length;return r===0?iy(e,t,n):r}),Zb=(e,t,n,r)=>({...Nb(e,t),state:t.values.get(n),containingState:dy(e,t,n),ancestors:uy(e,t,n),event:r}),Qb=(e,t,n,r,i)=>({...Nb(e,t),state:t.values.get(n),containingState:dy(e,t,n),ancestors:uy(e,t,n),event:r,snapshot:i}),$b=(e,t,n,r,i,a)=>({...Nb(e,t),state:t.values.get(n),containingState:dy(e,t,n),ancestors:uy(e,t,n),event:r,output:i,snapshot:a}),ex=(e,t,n,r,i)=>{let a=[],o=[],s=[];for(let c of n){let n=Fb(e,h_(e).handlers[c]?.[i],Zb(e,t,c,r));a.push(...n.commands),o.push(...n.raisedEvents),s.push(...n.emittedEvents)}return{commands:a,emittedEvents:s,raisedEvents:o}},tx=(e,t,n)=>{let r=[],i=new Set,a=new Map,o,s=()=>o??=my(e,t);for(let o of oy(e,t))for(let c of Ub(e,o)){let l=Pb(h_(e).handlers[c]?.always);if(l!==void 0){let u=a.get(c);if(a.has(c)||(u=Hb(e,{sourcePath:c,leafPath:o,trigger:{type:`always`},transition:l,context:{...Nb(e,t),state:t.values.get(c),containingState:dy(e,t,c),ancestors:uy(e,t,c),event:n,snapshot:s()}}),a.set(c,u)),u===void 0)continue;i.has(c)||(i.add(c),r.push(u));break}}return r},nx=(e,t,n,r)=>{let i=[],a=new Set,o,s=()=>o??=my(e,t);for(let o of r){let r=Pb(h_(e).handlers[o.path]?.onDone);if(r!==void 0&&!a.has(o.path)){a.add(o.path);let c=Hb(e,{sourcePath:o.path,leafPath:cy(e,t,o.path),trigger:{type:`done`},transition:r,context:$b(e,t,o.path,n,o.output,s())});c!==void 0&&i.push(c)}}return i},rx=(e,t,n)=>{let r=[],i=new Set,a=new Map,o,s=()=>o??=my(e,t);for(let o of oy(e,t))for(let c of Ub(e,o)){let l=Pb(h_(e).handlers[c]?.on?.[n._tag]);if(l!==void 0){let u=a.get(c);if(a.has(c)||(u=Hb(e,{sourcePath:c,leafPath:o,trigger:{type:`event`,event:n._tag},transition:l,context:Qb(e,t,c,n,s())}),a.set(c,u)),u===void 0)continue;i.has(c)||(i.add(c),r.push(u));break}}return r},ix=(e,t,n)=>{if(!t.active.has(n.path))return[];let r=h_(e).handlers[n.path],i=hb(r?.invoke).find(e=>{let t=`child`in e?e.child?.id:e.id;return String(t)===n.id});if(i===void 0)return[];let a=Pb(n.type===`element`?i.onElement:n.type===`done`?i.onDone:n.type===`failure`?i.onFailure:i.onSnapshot);if(a===void 0)return[];let o=my(e,t),s={...Nb(e,t),state:t.values.get(n.path),containingState:dy(e,t,n.path),ancestors:uy(e,t,n.path),snapshot:o,id:n.id,...n.type===`element`?{element:n.element}:n.type===`done`?{output:n.output}:n.type===`failure`?{error:n.error}:{snapshot:n.snapshot}},c=Hb(e,{sourcePath:n.path,leafPath:cy(e,t,n.path),trigger:{type:`invoke`,id:n.id,outcome:n.type},transition:a,context:s});return c===void 0?[]:[c]},ax=e=>{if(W_(e)||J_(e)||tv(e)||iv(e))return String(e.path);throw Error(`Machine expected transition target to be a snapshot or target builder result`)},ox=(e,t,n,r)=>{if(n===void 0||r===void 0)return;let i=typeof r==`object`&&r&&`path`in r?String(r.path):`<unknown>`;if(!n.some(e=>i===e||e===``||i.startsWith(`${e}.`))){let r=t.type===`event`?String(t.event):t.type;throw Error(`Machine transition from "${e}" on "${r}" returned target "${i}" outside declared targets: ${n.length===0?`none`:n.map(e=>`"${e}"`).join(`, `)}`)}},sx=(e,t)=>{for(let n of e)if(t.includes(n))return!0;return!1},cx=(e,t)=>Array.from(t).sort((t,n)=>iy(e,t.selection.sourcePath,n.selection.sourcePath)),lx=e=>e.filter(t=>!e.some(e=>e.sourcePath!==t.sourcePath&&ey(e.sourcePath,t.sourcePath))),ux=(e,t)=>{let n=[];for(let r of cx(e,t)){let e=!1,t=new Set;for(let i of n){let n=r.update!==void 0&&i.update!==void 0&&r.update.path===i.update.path;if(sx(r.exitPaths,i.exitPaths)||n){if(ey(r.selection.sourcePath,i.selection.sourcePath))t.add(i);else{e=!0;break}}}if(!e){for(let e of t){let t=n.indexOf(e);t>=0&&n.splice(t,1)}n.push(r)}}return n},dx=(e,t={})=>{let n={...t},r=[],i=e=>{if(J_(e))Object.assign(n,e.values??{}),r.push(e);else if(typeof e==`object`&&e&&`path`in e&&`value`in e&&(e.value!==void 0&&(n[String(e.path)]=e.value),`state`in e&&i(e.state),`states`in e&&typeof e.states==`object`&&e.states!==null))for(let t of Object.values(e.states))i(t)};return i(e),r.map(e=>({target:q_(e.path,e.parent,n),values:n}))},fx=(e,t={})=>dx(e,t)[0],px=(e,t)=>{if(J_(e))return q_(e.path,e.parent,{...t,...e.values??{}});if(K_(e))return{...e,values:{...t,...e.values}};if(!tv(e)||Object.keys(t).length===0)return e;let n=e[__];return ev(e.path,e.value,{...n===void 0?{}:{snapshot:n},values:{...t,...e.values??{}}})};function mx(e,t,n,r){let i=[n],a=[],o=[],s=[],c=[],l=[],u=0;for(;i.length>0;){let n=i.shift();for(;;){let a=dx(n),d=a[0];if(d===void 0)break;if(i.unshift(...a.slice(1).map(({target:e})=>e)),u+=1,u>1e3)throw new c_({machineId:e.id,state:d.target.path,maxIterations:gx});let f=Z(e,d.target.path);if(f.type!==`choice`||f.parent!==d.target.parent)throw Error(`Machine expected choice target "${d.target.path}" to resolve to its declared parent`);let p=h_(e).handlers[f.path]?.choice;if(p===void 0||typeof p.transition!=`function`)throw Error(`Machine choice state "${f.path}" requires an implementation`);let m=new Map(t.values);for(let[t,n]of Object.entries(d.values)){let r=Z(e,t);r.schema!==void 0&&m.set(t,Uv(e,r,n))}let h={active:new Set([...t.active,...Object.keys(d.values)]),values:m,outputs:t.outputs,history:t.history,...t.machineReferences===void 0?{}:{machineReferences:t.machineReferences}},g=Ib(e,p.transition,{...Nb(e,h),containingState:dy(e,h,f.path),ancestors:uy(e,h,f.path),event:r},p.evaluate);if(g.state===void 0)throw Error(`Machine choice resolver for "${f.path}" must return a target`);ox(f.path,{type:`choice`},p.targets,g.state);let _=ax(g.state);n=px(g.state,d.values);let v=fx(n);l.push({source:f.path,trigger:{type:`choice`},reenter:!1,branchIndex:g.branchIndex,branchKey:g.branchKey,target:_,resolvedTarget:v?.target.path??_,updates:[]}),o.push(...g.commands),s.push(...g.raisedEvents),c.push(...g.emittedEvents)}if(!tv(n)&&!iv(n)&&!W_(n)&&!K_(n))throw Error(`Machine choice resolver must return a concrete typed target`);a.push(n)}return{target:a[0],additionalTargets:a.slice(1),commands:o,raisedEvents:s,emittedEvents:c,transitions:l}}var hx=(e,t,n)=>{let r=n.leafPath,i=n.collected??Ib(e,n.transition.transition,n.context,n.transition.evaluate);if(i.declined)throw Error(`Machine transition returned decline without declaring declinable: true`);let a=P_(i.state)?i.state:void 0,o=a?.target??i.state,s=o===void 0||M_(o)?void 0:o;ox(n.sourcePath,n.trigger,n.transition.targets,s);let c=a?.update??(M_(o)?o:void 0),l=c===void 0?void 0:(()=>{let n=Z(e,c.path);if(!t.active.has(n.path)||n.schema===void 0)throw Error(`Machine state update owner "${n.path}" must be an active valued state`);return{path:n.path,value:Uv(e,n,c.value)}})(),u=l!==void 0&&(K_(s)||J_(s))?{...t,values:new Map(t.values).set(l.path,l.value)}:t,d=s===void 0?void 0:mx(e,u,s,n.context.event),f=d?.target??s,p=f!==void 0&&K_(f)?Bb(e,u,f,n.context.event):void 0,m=p?.target??f,h,g=W_(m)&&n.transition.reenter&&t.active.has(m.parent)?m:void 0;if(m!==void 0&&W_(m)){let i=n.transition.reenter?Z(e,n.sourcePath).parent:Wb(e,r,m.parent),a=g===void 0?Kb(e,t,i):Yb(e,Array.from(t.active).filter(e=>ty(e,m.parent)));h=Vb(e,a.includes(m.parent)?wy(e,t,t,a):t,m,n.context.event)}let _=h===void 0?m:h.target,v=[],y=[],b=[],x=[],S=[];for(let r of d?.additionalTargets??[]){if(K_(r)){let i=Bb(e,t,r,n.context.event);S.push(i.target),v.push(...i.commands),y.push(...i.raisedEvents),b.push(...i.emittedEvents),x.push(...i.transitions);continue}if(!W_(r)){S.push(r);continue}let i=Vb(e,t,r,n.context.event);S.push(i.target),v.push(...i.commands),y.push(...i.raisedEvents),b.push(...i.emittedEvents),x.push(...i.transitions)}let C=_===void 0?void 0:S.length===0||s===void 0?ax(_):ax(s),w=_===void 0?l===void 0?t:{...t,values:new Map(t.values).set(l.path,l.value)}:Ay(e,t,_);for(let t of S)w=Ay(e,w,t);if(a!==void 0&&l!==void 0&&!w.active.has(l.path))throw Error(`Machine combined target exited its updating owner "${l.path}"`);l!==void 0&&(w={...w,values:new Map(w.values).set(l.path,l.value)});let T=n.transition.reenter||!Jb(t,w),ee=T||l!==void 0;if(!T)return{selection:n,branchIndex:i.branchIndex,branchKey:i.branchKey,unresolvedTarget:s,target:_,update:l,commands:[...i.commands,...d?.commands??[],...p?.commands??[],...h?.commands??[],...v],raisedEvents:[...i.raisedEvents,...d?.raisedEvents??[],...p?.raisedEvents??[],...h?.raisedEvents??[],...y],emittedEvents:[...i.emittedEvents,...d?.emittedEvents??[],...p?.emittedEvents??[],...h?.emittedEvents??[],...b],changed:T,stabilize:ee,exitPaths:[],entryPaths:[],choiceTransitions:[...d?.transitions??[],...p?.transitions??[],...h?.transitions??[],...x]};let te=C===void 0?Z(e,n.sourcePath).parent:Wb(e,r,C),ne=Z(e,n.sourcePath).parent,E=n.transition.reenter?Gb(te,ne):te;return{selection:n,branchIndex:i.branchIndex,branchKey:i.branchKey,unresolvedTarget:s,target:_,update:l,commands:[...i.commands,...d?.commands??[],...p?.commands??[],...h?.commands??[],...v],raisedEvents:[...i.raisedEvents,...d?.raisedEvents??[],...p?.raisedEvents??[],...h?.raisedEvents??[],...y],emittedEvents:[...i.emittedEvents,...d?.emittedEvents??[],...p?.emittedEvents??[],...h?.emittedEvents??[],...b],changed:T,stabilize:ee,exitPaths:g===void 0?Kb(e,t,E):Yb(e,Array.from(t.active).filter(e=>ty(e,g.parent))),entryPaths:g===void 0?qb(e,w,E):Xb(e,Array.from(w.active).filter(e=>ty(e,g.parent))),choiceTransitions:[...d?.transitions??[],...p?.transitions??[],...h?.transitions??[],...x]}},gx=1e3,_x={_tag:nb},vx=(e,t)=>Iy(e,by(e,t)),yx=(e,t,n)=>Cy(e,t).pipe(z(t=>By(e,t,n)),z(t=>{let n=ly(e,t.configuration);return!Iy(e,t.configuration)||!t.configuration.outputs.has(n)?or(Error(`Machine attempted to read terminal output from a non-terminal configuration`)):P(t.configuration.outputs.get(n))})),bx=(e,...t)=>{let n=e.input===void 0?t:t.length===0?(Vv(e,e.input,void 0),t):[Vv(e,e.input,t[0])],r=e.initial(...n),i={active:new Set,values:new Map,outputs:new Map,history:new Map},a=Bb(e,i,r,_x),o=Ay(e,i,a.target),s=my(e,o),c=fy(e,o),l=a.commands,u=a.raisedEvents,d=a.emittedEvents,f=ex(e,o,c,_x,`entry`),p=Sx(e,o,_x,[...f.commands],[...u,...f.raisedEvents],[...d,...f.emittedEvents],a.transitions.length===0?[]:[{next:o,event:_x,transitions:a.transitions,commands:l,raisedEvents:[...u],emittedEvents:d,exitPaths:[],entryPaths:[],changed:!1,stabilize:!1}]),m={startingState:s,initialEntryPaths:c,state:my(e,p.next),commands:[...l,...p.commands],emittedEvents:p.emittedEvents,microsteps:p.microsteps.map(t=>({next:my(e,t.next),event:t.event,transitions:t.transitions,commands:t.commands,raisedEvents:t.raisedEvents,emittedEvents:t.emittedEvents,exitPaths:t.exitPaths,entryPaths:t.entryPaths,changed:t.changed}))};return p.done?{...m,done:!0,output:p.output}:{...m,done:!1,output:void 0}},xx=(e,t,n,r)=>{if(r.length===0)return{next:t,event:n,transitions:[],commands:[],raisedEvents:[],emittedEvents:[],exitPaths:[],entryPaths:[],changed:!1,stabilize:!1};let i=lx(r),a=[];for(let n of i)a.push(hx(e,t,n));let o=ux(e,a),s=cx(e,o),c=s.flatMap(e=>[{source:e.selection.sourcePath,trigger:e.selection.trigger,reenter:e.selection.transition.reenter,branchIndex:e.branchIndex,branchKey:e.branchKey,target:e.unresolvedTarget===void 0?void 0:ax(e.unresolvedTarget),resolvedTarget:e.target===void 0?void 0:ax(e.target),updates:e.update===void 0?[]:[e.update.path]},...e.choiceTransitions]),l=t;for(let e of s)e.update!==void 0&&(l={...l,values:new Map(l.values).set(e.update.path,e.update.value)});let u=[...s.filter(e=>!e.changed),...s.filter(e=>e.changed)];for(let t of u)t.target!==void 0&&(l=Ay(e,l,t.target));let d=o.some(e=>e.changed),f=o.some(e=>e.stabilize),p=s.flatMap(e=>e.commands),m=s.flatMap(e=>e.raisedEvents),h=s.flatMap(e=>e.emittedEvents);if(!d)return{next:l,event:n,transitions:c,commands:p,raisedEvents:m,emittedEvents:h,exitPaths:[],entryPaths:[],changed:!1,stabilize:f};let g=Yb(e,s.flatMap(e=>e.exitPaths)),_=Xb(e,s.flatMap(e=>e.entryPaths));l=wy(e,t,l,g);let v=ex(e,t,g,n,`exit`),y=ex(e,l,_,n,`entry`);return{next:l,event:n,transitions:c,commands:[...v.commands,...p,...y.commands],raisedEvents:[...v.raisedEvents,...m,...y.raisedEvents],emittedEvents:[...v.emittedEvents,...h,...y.emittedEvents],exitPaths:g,entryPaths:_,changed:!0,stabilize:f}},Sx=(e,t,n,r,i,a,o)=>{let s=t,c=n,l=!0,u=0,d=0,f=!1,p,m=[];for(;;){if(u+=1,u>1e3)throw new c_({machineId:e.id,state:String(sy(e,s)),maxIterations:gx});let t=Uy(e,s,c);for(s=t.configuration,m.push(...t.completions.filter(t=>h_(e).handlers[t.path]?.onDone!==void 0));m.length>0&&!s.active.has(m[0].path);)m.shift();let n=nx(e,s,c,m.length===0?[]:[m.shift()]);if(n.length>0){let t=xx(e,s,c,n);r.push(...t.commands),i.push(...t.raisedEvents),a.push(...t.emittedEvents),o.push(t),s=t.next,l=t.stabilize;continue}if(Iy(e,s)){let t=ly(e,s);if(!s.outputs.has(t))throw Error(`Machine reached a terminal configuration without a completed root output`);f=!0,p=s.outputs.get(t);break}let h=l?tx(e,s,c):[];if(h.length>0){let t=xx(e,s,c,h);r.push(...t.commands),i.push(...t.raisedEvents),a.push(...t.emittedEvents),o.push(t),s=t.next,l=t.stabilize;continue}let g=i[d];if(g===void 0)break;d+=1;let _=g;c=_;let v=rx(e,s,_);if(v.length===0){l=!0;continue}let y=xx(e,s,_,v);r.push(...y.commands),i.push(...y.raisedEvents),a.push(...y.emittedEvents),o.push(y),s=y.next,l=!0}let h={next:s,commands:r,emittedEvents:a,microsteps:o};return f?{...h,done:!0,output:p}:{...h,done:!1,output:void 0}},Cx=(e,t,n)=>{let r=Ob(n)?n:Rv(e,n);if(Iy(e,t)){let n=Uy(e,t,r),i=ly(e,n.configuration);if(!n.configuration.outputs.has(i))throw Error(`Machine reached a terminal configuration without a completed root output`);return{event:r,next:n.configuration,commands:[],emittedEvents:[],microsteps:[],done:!0,output:n.configuration.outputs.get(i)}}let i=Ob(r)?ix(e,t,r):rx(e,t,r);if(i.length===0)return{event:r,next:t,commands:[],emittedEvents:[],microsteps:[],done:!1,output:void 0};let a=xx(e,t,r,i),o=[...a.commands],s=[...a.raisedEvents],c=[...a.emittedEvents],l=[a];return{...Sx(e,a.next,r,o,s,c,l),event:r}},wx=(e,...t)=>Rt({try:()=>bx(e,...t),catch:m_}),Tx=(e,t)=>({raise:n=>Lv(e,n).pipe(z(e=>t.sendTo(t.self,e))),emit:n=>zv(e,n).pipe(z(e=>t.emit(e)))}),Ex=(e,t)=>Nn(e,e=>e._tag===`SendTo`?t.sendTo(e.target,e.event):t.stopChild(e.child),{discard:!0}),Dx=(e,t)=>Ee(Array.from(e,e=>t.emit(e)),{discard:!0}),Ox=new WeakMap,kx=e=>{let t=Ox.get(e);if(t!==void 0)return t;let n={self:{id:e.id??`Machine`,sessionId:`Machine.plan`,send:()=>V(new d_)},parent:void 0};return Ox.set(e,n),n},Ax=(e,t)=>{let n=t===void 0?kx(e):t;return e.parent===void 0?{self:n.self}:{self:n.self,parent:n.parent}},jx=new Set([`initialize`,`invoke`,`on`,`output`]),Mx=e=>{if(e===void 0)return!0;for(let t of Reflect.ownKeys(e))if(!jx.has(t))return!1;return!0},Nx=e=>{let t=[],n=[],r=[],i=new Map;for(let a of e.stateNodes.byPath.values()){if(t.push(a),a.type===`choice`||a.type===`history`)return;(a.type===`atomic`||a.type===`final`)&&n.push(a.path),a.type===`final`&&r.push(a.path);let o=h_(e).handlers[a.path];if(!Mx(o))return;if(o?.on===void 0)continue;let s=new Map;for(let e of Reflect.ownKeys(o.on)){let t=Pb(o.on[e]);if(t!==void 0){if(t.declinable)return;s.set(e,t)}}s.size>0&&i.set(a.path,s)}n.sort((t,n)=>iy(e,t,n)),r.sort((t,n)=>iy(e,t,n)),t.sort((e,t)=>e.order-t.order);let a=new Map(t.map((e,t)=>[e.path,t])),o=e=>{let t=a.get(e);if(t===void 0)throw Error(`Machine expected compiled state path "${e}"`);return t},s=n.map(o),c=t.map(e=>e.parent===void 0?-1:o(e.parent)),l=t.map(e=>e.children.map(o)),u=t.map(t=>ny(e,t.path).slice(0,-1).map(o)),d=t.map(e=>i.get(e.path)),f=new Map;for(let e of s){let t=new Map,n=[e,...u[e].slice().reverse()];for(let e of n)for(let[n,r]of d[e]??[])t.has(n)||t.set(n,{sourceIndex:e,transition:r});f.set(e,t)}return{valued:Object.freeze(t.map(e=>e.schema!==void 0)),flat:t.every(e=>e.parent===void 0&&(e.type===`atomic`||e.type===`final`))||t[0]?.path===``&&t[0].type===`compound`&&t[0].schema===void 0&&(h_(e).handlers[``]===void 0||Reflect.ownKeys(h_(e).handlers[``]).every(e=>e===`initialize`))&&t.slice(1).every(e=>e.parent===``&&(e.type===`atomic`||e.type===`final`))&&[...i.values()].every(e=>[...e.values()].every(e=>e.targets!==void 0&&e.targets.every(e=>e!==``))),nodes:t,indexByPath:a,parentIndices:c,childIndices:l,ancestorIndices:u,rootIndices:t.flatMap((e,t)=>e.parent===void 0?[t]:[]),leafIndices:s,finalIndices:r.map(o),dispatchByLeaf:f}},Px=e=>({active:e.active.slice(),activeLeaves:e.activeLeaves.slice(),values:e.values.slice(),completed:e.completed.slice(),outputs:e.outputs.slice(),completedOrder:e.completedOrder.slice()}),Fx=(e,t)=>t?{...e,next:Px(e.next)}:e,Ix=(e,t,n)=>{e.values[t]=n},Lx=(e,t)=>{let n=new Uint8Array(e.nodes.length),r=Array(e.nodes.length),i=new Uint8Array(e.nodes.length),a=Array(e.nodes.length),o=[];for(let i of t.active){let a=e.indexByPath.get(i);if(a===void 0)throw Error(`Machine expected indexed active path "${i}"`);n[a]=1,e.valued[a]&&(r[a]=t.values.get(i))}for(let[n,r]of t.outputs){let t=e.indexByPath.get(n);if(t===void 0)throw Error(`Machine expected indexed completed path "${n}"`);i[t]=1,a[t]=r,o.push(t)}return{active:n,activeLeaves:e.leafIndices.filter(e=>n[e]===1),values:r,completed:i,outputs:a,completedOrder:o}},Rx=(e,t)=>{let n=new Set,r=new Map,i=new Map;for(let i=0;i<e.nodes.length;i++){if(t.active[i]!==1)continue;let a=e.nodes[i].path;n.add(a),e.valued[i]&&r.set(a,t.values[i])}for(let n of t.completedOrder)t.completed[n]===1&&i.set(e.nodes[n].path,t.outputs[n]);return{active:n,values:r,outputs:i,history:new Map}},zx=(e,t,n)=>{let r=e.nodes[n],i={path:r.path,value:e.valued[n]?t.values[n]:void 0};if(r.type===`compound`){let a=e.childIndices[n].find(e=>t.active[e]===1);if(a===void 0)throw Error(`Machine expected indexed compound state "${r.path}" to have an active child`);i.state=zx(e,t,a)}else if(r.type===`parallel`){let a={};for(let i of e.childIndices[n]){if(t.active[i]!==1)throw Error(`Machine expected indexed parallel state "${r.path}" to have active region "${e.nodes[i].path}"`);a[e.nodes[i].key]=zx(e,t,i)}i.states=a}return i},Bx=(e,t)=>{let n=e.rootIndices.find(e=>t.active[e]===1);if(n===void 0)throw Error(`Machine expected an active indexed root state`);let r=zx(e,t,n);return t.completedOrder.length>0&&(r.completed=t.completedOrder.map(n=>({path:e.nodes[n].path,output:t.outputs[n]}))),r},Vx=(e,t,n,r,i,a)=>{let o=t.parentIndices[r],s={};for(let e of t.ancestorIndices[r])t.valued[e]&&(s[t.nodes[e].path]=n.values[e]);return{...Ax(e,a),state:n.values[r],containingState:o<0?void 0:n.values[o],ancestors:s,event:i,snapshot:Bx(t,n)}},Hx=Object.freeze([]),Ux=(e,t,n,r)=>{let i,a,o,s={raise:t=>{(a??=[]).push(Rv(e,t))},emit:t=>{(o??=[]).push(Bv(e,t))},sendTo:(e,t)=>{(i??=[]).push({_tag:`SendTo`,target:e,event:t})},stop:e=>{(i??=[]).push({_tag:`Stop`,child:e})}},c=r===void 0?{result:t(n,s),branchIndex:0,branchKey:void 0}:r(n,s);return{state:z_(c.result)?void 0:c.result,branchIndex:c.branchIndex,branchKey:c.branchKey,commands:i??Hx,raisedEvents:a??Hx,emittedEvents:o??Hx}},Wx=(e,t,n,r,i)=>{let a=[];for(let o of n.activeLeaves){let s=t.dispatchByLeaf.get(o).get(r._tag);if(s!==void 0){let{sourceIndex:c,transition:l}=s;if(!a.some(e=>e.sourceIndex===c)){let s=t.nodes[c].path;a.push({sourceIndex:c,leafIndex:o,sourcePath:s,leafPath:t.nodes[o].path,trigger:{type:`event`,event:r._tag},transition:l,context:Vx(e,t,n,c,r,i)})}}}return a},Gx=(e,t)=>{if(e.active===t.active)return!0;for(let n=0;n<e.active.length;n++)if(e.active[n]!==t.active[n])return!1;return!0},Kx=(e,t,n,r,i)=>{if((tv(r)?t.indexByPath.get(String(r.path)):void 0)===i&&n.active[i]===1&&tv(r)&&r[__]===void 0&&r.values===void 0&&n.completedOrder.length===0&&t.valued[i]){let a=n.values.slice();return a[i]=Uv(e,t.nodes[i],r.value),{...n,values:a}}return Lx(t,Ay(e,Rx(t,n),r))},qx=(e,t,n,r)=>{let i=Ux(e,r.transition.transition,r.context,r.transition.evaluate),a=P_(i.state)?i.state:void 0,o=a?.target??i.state,s=a?.update??(M_(o)?o:void 0),c=s===void 0?void 0:(()=>{let r=t.indexByPath.get(s.path),i=r===void 0?void 0:t.nodes[r];if(r===void 0||i===void 0||n.active[r]!==1||i.schema===void 0)throw Error(`Machine state update owner "${s.path}" must be an active valued state`);return{path:i.path,value:Uv(e,i,s.value)}})(),l=o===void 0||M_(o)?void 0:o;ox(r.sourcePath,r.trigger,r.transition.targets,l);let u=l!==void 0&&K_(l)?Bb(e,(()=>{let e=Rx(t,n);return c===void 0?e:{...e,values:new Map(e.values).set(c.path,c.value)}})(),l,r.context.event):void 0,d=u?.target??l;if(d!==void 0&&!tv(d)&&!iv(d))throw Error(`Machine expected indexed transition target to be a snapshot or target builder result`);let f=d===void 0?c===void 0?n:(()=>{let e=Px(n);return e.values[t.indexByPath.get(c.path)]=c.value,e})():Kx(e,t,n,d,r.leafIndex);if(a!==void 0&&c!==void 0){let e=t.indexByPath.get(c.path);if(f.active[e]!==1)throw Error(`Machine combined target exited its updating owner "${c.path}"`);let n=f.values.slice();n[e]=c.value,f={...f,values:n}}let p=r.transition.reenter||!Gx(n,f),m=p||c!==void 0;if(!p)return{selection:r,branchIndex:i.branchIndex,branchKey:i.branchKey,unresolvedTarget:l,target:d,update:c,next:f,commands:[...i.commands,...u?.commands??[]],raisedEvents:[...i.raisedEvents,...u?.raisedEvents??[]],emittedEvents:[...i.emittedEvents,...u?.emittedEvents??[]],changed:!1,stabilize:m,exitPaths:[],entryPaths:[],choiceTransitions:u?.transitions??[]};let h=d===void 0?void 0:ax(d),g=h===void 0?t.nodes[r.sourceIndex].parent:Wb(e,r.leafPath,h),_=t.nodes[r.sourceIndex].parent,v=r.transition.reenter?Gb(g,_):g;return{selection:r,branchIndex:i.branchIndex,branchKey:i.branchKey,unresolvedTarget:l,target:d,update:c,next:f,commands:[...i.commands,...u?.commands??[]],raisedEvents:[...i.raisedEvents,...u?.raisedEvents??[]],emittedEvents:[...i.emittedEvents,...u?.emittedEvents??[]],changed:!0,stabilize:m,exitPaths:Kb(e,Rx(t,n),v),entryPaths:qb(e,Rx(t,f),v),choiceTransitions:u?.transitions??[]}},Jx=(e,t,n,r,i,a)=>{let o=e=>({source:e.selection.sourcePath,trigger:e.selection.trigger,reenter:e.selection.transition.reenter,branchIndex:e.branchIndex,branchKey:e.branchKey,target:e.unresolvedTarget===void 0?void 0:ax(e.unresolvedTarget),resolvedTarget:e.target===void 0?void 0:ax(e.target),updates:e.update===void 0?[]:[e.update.path]});if(i.length===1){let s=qx(e,t,n,i[0]);return{next:s.next,event:r,...a?{transitions:[o(s)]}:void 0,commands:s.commands,raisedEvents:s.raisedEvents,emittedEvents:s.emittedEvents,exitPaths:s.exitPaths,entryPaths:s.entryPaths,changed:s.changed}}let s=cx(e,ux(e,i.filter(e=>!i.some(t=>t.sourceIndex!==e.sourceIndex&&ey(t.sourcePath,e.sourcePath))).map(r=>qx(e,t,n,r)))),c=n;if(s.length===1)c=s[0].next;else{for(let e of s)if(e.update!==void 0){let n=c.values.slice();n[t.indexByPath.get(e.update.path)]=e.update.value,c={...c,values:n}}let n=[...s.filter(e=>!e.changed),...s.filter(e=>e.changed)];for(let r of n)r.target!==void 0&&(c=Kx(e,t,c,r.target,r.selection.leafIndex))}let l=s.flatMap(e=>e.commands),u=s.flatMap(e=>e.raisedEvents),d=s.flatMap(e=>e.emittedEvents),f=s.some(e=>e.changed);return{next:c,event:r,...a?{transitions:s.map(o)}:void 0,commands:l,raisedEvents:u,emittedEvents:d,exitPaths:f?Yb(e,s.flatMap(e=>e.exitPaths)):[],entryPaths:f?Xb(e,s.flatMap(e=>e.entryPaths)):[],changed:f}},Yx=(e,t,n,r,i,a)=>{let o=n,s=r,c,l,u,d,f=0,p=0;for(;;){if(p+=1,p>1e3)throw new c_({machineId:e.id,state:t.nodes[o.activeLeaves[0]].path,maxIterations:gx});let n=o.activeLeaves[0];if(n===void 0)throw Error(`Machine expected an active indexed root state`);if(t.nodes[n].type===`final`){let n=Uy(e,Rx(t,o),s).configuration,i=ly(e,n);if(!n.outputs.has(i))throw Error(`Machine reached a terminal indexed configuration without a completed root output`);return{event:r,next:Lx(t,n),commands:c??Hx,emittedEvents:u??Hx,microsteps:d??Hx,done:!0,output:n.outputs.get(i)}}let m=t.nodes[n].path,h=Pb(h_(e).handlers[m]?.on?.[s._tag]);if(h!==void 0){let r=Ux(e,h.transition,{...Ax(e,a),state:o.values[n],containingState:void 0,ancestors:{},event:s,snapshot:Bx(t,o)},h.evaluate),f=M_(r.state)?r.state:void 0,p=f===void 0?r.state:void 0;if(f!==void 0){let r=t.nodes[n];if(f.path!==m||r.schema===void 0)throw Error(`Machine state update owner "${f.path}" must be the active valued state`);Ix(o,n,Uv(e,r,f.value))}if(ox(m,{type:`event`,event:s._tag},h.targets,p),p!==void 0&&!tv(p)&&!iv(p))throw Error(`Machine expected indexed transition target to be a snapshot or target builder result`);let g=o;if(p!==void 0){let r=t.indexByPath.get(String(p.path)),i=tv(p)?p[__]===void 0&&p.values===void 0:!(`state`in p)&&!(`states`in p)&&!(`completed`in p)&&!(`history`in p);r===n&&i&&o.completedOrder.length===0&&t.valued[n]?Ix(o,n,Uv(e,t.nodes[n],p.value)):g=Kx(e,t,o,p,n)}let _=h.reenter||!Gx(o,g),v=g.activeLeaves[0];if(v===void 0)throw Error(`Machine expected an active indexed transition target`);let y={next:g,event:s,...i?{transitions:[{source:m,trigger:{type:`event`,event:s._tag},reenter:h.reenter,branchIndex:r.branchIndex,branchKey:r.branchKey,target:p===void 0?void 0:ax(p),resolvedTarget:p===void 0?void 0:ax(p),updates:f===void 0?[]:[f.path]}]}:void 0,commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents,exitPaths:_?[m]:Hx,entryPaths:_?[t.nodes[v].path]:Hx,changed:_};o=g,(d??=[]).push(Fx(y,i)),r.commands.length>0&&(c??=[]).push(...r.commands),r.raisedEvents.length>0&&(l??=[]).push(...r.raisedEvents),r.emittedEvents.length>0&&(u??=[]).push(...r.emittedEvents)}if(t.nodes[o.activeLeaves[0]].type===`final`)continue;let g=l?.[f];if(g===void 0)return{event:r,next:o,commands:c??Hx,emittedEvents:u??Hx,microsteps:d??Hx,done:!1,output:void 0};f+=1,s=g}},Xx=(e,t,n,r,i,a)=>{if(Ob(r)){let i=Cx(e,a===void 0?Rx(t,n):Xv(Rx(t,n),a),r);return{event:i.event,next:Lx(t,i.next),commands:i.commands,emittedEvents:i.emittedEvents,microsteps:i.microsteps.map(e=>({next:Lx(t,e.next),event:e.event,transitions:e.transitions,commands:e.commands,raisedEvents:e.raisedEvents,emittedEvents:e.emittedEvents,exitPaths:e.exitPaths,entryPaths:e.entryPaths,changed:e.changed})),done:i.done,output:i.output}}let o=Rv(e,r);if(t.flat)return Yx(e,t,n,o,i,a);if(t.finalIndices.some(e=>n.active[e]===1)){let r=Rx(t,n);if(Iy(e,r)){let n=Uy(e,r,o).configuration,i=ly(e,n);if(!n.outputs.has(i))throw Error(`Machine reached a terminal indexed configuration without a completed root output`);return{event:o,next:Lx(t,n),commands:[],emittedEvents:[],microsteps:[],done:!0,output:n.outputs.get(i)}}}let s=Wx(e,t,n,o,a);if(s.length===0)return{event:o,next:n,commands:[],emittedEvents:[],microsteps:[],done:!1,output:void 0};let c=Jx(e,t,n,o,s,i),l=c.next,u=o,d=[...c.commands],f=[...c.raisedEvents],p=[...c.emittedEvents],m=[Fx(c,i)],h=0,g=0;for(;;){if(g+=1,g>1e3)throw new c_({machineId:e.id,state:t.nodes[t.leafIndices.find(e=>l.active[e]===1)].path,maxIterations:gx});if(t.finalIndices.some(e=>l.active[e]===1)){let n=Uy(e,Rx(t,l),u).configuration;if(l=Lx(t,n),Iy(e,n)){let t=ly(e,n);if(!n.outputs.has(t))throw Error(`Machine reached a terminal indexed configuration without a completed root output`);return{event:o,next:l,commands:d,emittedEvents:p,microsteps:m,done:!0,output:n.outputs.get(t)}}}let n=f[h];if(n===void 0)return{event:o,next:l,commands:d,emittedEvents:p,microsteps:m,done:!1,output:void 0};h+=1,u=n;let r=Wx(e,t,l,n,a);if(r.length===0)continue;let s=Jx(e,t,l,n,r,i);l=s.next,d.push(...s.commands),f.push(...s.raisedEvents),p.push(...s.emittedEvents),m.push(Fx(s,i))}},Zx=new WeakMap,Qx=e=>({fromConfiguration:e=>e,toConfiguration:e=>e,snapshot:t=>my(e,t),plan:(t,n,r,i)=>Cx(e,i===void 0?t:Xv(t,i),n)}),$x=(e,t)=>({fromConfiguration:e=>Lx(t,e),toConfiguration:e=>Rx(t,e),snapshot:e=>Bx(t,e),plan:(n,r,i=!1,a)=>Xx(e,t,n,r,i,a),...Object.values(h_(e).handlers).some(e=>e.initialize!==void 0&&!ob(e.initialize))?{}:{initial:(n,r)=>{let i=e.input===void 0?n:n.length===0?(Vv(e,e.input,void 0),n):[Vv(e,e.input,n[0])],a=e.initial(...i),o=K_(a)?zb(e,{active:new Set,values:new Map,outputs:new Map,history:new Map,...r===void 0?{}:{machineReferences:r}},a,_x).configuration:xy(e,a),s=Uy(e,r===void 0?o:Xv(o,r),_x).configuration,c=Lx(t,s),l=Bx(t,c);if(!Iy(e,s))return{state:l,configuration:c,activeConfiguration:s,initialEntryPaths:fy(e,s),done:!1,output:void 0};let u=ly(e,s);if(!s.outputs.has(u))throw Error(`Machine reached a terminal configuration without a completed root output`);return{state:l,configuration:c,activeConfiguration:s,initialEntryPaths:fy(e,s),done:!0,output:s.outputs.get(u)}}}}),eS=e=>{let t=Zx.get(e);if(t!==void 0)return t;let n=Nx(e),r=n===void 0?Qx(e):$x(e,n);return Zx.set(e,r),r},tS=`Machine.invocation:`,nS=e=>e.startsWith(tS),rS=(e,t)=>{if(e.values===void 0?e.values=[t]:e.values.push(t),e.waiter!==void 0){let t=e.waiter;e.waiter=void 0,Ke(t,F)}},iS=e=>D(()=>{if(e.values!==void 0){let t=e.values;return e.values=void 0,P(t)}let t=Le();return e.waiter=t,cr(t).pipe(I(iS(e)))}),aS=(e,t)=>e._tag===`Started`&&(typeof t==`string`||e.descriptor!==void 0&&e.descriptor.id===t.id&&e.descriptor.machine===t.machine),oS=(e,t,n)=>{if(e.closed)return Qt();let r=e.children.get(t);return r!==void 0&&aS(r,n)?nn(r.ref):Qt()},sS=e=>{if(e.observers!==void 0)for(let t of e.observers)rS(t,oS(e,t.id,t.child))},cS=(e,t,n)=>{let r=e.children.get(t);r!==void 0&&r.token===n&&(e.children.delete(t),typeof t==`string`&&sS(e))},lS=(e,t,n,r,i)=>{let a=e.children.get(t);if(e.closed||a===void 0||a._tag!==`Starting`||a.token!==n)return!1;e.children.delete(t);let o=a.ownerKey===void 0?{_tag:`Started`,token:n,descriptor:i,ref:r}:{_tag:`Started`,token:n,descriptor:i,ref:r,ownerKey:a.ownerKey,ownerPath:a.ownerPath,ownerActive:a.ownerActive===!0};return e.children.set(t,o),typeof t==`string`&&sS(e),!0},uS=e=>Er(function*(){let t=yield*Lt(),n=0,r=0,i=0,a=0;return{rootSessionId:e,stream:ji(t).pipe(T(j(()=>{n+=1})),yi(j(()=>{--n}))),isActive:()=>n>0,nextDeliveryId:()=>i++,nextMacrostepId:()=>a++,publishUnsafe:i=>{n!==0&&Re(t,{...i,sequence:r++,rootSessionId:e})},close:mt(t)}}),dS=e=>({id:e.id,sessionId:e.sessionId}),fS=e=>e.flatMap(e=>{if(typeof e!=`object`||!e||!(`_tag`in e))return[];if(e._tag===`SendTo`&&`target`in e&&`event`in e){let t=e.target;return typeof t==`object`&&t&&`id`in t?[{_tag:`SendTo`,target:`sessionId`in t?dS(t):{id:String(t.id)},event:e.event}]:[]}if(e._tag===`Stop`&&`child`in e){let t=e.child;return typeof t==`string`?[{_tag:`Stop`,target:{id:t}}]:typeof t==`object`&&t&&`id`in t?[{_tag:`Stop`,target:`sessionId`in t?dS(t):{id:String(t.id)}}]:[]}return[]}),pS=e=>typeof e!=`object`||!e||!(`microsteps`in e)||!Array.isArray(e.microsteps)?[]:e.microsteps.map(e=>({event:e.event,transitions:Array.isArray(e.transitions)?e.transitions:[],raisedEvents:Array.isArray(e.raisedEvents)?e.raisedEvents:[],emittedEvents:Array.isArray(e.emittedEvents)?e.emittedEvents:[],commands:fS(Array.isArray(e.commands)?e.commands:[]),exitPaths:Array.isArray(e.exitPaths)?e.exitPaths:[],entryPaths:Array.isArray(e.entryPaths)?e.entryPaths:[],changed:e.changed===!0})),mS=Symbol.for(`effect/Machine/activeSnapshotObserver`),hS=Symbol.for(`effect/Machine/snapshotObserver`),gS=e=>typeof e==`object`&&!!e&&hS in e,_S=Symbol.for(`effect/Machine/sendParentOverride`),vS=Symbol.for(`effect/Machine/acknowledgedSend`),yS=Symbol(`effect/Machine/AcknowledgedMessage`),bS=e=>typeof e==`object`&&!!e&&yS in e,xS=e=>bS(e)?e.event:e,SS=(e,t)=>{e!==void 0&&bS(e)&&(e.deferred!==void 0&&Ke(e.deferred,P(t)),e.inspection?.complete(t))},CS=(e,t)=>{e!==void 0&&bS(e)&&e.deferred!==void 0&&Ke(e.deferred,En(t))},wS=e=>{e!==void 0&&bS(e)&&e.deferred!==void 0&&Ke(e.deferred,V(new d_))},TS=e=>typeof e==`object`&&!!e&&`send`in e&&typeof e.send==`function`,ES=(e,t,n,r)=>`inspectionSubject`in e&&`sendInspected`in e&&typeof e.sendInspected==`function`?e.sendInspected(t,n,r):e.send(t),DS=e=>e?._tag===`Childless`||e?.childless===!0,OS=(e,t)=>{let n=e.items??[];e.items=n,n.push(t)},kS=e=>{if(e.items===void 0)return Qt();let t=e.items[e.index];return e.index+=1,e.index===e.items.length&&(e.items=void 0,e.index=0),nn(t)},AS=e=>{if(e.items!==void 0)for(let t=e.index;t<e.items.length;t+=1)wS(e.items[t]);e.closed=!0,e.items=void 0,e.index=0},jS=()=>({items:void 0,index:0,closed:!1,receivers:new Set}),MS=(e,t,n)=>{if(e.closed)return!1;for(OS(e,t),n?.();e.items!==void 0&&e.receivers.size>0;){let t=e.receivers.values().next().value;e.receivers.delete(t),t(F)}return!0},NS=e=>D(()=>{let t=kS(e);return O(t)?P(t.value):e.closed?$n:i(t=>(e.receivers.add(t),j(()=>{e.receivers.delete(t)}))).pipe(I(NS(e)))}),PS=e=>{AS(e);let t=Array.from(e.receivers);e.receivers.clear();for(let e of t)e($n)},FS=class extends pn()(`effect/Machine/MachineRuntime`){},IS=(e,t)=>Et(e,FS,t),LS=e=>{switch(e.status){case`active`:return;case`done`:return{_tag:`Done`,output:e.output,snapshot:e};case`error`:{let t=e.cause.reasons.find(r);if(t!==void 0)return{_tag:`Failure`,error:t.error,cause:e.cause,snapshot:e};let n=e.cause.reasons.find(st);return n===void 0?e.cause.reasons.find(Fn)===void 0?{_tag:`Cause`,cause:e.cause,snapshot:e}:{_tag:`Interrupted`,cause:e.cause,snapshot:e}:{_tag:`Defect`,defect:n.defect,cause:e.cause,snapshot:e}}case`stopped`:return{_tag:`Stopped`,snapshot:e}}},RS=(e,t)=>D(()=>e(t)).pipe(Lr,an),zS=(e,t)=>{class n{nextSessionId;constructor(){let e=0;this.nextSessionId=j(()=>`machine:${e++}`)}get start(){return e}get startCompiledSync(){return t}}return j(()=>new n)},BS=(e,t,n)=>({id:t,sessionId:n,kind:e.inspection?.kind??`Logic`}),VS=(e,t)=>t?{_tag:`Initialization`}:e!==void 0&&bS(e)&&e.inspection!==void 0?{_tag:`Macrostep`,macrostepId:e.inspection.macrostepId}:void 0,HS=(e,t,n,r,i,a)=>{let o=e.nextDeliveryId(),s=e.nextMacrostepId(),c={deliveryId:o,macrostepId:s,source:r,event:n,causedBy:i,complete:i=>{let a=pS(i.plan);e.publishUnsafe({_tag:`EventProcessed`,subject:t,macrostepId:s,deliveryId:o,source:r,event:n,before:{status:`active`,state:i.before},after:{status:`active`,state:i.after},handled:a.some(e=>e.transitions.length>0),configurationChanged:a.some(e=>e.changed),microsteps:a})}};return{[yS]:!0,event:n,...a===void 0?void 0:{deferred:a},inspection:c}},US=(e,t,n)=>{if(!bS(n)||n.inspection===void 0)return;let r=n.inspection;e.publishUnsafe({_tag:`EventSent`,subject:t,deliveryId:r.deliveryId,source:r.source,target:dS(t),event:r.event,causedBy:r.causedBy})},WS=class{registry;self;runtime;services;sendAcknowledged;scopedServices;constructor(e,t,n,r,i){this.registry=e,this.self=t,this.runtime=n,this.services=r,this.sendAcknowledged=i}has(e){for(let t of this.registry.children.values())if(t.ownerActive&&t.ownerKey===e)return!0;return!1}stopEntry(e){return e.ownerActive=!1,e._tag===`Started`?e.ref.stop:F}spawn(e,t){let n=Symbol(),r,i=()=>{let e=this.registry.children.get(t.id);return e?.token===n&&e.ownerKey===t.key&&e.ownerActive===!0};return D(()=>{if(this.registry.closed)return $n;if(this.has(t.key)||this.registry.children.has(t.id))return V(new u_({id:t.duplicateId}));let a=e(),o=this.registry.scope??=pr(`parallel`);this.registry.children.set(t.id,{_tag:`Starting`,token:n,ownerKey:t.key,ownerPath:t.path,ownerActive:!0});let s={...this.self,send:e=>t.sendParent(i,e),sendInspected:(e,t,n)=>i()?ES(this.self,e,t,n):F,...this.sendAcknowledged===void 0?void 0:{[vS]:e=>i()?this.sendAcknowledged(e):$n}},l={detached:!0,id:t.id,sendParent:e=>t.sendParent(i,e),onOutcome:e=>t.onOutcome(i,e,r?.sessionId),...t.onSnapshot===void 0?void 0:{onSnapshot:e=>t.onSnapshot(i,e)},onReadySync:e=>(r=e,lS(this.registry,t.id,n,e,t.descriptor)),onStopSync:()=>cS(this.registry,t.id,n),skipStoppedOutcome:!0,parent:s,runtime:this.runtime,origin:{_tag:`Invoke`,ownerPath:t.path,invokeId:t.duplicateId},...t.activityKind===void 0||this.runtime.inspection===void 0||this.self.inspectionSubject===void 0?void 0:{activity:{id:t.duplicateId,owner:this.self.inspectionSubject,ownerPath:t.path,kind:t.activityKind}}},u=a.execution,d=this.services!==void 0&&t.onSnapshot===void 0&&u?._tag===`Compiled`&&u.childless&&u.drain._tag===`Owned`&&u.initialSync!==void 0,f=(d?z(this.runtime.nextSessionId,e=>this.runtime.startCompiledSync(a,l,this.scopedServices??=Pr(this.services,E,o),e)):this.runtime.start(a,l)).pipe(bt(e=>At(e)?F:(cS(this.registry,t.id,n),r===void 0?F:r.stop)));return(d?f:c(f,o)).pipe(an)})}stopAll(){return D(()=>{let e=[];for(let t of this.registry.children.values())t.ownerActive&&e.push(this.stopEntry(t));return e.length===0?F:e.length===1?e[0]:Ee(e,{concurrency:`unbounded`,discard:!0})})}stopPaths(e){if(e.length===0)return;let t=new Set(e),n=[];for(let e of this.registry.children.values())e.ownerActive&&e.ownerPath!==void 0&&t.has(e.ownerPath)&&n.push(this.stopEntry(e));return n.length===0?void 0:n.length===1?n[0]:Ee(n,{concurrency:`unbounded`,discard:!0})}},GS=l(Qt()).pipe(qn(re)),KS=e=>F,qS=(e,t)=>{},JS=()=>void 0,YS=Symbol(`effect/Machine/EmissionsClosed`),XS=()=>{let e,t=D(()=>{let t=e;return t===YS?P(void 0):t===void 0?Lt().pipe(z(t=>j(()=>{let n=e;return n===YS?[void 0,!0]:n===void 0?(e=t,[t,!1]):[n,!0]}).pipe(z(([e,n])=>n?mt(t).pipe(Jt(e)):P(e))))):P(t)});return{emit:t=>D(()=>e===void 0||e===YS?F:Se(e,t).pipe(an)),close:()=>{let t=e;return e=YS,t===void 0||t===YS?F:mt(t)},stream:qe(t.pipe(U(e=>e===void 0?ln:ji(e))))}},ZS={close:()=>F,spawn:(()=>or(Error(`Childless machine logic cannot spawn a process`))),get:()=>P(Qt()),changes:()=>GS,sendTo:()=>F,stop:()=>F,owned:{spawn:()=>or(Error(`Childless machine logic cannot spawn an owned process`)),stopAll:()=>F,stopPaths:()=>void 0}},QS=(e,t,n,r)=>{let i={closed:!1,children:new Map,observers:void 0,scope:void 0},a=e=>D(()=>{if(i.closed||(i.closed=!0,i.scope===void 0))return F;let t=Qe(i.scope,e),n,r;for(let e of i.children.values())e._tag===`Started`&&(n===void 0?n=e.ref.stop:(r??=[n],r.push(e.ref.stop)));t!==void 0&&(n===void 0?n=t:(r??=[n],r.push(t)));let a=r??n;return a===void 0?F:Array.isArray(a)?Ee(a,{concurrency:`unbounded`,discard:!0}):a}),o=(e,t)=>j(()=>cS(i,e,t)),s=(e,t,n,r)=>j(()=>lS(i,e,t,n,r)),l=e=>{let t=typeof e==`string`?e:e.id;return j(()=>{if(i.closed)return Qt();let n=i.children.get(t);return n!==void 0&&aS(n,e)?nn(n.ref):Qt()})},u=e=>{let t=typeof e==`string`?e:e.id;return yn(ce((n,r)=>j(()=>({child:e,id:t,values:void 0,waiter:void 0})).pipe(z(n=>{let a=j(()=>{i.observers!==void 0&&(i.observers.delete(n),i.observers.size===0&&(i.observers=void 0)),n.values=void 0,n.waiter=void 0});return w(r,a).pipe(I(j(()=>{!i.closed&&r.state._tag!==`Closed`&&(i.observers??=new Set,i.observers.add(n)),rS(n,oS(i,t,e))})),Jt(iS(n)))}))))},d=(e,t,n,r)=>{let a=typeof e==`string`?e:e.id;return D(()=>{if(i.closed)return F;let o=i.children.get(a);return o!==void 0&&aS(o,e)?ES(o.ref,t,n,r):F})},f=e=>{let t=typeof e==`string`?e:e.id;return D(()=>{if(i.closed)return F;let n=i.children.get(t);return n!==void 0&&aS(n,e)?n.ref.stop:F})};function p(n,r){let a=typeof n==`object`&&n&&ib in n?n:void 0,l=a===void 0?n:a[ib](r?.input),u=a===void 0?r:{id:a.id,descriptor:a},d=Symbol(),f=u?.id??d,p;return D(()=>i.closed?$n:typeof f==`string`&&(i.children.has(f)||nS(f))?V(new u_({id:f})):(i.scope??=pr(`parallel`),i.children.set(f,{_tag:`Starting`,token:d}),t.start(l,{detached:!0,...u?.id===void 0?void 0:{id:u.id},...u?.onOutcome===void 0?void 0:{onOutcome:u.onOutcome},...u?.[mS]===void 0?void 0:{onSnapshot:u[mS]},...u?.[_S]===void 0?void 0:{sendParent:u[_S]},onReady:(e,t)=>j(()=>{p=e}).pipe(I(s(f,d,e,u?.descriptor)),z(e=>e?F:t)),onStop:o(f,d),parent:e,runtime:t,origin:{_tag:`Spawn`,address:u?.id}}).pipe(bt(e=>ge(e)?o(f,d).pipe(I(p===void 0?F:p.stop)):F),c(i.scope))))}return{close:a,spawn:p,get:l,changes:u,sendTo:d,stop:f,owned:new WS(i,e,t,n,r)}},$S=(e,t,n,r)=>j(()=>QS(e,t,n,r)),eC=(e,t)=>`${e.length}:${e}${t}`,tC=(e,t)=>`${tS}${eC(e,t)}`,nC=e=>({initial:()=>F,run:()=>e}),rC=(e,t,n)=>({initial:()=>F,run:({parent:r})=>{let i=r?.[vS];return i===void 0?or(Error(`Stream invocation requires an acknowledged parent machine`)):mr(e,e=>i(Tb(t,n,e)).pipe(an,Ln(()=>$n)))}}),iC=(e,t)=>typeof e==`function`?e(t):e,aC=e=>({spawn:((t,n)=>e.spawn(t,n)),sendTo:((t,n)=>e.sendTo(t,n)),stop:(t=>e.stopChild(t))}),oC=(e,t,n)=>{if(`effect`in e)return{id:String(e.id),sourceName:e.sourceName,src:()=>nC(e.effect(t)),onDone:e.onDone,onFailure:e.onFailure,onSnapshot:e.onSnapshot,activityKind:`Effect`};if(`after`in e)return{id:String(e.id),sourceName:e.sourceName,src:()=>nC(Je(iC(e.after,t))),onDone:e.onDone,activityKind:`Timer`};if(`stream`in e){let r=String(e.id);return{id:r,sourceName:e.sourceName,src:()=>rC(e.stream(t),n,r),onDone:e.onDone,onFailure:e.onFailure,activityKind:`Stream`}}if(`logic`in e)return{id:String(e.id),address:String(e.address),src:()=>iC(e.logic,t),onDone:e.onDone,onFailure:e.onFailure,onSnapshot:e.onSnapshot};if(`child`in e){let n=e.child;return{id:n.id,address:n.id,descriptor:n,src:()=>n[ib](`input`in e?iC(e.input,t):void 0),onDone:e.onDone,onFailure:e.onFailure,onSnapshot:e.onSnapshot}}throw Error(`Unsupported captured machine invocation: ${String(e)}`)},sC=e=>e.length===0?F:e.length===1?e[0]:Ee(e,{discard:!0}),cC=(e,t,n)=>(n===void 0||e.self.sendInspected===void 0?e.self.send(t):e.self.sendInspected(t,e.self.inspectionSubject,{_tag:`Activity`,activitySessionId:n})).pipe(jr(`StoppedError`,()=>F)),lC=e=>e instanceof c_||e instanceof X||e instanceof d_,uC=(e,t,n,r,i,a,o,s,c,l,u,d)=>D(()=>{let f=eC(n,r),p=u===void 0?o:()=>{let t=o();return{...t,run:i=>Ne(D(()=>t.run(i)),`Machine.invoke`,{attributes:{"machine.id":e.self.id,"machine.sessionId":e.self.sessionId,"machine.state.path":n,"machine.invoke.id":r,"machine.invoke.source":d??r,"machine.invoke.kind":u,"machine.invoke.sessionId":i.self.sessionId},captureStackTrace:!1})}};return t.spawn(p,{key:f,path:n,id:i,duplicateId:r,...a===void 0?void 0:{descriptor:a},...u===void 0?void 0:{activityKind:u},sendParent:(t,n)=>t()?e.self.send(n):F,onOutcome:(t,i,o)=>I(Jr,D(()=>i._tag===`Stopped`||!t()?F:i._tag===`Done`?s===void 0?e.failCause(M(Error(`Invocation "${r}" completed without the required onDone handler`))):cC(e,wb(n,r,i.output),u===void 0?void 0:o):i._tag===`Failure`&&c!==void 0&&(a===void 0||!lC(i.error))?cC(e,Eb(n,r,i.error),u===void 0?void 0:o):e.failCause(i.cause))),...l===void 0?void 0:{onSnapshot:(t,i)=>t()?cC(e,Db(n,r,i)):F}})}),dC=(e,t)=>nS(e)?V(new u_({id:t})):void 0,fC=(e,t,n,r)=>{let i=String(r.id),a=r.address===void 0?void 0:dC(String(r.address),i);return a===void 0?uC(e,t,n,i,r.address===void 0?tC(n,i):String(r.address),r.descriptor,r.src,r.onDone,r.onFailure,r.onSnapshot,r.activityKind,r.sourceName):a},pC=(e,t,n,r)=>{let i=r.child,a=dC(i.id,i.id);return a===void 0?uC(e,t,n,i.id,i.id,i,i[ib],r.onDone,r.onFailure,r.onSnapshot,void 0):a},mC=(e,t,n,r,i,a)=>{let o=aC(t),s=Xb(e,i).filter(e=>r.active.has(e)).flatMap(i=>{let s={...Zv(r)??{self:t.self,parent:t.parent},children:o,state:r.values.get(i),containingState:dy(e,r,i),ancestors:uy(e,r,i),event:a};return hb(jy(e,i)?.invoke).map(e=>`child`in e&&!(`input`in e)?pC(t,n,i,e):fC(t,n,i,oC(e,s,i)))});return s.length===0?void 0:sC(s)},hC=Symbol(`effect/Machine/CompiledStoppedCompletion`),gC=class{logic;options;services;id;sessionId;inspectionSubject;send;sendInspected(e,t,n){return this.offerEvent(e,t,n)}[vS](e){return this.sendAcknowledgedEffect(e)}[hS](e){let t=this.snapshotObservers??=new Set;return t.add(e),()=>{t.delete(e)}}mailbox={items:void 0,index:0,closed:!1};address;childRuntime=ZS;processScope;processContext;compiledContext;current;lifecycle=`Active`;runState=`Initializing`;completion;waiter;termination;terminationSnapshot;worker;interruptRequested=!1;offerRevision=0;snapshotObservers;changesFlushScheduled=!1;inFlightMessage;externalEmissions;emissionsPubSub;activity;initialEntryPaths;initialMicrosteps;initializing;constructor(e,t,n,r){this.logic=e,this.options=t,this.services=n,this.sessionId=r,this.id=t.id??r;let i=t.runtime.inspection;i!==void 0&&(this.inspectionSubject=BS(e,this.id,r),this.initializing=!0,t.activity!==void 0&&(this.activity={...t.activity,sessionId:r})),this.externalEmissions=t.emissions,this.send=i===void 0?e=>this.offerMessage(e):e=>this.offerEvent(e,void 0,void 0),this.address={id:this.id,sessionId:r,stop:D(()=>this.stopFromProcess()),send:this.send,...i===void 0?void 0:{inspectionSubject:this.inspectionSubject,sendInspected:(e,t,n)=>this.offerEvent(e,t,n)}}}get inspector(){return this.options.runtime.inspection}causation(){return VS(this.inFlightMessage,this.initializing===!0)}publishCreated(){let e=this.inspector,t=this.inspectionSubject;e!==void 0&&t!==void 0&&e.publishUnsafe(this.activity===void 0?{_tag:`Created`,subject:t,parent:this.options.parent?.inspectionSubject,origin:this.options.origin??{_tag:`Root`},definition:this.logic.inspection?.definition}:{_tag:`ActivityStarted`,subject:this.activity.owner,activity:this.activity})}publishInitialized(e){if(this.initializing=!1,this.activity!==void 0)return;let t=this.inspector,n=this.inspectionSubject;t!==void 0&&n!==void 0&&t.publishUnsafe({_tag:`Initialized`,subject:n,snapshot:{status:`active`,state:e},initialEntryPaths:this.initialEntryPaths??[],microsteps:pS({microsteps:this.initialMicrosteps??[]})})}publishStartFailed(e){this.initializing=!1;let t=this.inspector,n=this.inspectionSubject;t!==void 0&&n!==void 0&&t.publishUnsafe(this.activity===void 0?{_tag:`StartFailed`,subject:n,cause:e}:{_tag:`ActivityStopped`,subject:this.activity.owner,activity:this.activity,exit:p(e)})}get execution(){return this.logic.execution}initializeCompiledSync(){this.publishCreated(),this.execution.childless||(this.childRuntime=QS(this.address,this.options.runtime,this.services,e=>this.sendAcknowledgedEffect(e)));let e=this.options.parent,t=this.options.sendParent??(e===void 0?KS:this.inspector===void 0?e.send:t=>ES(e,t,this.inspectionSubject,this.causation()));this.processScope={self:this.address,parent:e,spawn:this.childRuntime.spawn,sendParent:t,emit:e=>this.emitEvent(e),sendTo:((e,t)=>TS(e)?this.inspector===void 0?e.send(t):ES(e,t,this.inspectionSubject,this.causation()):this.childRuntime.sendTo(e,t,this.inspectionSubject,this.causation())),stopChild:this.childRuntime.stop,failCause:e=>this.failCause(e),inspectInitial:this.inspector===void 0?qS:(e,t=[])=>{this.initialEntryPaths=e,this.initialMicrosteps=t}};let n=this.execution.initialSync,r;try{r=n(this.processScope)}catch(e){return this.runState=`Idle`,this.publishStartFailed($t(e)),V(e)}return this.runState=`Idle`,this.current={revision:0,terminalizing:!1,changes:void 0,snapshot:{status:`active`,state:r.state}},this.publishInitialized(r.state),this.compiledContext=new _C(this.processScope,this.childRuntime.owned,this),`executionState`in r&&(this.compiledContext.executionState=r.executionState),this.options.onReadySync!==void 0&&!this.options.onReadySync(this)&&this.requestTerminationSync({_tag:`Stopped`}),r.done===!0&&this.lifecycle===`Active`&&this.requestTerminationSync({_tag:`Done`,output:r.output}),r.done===!1&&this.execution.childless&&this.lifecycle===`Active`&&this.mailbox.items===void 0?P(this):(this.runState=`Draining`,Ei(this.drainRuntime(),this.services).pipe(Jt(this)))}initialize(){let e=this;return Er(function*(){e.publishCreated(),e.execution.childless||(e.childRuntime=yield*$S(e.address,e.options.runtime,e.services,t=>e.sendAcknowledgedEffect(t)));let t=e.options.parent,n=e.options.sendParent??(t===void 0?KS:e.inspector===void 0?t.send:n=>ES(t,n,e.inspectionSubject,e.causation()));e.processScope={self:e.address,parent:t,spawn:e.childRuntime.spawn,sendParent:n,emit:t=>e.emitEvent(t),sendTo:((t,n)=>TS(t)?e.inspector===void 0?t.send(n):ES(t,n,e.inspectionSubject,e.causation()):e.childRuntime.sendTo(t,n,e.inspectionSubject,e.causation())),stopChild:e.childRuntime.stop,failCause:t=>e.failCause(t),inspectInitial:e.inspector===void 0?qS:(t,n=[])=>{e.initialEntryPaths=t,e.initialMicrosteps=n}};let r=t=>ge(t)?e.childRuntime.close(t):F,i=e.execution.initial,a=yield*(i===void 0?e.logic.initial(e.processScope).pipe(U(e=>({state:e,done:void 0,output:void 0}))):i(e.processScope)).pipe(bt(t=>(ge(t)&&e.publishStartFailed(t.cause),r(t))),gn(j(()=>{e.runState=`Idle`}))),o=a.state;return e.current={revision:0,terminalizing:!1,changes:void 0,snapshot:{status:`active`,state:o}},e.publishInitialized(o),e.execution.drain._tag===`Process`?e.processContext={...e.processScope,receive:Mi,poll:j(()=>Gr(kS(e.mailbox),xS)),receiveMessage:Mi,pollMessage:j(()=>e.pollCompiledMessage()),completeMessage:t=>e.completeCompiledMessage(t),state:j(()=>e.current.snapshot.state),setState:t=>e.setActiveState(t),updateState:t=>e.updateState(t)}:(e.compiledContext=new _C(e.processScope,e.childRuntime.owned,e),`executionState`in a&&(e.compiledContext.executionState=a.executionState)),e.options.onReadySync!==void 0&&!e.options.onReadySync(e)?yield*e.requestTermination({_tag:`Stopped`}):e.options.onReady!==void 0&&(yield*e.options.onReady(e,e.requestTermination({_tag:`Stopped`}).pipe(an))),e.options.onSnapshot!==void 0&&(yield*RS(e.options.onSnapshot,{status:`active`,state:o})),a.done===!0&&e.lifecycle===`Active`&&(yield*e.requestTermination({_tag:`Done`,output:a.output})),a.done===!1&&e.execution.childless&&e.lifecycle===`Active`&&e.mailbox.items===void 0||(e.runState=`Draining`,yield*e.drainRuntime()),e})}get state(){return j(()=>this.current.snapshot.state)}get snapshot(){return j(()=>this.current.snapshot)}get changes(){return this.changesStream()}get emissions(){return this.externalEmissions?.stream??this.emissionsStream()}get join(){return D(()=>this.lifecycle===`Completed`?this.resolveCompletion(this.completion):(this.waiter??=Le(),cr(this.waiter)))}get stop(){return ve(this.stopEffect())}child(e){return this.childRuntime.get(e)}childChanges(e){return this.childRuntime.changes(e)}requestTermination(e){return j(()=>this.requestTerminationSync(e))}hasTerminationRequest(){return this.lifecycle===`TerminationRequested`}requestTerminationSync(e){return this.lifecycle===`Active`&&(this.lifecycle=`TerminationRequested`,this.termination=e,this.terminationSnapshot=this.reserveTermination(e),!0)}reserveTermination(e){let t=this.current;if(t===void 0||t.terminalizing||t.snapshot.status!==`active`)return;let n=e._tag===`Stopped`?{status:`stopped`,state:t.snapshot.state}:e._tag===`Done`?{status:`done`,state:t.snapshot.state,output:e.output}:{status:`error`,state:t.snapshot.state,cause:e.cause};return this.current={...t,terminalizing:!0},n}stopFromProcess(){let e=this.requestTermination({_tag:`Stopped`}).pipe(an);return this.runState===`Initializing`?e:e.pipe(I($n))}failCause(e){let t={_tag:`Failure`,cause:e};return this.requestTermination(t).pipe(z(e=>e?Hr(this.settleRequestedTermination()).pipe(an):F))}sendAcknowledgedEffect(e){return Mt(t=>xe().pipe(z(n=>this.offerEvent(e,void 0,void 0,n).pipe(I(t(cr(n)))))))}offerEvent(e,t,n,r){return D(()=>{let i=this.inspector,a=this.inspectionSubject,o=i?.isActive()===!0&&a!==void 0?HS(i,a,e,t,n,r):r===void 0?e:{[yS]:!0,event:e,deferred:r};return this.offerMessage(o)})}offerMessage(e){return ve(pe(t=>{if(this.mailbox.closed||this.lifecycle!==`Active`)return V(new d_);let n=this.inspector,r=this.inspectionSubject;n!==void 0&&r!==void 0&&US(n,r,e),this.offerRevision+=1;let i=this.execution.drain,a=this.compiledContext,o=this.runState===`Idle`&&a!==void 0&&i._tag===`Owned`?i.runSync:void 0;if(o===void 0&&OS(this.mailbox,e),this.runState!==`Idle`)return F;if(this.runState=`Draining`,o!==void 0){let n;try{n=o(a,e)}catch(e){n=or(e)}return n!==void 0||this.hasTerminationRequest()?this.startWorker(n):(this.runState=`Idle`,this.scheduleChangesFlush(t.currentDispatcher),F)}return this.startWorker(void 0)}))}startWorker(e){let t=Ei(this.drainRuntime(e),this.services);return(this.options.detached===!0?Hr(t,{startImmediately:!0}):Hn(t,{startImmediately:!0})).pipe(z(e=>j(()=>(e.pollUnsafe()===void 0&&(this.worker=e),this.interruptRequested?(this.interruptRequested=!1,!0):!1)).pipe(z(t=>t?Hr(this.interruptAndFinish(e)):F))),an)}stopEffect(){return D(()=>this.lifecycle===`Completed`||this.finishIdleChildlessStop()?F:this.requestTermination({_tag:`Stopped`}).pipe(z(e=>e?this.settleRequestedTermination():this.awaitCompletion())))}finishIdleChildlessStop(){if(!this.execution.childless||this.runState!==`Idle`||this.worker!==void 0||this.lifecycle!==`Active`||this.options.onOutcome!==void 0&&this.options.skipStoppedOutcome!==!0||this.options.onStop!==void 0||this.inspector!==void 0||this.current.changes!==void 0||this.externalEmissions!==void 0||this.emissionsPubSub!==void 0&&this.emissionsPubSub!==YS||this.current.terminalizing||this.current.snapshot.status!==`active`)return!1;this.emissionsPubSub=YS;let e={status:`stopped`,state:this.current.snapshot.state};return this.lifecycle=`TerminationRequested`,this.termination={_tag:`Stopped`},this.terminationSnapshot=e,AS(this.mailbox),this.current={revision:this.current.revision+1,terminalizing:!0,changes:void 0,snapshot:e},this.notifySnapshotObservers(),wS(this.inFlightMessage),this.inFlightMessage=void 0,this.interruptRequested=!1,this.compiledContext!==void 0&&(this.compiledContext.executionState=void 0),this.options.onStopSync?.(this),this.completion=hC,this.lifecycle=`Completed`,this.waiter!==void 0&&(Ke(this.waiter,this.resolveCompletion(hC)),this.waiter=void 0),!0}settleRequestedTermination(){return D(()=>this.runState===`Draining`?this.worker===void 0?(this.interruptRequested=!0,this.awaitCompletion()):this.interruptAndFinish(this.worker).pipe(I(this.awaitCompletion())):this.finishRequestedTermination())}interruptAndFinish(e){return Me(e).pipe(I(D(()=>this.lifecycle===`Completed`?F:this.finishRequestedTermination())))}awaitCompletion(){return this.lifecycle===`Completed`?F:this.join.pipe(Lr,an)}resolveCompletion(e){if(e!==hC)return e;let t=V(new d_);return this.completion=t,t}drainRuntime(e){let t=this;return Mt(n=>Er(function*(){let r=t.offerRevision,i=e;for(;;){if(t.hasTerminationRequest())return yield*t.finishRequestedTermination();let e=yield*n(D(()=>{if(i!==void 0){let e=i;return i=void 0,e}let e=t.execution.drain;return e._tag===`Process`?e.run(t.processContext):e.run(t.compiledContext)})).pipe(Lr);if(t.flushPendingChanges(),ge(e))return t.lifecycle===`Active`&&(yield*t.requestTermination({_tag:`Failure`,cause:e.cause})),yield*t.finishRequestedTermination();if(O(e.value))return yield*t.requestTermination({_tag:`Done`,output:e.value.value}),yield*t.finishRequestedTermination();if(t.hasTerminationRequest())return yield*t.finishRequestedTermination();if(t.offerRevision!==r)r=t.offerRevision;else{t.runState=`Idle`,t.worker=void 0;return}}}))}finishRequestedTermination(){return D(()=>{if(this.lifecycle!==`TerminationRequested`)return F;let e=this.termination;if(e===void 0)return F;let t=this.terminationSnapshot??this.reserveTermination(e);if(t===void 0)return this.awaitCompletion();let n=e._tag===`Stopped`?de:e._tag===`Done`?Ht(e.output):p(e.cause),r=e._tag===`Stopped`?hC:e._tag===`Done`?P(e.output):En(e.cause),i=this.options.onOutcome===void 0||e._tag===`Stopped`&&this.options.skipStoppedOutcome===!0?F:D(()=>this.options.onOutcome(LS(t))).pipe(Lr,an),a=this.inspector,o=this.inspectionSubject,s=a===void 0||o===void 0?this.closeEmissions():this.closeEmissions().pipe(I(j(()=>a.publishUnsafe(this.activity===void 0?{_tag:`Terminated`,subject:o,snapshot:t}:{_tag:`ActivityStopped`,subject:this.activity.owner,activity:this.activity,exit:t.status===`stopped`?It():n}))));return ve(j(()=>{AS(this.mailbox)}).pipe(I(this.childRuntime.close(n)),I(this.setAndPublishSnapshot(t)),I(s),I(j(()=>{e._tag===`Failure`?CS(this.inFlightMessage,e.cause):wS(this.inFlightMessage),this.inFlightMessage=void 0})),I(i),I(this.options.onStop??F),I(this.options.inspectionRoot===!0&&this.inspector!==void 0?this.inspector.close:F),I(j(()=>{this.options.onStopSync?.(this),this.runState=`Idle`,this.worker=void 0,this.interruptRequested=!1,this.compiledContext!==void 0&&(this.compiledContext.executionState=void 0),this.completion=r,this.lifecycle=`Completed`,this.waiter!==void 0&&(Ke(this.waiter,this.resolveCompletion(r)),this.waiter=void 0)}))))})}publishSnapshot(e){let t=e.changes===void 0?P(e):Se(e.changes,[e]).pipe(Jt(e)),n=e.snapshot;return this.options.onSnapshot===void 0||n.status!==`active`?t:t.pipe(ze(()=>RS(this.options.onSnapshot,n)))}completeChanges(e){return e.changes===void 0?F:Se(e.changes,Ht(void 0)).pipe(an)}emitEvent(e){let t=this.externalEmissions===void 0?D(()=>this.emissionsPubSub===void 0||this.emissionsPubSub===YS?F:Se(this.emissionsPubSub,e).pipe(an)):this.externalEmissions.emit(e),n=this.inspector,r=this.inspectionSubject;return n===void 0||r===void 0?t:t.pipe(ze(()=>j(()=>n.publishUnsafe({_tag:`Emitted`,subject:r,emission:e,causedBy:this.causation()}))))}shutdownEmissions(){return this.closeEmissions()}closeEmissions(){if(this.externalEmissions!==void 0)return this.externalEmissions.close();let e=this.emissionsPubSub;return this.emissionsPubSub=YS,e===void 0||e===YS?F:mt(e)}getOrCreateEmissions(){return D(()=>{let e=this.emissionsPubSub;return e===YS?P(void 0):e===void 0?Lt().pipe(z(e=>j(()=>{let t=this.emissionsPubSub;return t===YS?[void 0,!0]:t===void 0?(this.emissionsPubSub=e,[e,!1]):[t,!0]}).pipe(z(([t,n])=>n?mt(e).pipe(Jt(t)):P(t))))):P(e)})}emissionsStream(){return qe(this.getOrCreateEmissions().pipe(U(e=>e===void 0?ln:ji(e))))}setAndPublishSnapshot(e){return D(()=>{this.flushPendingChanges();let t={revision:this.current.revision+1,snapshot:e,terminalizing:!0,changes:this.current.changes};return this.current=t,this.notifySnapshotObservers(),this.publishSnapshot(t).pipe(z(e=>this.completeChanges(e)),an)})}setActiveState(e){return D(()=>this.commitActiveState(e)??F)}pollCompiledMessage(){let e=kS(this.mailbox);return O(e)&&(this.inFlightMessage=bS(e.value)?e.value:void 0),e}beginCompiledMessage(e){this.inFlightMessage=bS(e)?e:void 0}completeCompiledMessage(e){SS(this.inFlightMessage,e),this.inFlightMessage=void 0}compiledState(){return this.current.snapshot.state}commitCompiledState(e){return this.commitActiveState(e,!0)}commitActiveState(e,t=!1){let n=this.current;if(n.terminalizing||n.snapshot.status!==`active`)return;let r=n.pendingChanges;r!==void 0&&(n.pendingChanges=void 0);let i={status:`active`,state:e},a={revision:n.revision+1,snapshot:i,terminalizing:!1,changes:n.changes};return this.current=a,a.changes!==void 0&&(r===void 0?t?a.pendingChanges=[a]:Re(a.changes,[a]):(r.push(a),t?a.pendingChanges=r:Re(a.changes,r))),this.notifySnapshotObservers(),this.options.onSnapshot===void 0?void 0:RS(this.options.onSnapshot,i)}notifySnapshotObservers(){if(this.snapshotObservers!==void 0)for(let e of this.snapshotObservers)e()}scheduleChangesFlush(e){this.changesFlushScheduled||this.current.pendingChanges===void 0||(this.changesFlushScheduled=!0,e.scheduleTask(()=>{this.changesFlushScheduled=!1,this.flushPendingChanges()},0))}flushPendingChanges(){let e=this.current,t=e?.pendingChanges;t!==void 0&&e.changes!==void 0&&(e.pendingChanges=void 0,Re(e.changes,t))}updateState(e){return D(()=>{let t=this.current;return t.terminalizing||t.snapshot.status!==`active`?F:e(t.snapshot.state).pipe(z(e=>{let n=this.current;return n.terminalizing||n.revision!==t.revision?F:this.setActiveState(e)}))})}getOrCreateChanges(){return D(()=>{let e=this.current;return e.snapshot.status===`active`?e.changes===void 0?Lt({replay:1}).pipe(z(e=>j(()=>{let t=this.current;return t.snapshot.status===`active`?t.changes===void 0?(this.current={...t,changes:e},[e,!1]):[t.changes,!0]:[void 0,!0]}).pipe(z(([t,n])=>n?mt(e).pipe(Jt(t)):P(t))))):P(e.changes):P(void 0)})}changesStream(){let e=this;return qe(Er(function*(){let t=yield*e.getOrCreateChanges();if(t===void 0)return l(e.current.snapshot);let n=yield*Bi(t),r=e.current;return r.snapshot.status===`active`?l(r.snapshot).pipe(qn(yn(rt(m(n))).pipe(Ii(e=>e.revision>r.revision),Ti(e=>e.snapshot)))):l(r.snapshot)}))}},_C=class{scope;ownedChildren;process;executionState;constructor(e,t,n){this.scope=e,this.ownedChildren=t,this.process=n}poll(){return Gr(this.process.pollCompiledMessage(),xS)}pollMessage(){return this.process.pollCompiledMessage()}beginMessage(e){this.process.beginCompiledMessage(e)}state(){return this.process.compiledState()}completeMessage(e){this.process.completeCompiledMessage(e)}commit(e){return this.process.commitCompiledState(e)}runAfterChanges(e){return this.process.flushPendingChanges(),e}},vC=hi(function*(e,t){let n=t.sessionId??(yield*t.runtime.nextSessionId),r=yield*ei(),i=e.execution,a=new gC(e,t,r,n);return yield*(i.initialSync!==void 0&&t.onReady===void 0&&t.onSnapshot===void 0?a.initializeCompiledSync():a.initialize()).pipe(bt(e=>ge(e)?a.shutdownEmissions().pipe(I(t.inspectionRoot===!0&&t.runtime.inspection!==void 0?t.runtime.inspection.close:F)):F))}),yC=(e,t,n,r)=>new gC(e,t,n,r).initializeCompiledSync(),bC=hi(function*(e,t){let{detached:n,id:r,onOutcome:i,onReady:a,onReadySync:o,onSnapshot:s,onStop:c,onStopSync:u,parent:d,runtime:f,sendParent:h}=t,g=t.sessionId??(yield*f.nextSessionId),_=r??g,v=f.inspection,y=v===void 0?void 0:BS(e,_,g),b=v===void 0||t.activity===void 0?void 0:{...t.activity,sessionId:g},x,S,C=jS(),w=t.emissions??XS(),T=yield*xe(),ee=yield*xe(),te=cr(ee).pipe(Lr,an),ne=!0,E,re=zi(T,{_tag:`Stopped`}).pipe(an),ie=(e,t)=>D(()=>MS(C,e,t)?F:V(new d_)),ae=v===void 0?void 0:(e,t,n,r)=>D(()=>{let i=v.isActive()?HS(v,y,e,t,n,r):r===void 0?e:{[yS]:!0,event:e,deferred:r};return ie(i,()=>US(v,y,i))}),oe=e.execution?._tag===`Compiled`?e=>Mt(t=>xe().pipe(z(n=>(v===void 0?ie({[yS]:!0,event:e,deferred:n}):ae(e,void 0,void 0,n)).pipe(I(t(cr(n))))),U(e=>e))):void 0,ce={id:_,sessionId:g,stop:D(()=>ne?re:re.pipe(I(Mi))),send:v===void 0?e=>ie(e):e=>ae(e,void 0,void 0),...v===void 0?void 0:{inspectionSubject:y,sendInspected:ae}},{changes:le,close:ue,get:fe,owned:pe,sendTo:me,spawn:he,stop:k}=ZS;DS(e.execution)||({changes:le,close:ue,get:fe,owned:pe,sendTo:me,spawn:he,stop:k}=yield*$S(ce,f,void 0,oe===void 0?void 0:e=>oe(e)));let _e=e=>At(e)?F:(v!==void 0&&v.publishUnsafe(b===void 0?{_tag:`StartFailed`,subject:y,cause:e.cause}:{_tag:`ActivityStopped`,subject:b.owner,activity:b,exit:e}),ue(e).pipe(I(w.close()),I(t.inspectionRoot===!0&&v!==void 0?v.close:F))),A=u===void 0?c??F:j(()=>u(Qe)),ye=v===void 0?JS:()=>VS(E,ne),be=h??(d===void 0?KS:v===void 0?d.send:e=>ES(d,e,y,ye())),Ce=v===void 0?w.emit:e=>w.emit(e).pipe(ze(()=>j(()=>v.publishUnsafe({_tag:`Emitted`,subject:y,emission:e,causedBy:ye()})))),we={self:ce,parent:d,spawn:he,sendParent:be,emit:Ce,sendTo:v===void 0?((e,t)=>TS(e)?e.send(t):me(e,t)):((e,t)=>TS(e)?ES(e,t,y,ye()):me(e,t,y,ye())),stopChild:k,failCause:e=>zi(T,{_tag:`Failure`,cause:e}).pipe(an),inspectInitial:v===void 0?qS:(e,t=[])=>{x=e,S=t}};v!==void 0&&v.publishUnsafe(b===void 0?{_tag:`Created`,subject:y,parent:d?.inspectionSubject,origin:t.origin??{_tag:`Root`},definition:e.inspection?.definition}:{_tag:`ActivityStarted`,subject:b.owner,activity:b});let Te=yield*e.initial(we).pipe(bt(_e),gn(j(()=>{ne=!1}))),M=yield*Or({revision:0,terminalizing:!1,changes:void 0,snapshot:{status:`active`,state:Te}});b===void 0&&v?.publishUnsafe({_tag:`Initialized`,subject:y,snapshot:{status:`active`,state:Te},initialEntryPaths:x??[],microsteps:pS({microsteps:S??[]})});let Ee=s===void 0?e=>e.changes===void 0?P(e):Se(e.changes,[e]).pipe(Jt(e)):e=>{let t=e.changes===void 0?P(e):Se(e.changes,[e]).pipe(Jt(e)),n=e.snapshot;return n.status===`active`?t.pipe(ze(()=>RS(s,n))):t},De=e=>e.changes===void 0?F:Se(e.changes,Ht(void 0)).pipe(an),Oe=e=>e.snapshot.status===`active`?P(e):De(e).pipe(Jt(e)),ke=e=>oi(M).pipe(z(t=>t.revision===e.revision?Ee(e).pipe(z(Oe)):P(void 0))),Ae=e=>tr(M,t=>t.terminalizing?P([void 0,t]):U(e(t.snapshot),e=>{if(e===void 0)return[void 0,t];let n={revision:t.revision+1,snapshot:e,terminalizing:!1,changes:t.changes};return[n,n]})).pipe(z(e=>e===void 0?P(void 0):ke(e)),U(e=>e?.snapshot)),je=e=>Yr(M,t=>t.terminalizing||t.snapshot.status!==`active`?[void 0,t]:[{revision:t.revision+1,snapshot:e(t.snapshot),terminalizing:!0,changes:t.changes},{...t,terminalizing:!0}]).pipe(U(e=>e?.snapshot)),Ne=e=>fn(M,t=>({revision:t.revision+1,snapshot:e,terminalizing:!0,changes:t.changes})).pipe(z(Ee),z(Oe),an),Pe=v===void 0?e=>Ae(t=>P(t.status===`active`?{status:`active`,state:e}:void 0)).pipe(an):t=>oi(M).pipe(z(n=>Ae(e=>P(e.status===`active`?{status:`active`,state:t}:void 0)).pipe(ze(r=>j(()=>{e.inspection?.kind!==`Machine`&&r!==void 0&&v.publishUnsafe({_tag:`StateChanged`,subject:y,before:n.snapshot.state,after:t,causedByDeliveryId:E!==void 0&&bS(E)?E.inspection?.deliveryId:void 0})})))),an),Fe=(e,n,r)=>{let a=i===void 0||e.status===`stopped`&&t.skipStoppedOutcome===!0?F:D(()=>i(LS(e))).pipe(Lr,an),o=v===void 0?w.close():w.close().pipe(I(j(()=>v.publishUnsafe(b===void 0?{_tag:`Terminated`,subject:y,snapshot:e}:{_tag:`ActivityStopped`,subject:b.owner,activity:b,exit:e.status===`stopped`?It():n}))));return ve(j(()=>PS(C)).pipe(I(ue(n)),I(Ne(e)),I(o),I(j(()=>{ge(n)?CS(E,n.cause):wS(E),E=void 0})),I(a),I(A),I(t.inspectionRoot===!0&&v!==void 0?v.close:F),I(r)))},Ie=je(e=>({status:`stopped`,state:e.state})),Le=e=>je(t=>({status:`error`,state:t.state,cause:e})),Re=e=>je(t=>({status:`done`,state:t.state,output:e})),Be=e=>Fe(e,de,nt(ee,new d_)),Ve=(e,t)=>{let n=p(t);return Fe(e,n,se(ee,t))},He=(e,t)=>{let n=Ht(t);return Fe(e,n,zi(ee,t))},Ue=ve(re.pipe(I(te))),We=e.execution?._tag===`Compiled`?{receiveMessage:NS(C).pipe(ze(e=>j(()=>{E=bS(e)?e:void 0}))),pollMessage:j(()=>kS(C)).pipe(ze(e=>j(()=>{O(e)&&(E=bS(e.value)?e.value:void 0)}))),completeMessage:e=>{SS(E,e),E=void 0}}:void 0,Ge=v===void 0||e.execution?._tag===`Compiled`?NS(C).pipe(U(xS)):NS(C).pipe(ze(e=>j(()=>{E=e})),U(xS)),Ke=v===void 0||e.execution?._tag===`Compiled`?j(()=>kS(C)).pipe(U(Gr(xS))):j(()=>kS(C)).pipe(ze(e=>j(()=>{O(e)&&(E=e.value)})),U(Gr(xS))),Je=v===void 0?e=>Ae(t=>t.status===`active`?e(t.state).pipe(U(e=>({status:`active`,state:e}))):P(void 0)).pipe(an):t=>oi(M).pipe(z(n=>Ae(e=>e.status===`active`?t(e.state).pipe(U(e=>({status:`active`,state:e}))):P(void 0)).pipe(ze(t=>j(()=>{e.inspection?.kind!==`Machine`&&t?.status===`active`&&v.publishUnsafe({_tag:`StateChanged`,subject:y,before:n.snapshot.state,after:t.state,causedByDeliveryId:E!==void 0&&bS(E)?E.inspection?.deliveryId:void 0})})))),an),Ye={...we,...e.execution?._tag===`Compiled`&&!e.execution.childless?{ownedChildren:pe}:void 0,...We,receive:Ge,poll:Ke,state:oi(M).pipe(U(e=>e.snapshot.state)),setState:Pe,updateState:Je},Xe=tr(M,e=>e.snapshot.status===`active`?e.changes===void 0?Lt({replay:1}).pipe(U(t=>[t,{...e,changes:t}])):P([e.changes,e]):P([void 0,e])),Ze=qe(Er(function*(){let e=yield*Xe;if(e===void 0)return l((yield*oi(M)).snapshot);let t=yield*Bi(e),n=yield*oi(M);return n.snapshot.status===`active`?l(n.snapshot).pipe(qn(yn(rt(m(t))).pipe(Ii(e=>e.revision>n.revision),Ti(e=>e.snapshot)))):l(n.snapshot)})),Qe={id:_,sessionId:g,...v===void 0?void 0:{inspectionSubject:y,sendInspected:ae},state:oi(M).pipe(U(e=>e.snapshot.state)),snapshot:oi(M).pipe(U(e=>e.snapshot)),changes:Ze,emissions:w.stream,join:cr(ee),stop:Ue,send:ce.send,...oe===void 0?void 0:{[vS]:oe},child:fe,childChanges:le};o!==void 0&&!o(Qe)?yield*re:a!==void 0&&(yield*a(Qe,re)),s!==void 0&&(yield*RS(s,{status:`active`,state:Te}));let $e=e=>{switch(e._tag){case`Stopped`:return Ie;case`Done`:return Re(e.output);case`Failure`:return Le(e.cause)}},N=(e,t)=>{switch(e._tag){case`Stopped`:return Be(t);case`Done`:return He(t,e.output);case`Failure`:return Ve(t,e.cause)}},et=e=>n===!0?Hr(e,{startImmediately:!0}):Hn(e,{startImmediately:!0}),tt=yield*pt(T),it=Vt(tt)?yield*Mt(t=>t(D(()=>e.run(Ye))).pipe(Lr,z(e=>zi(T,ge(e)?{_tag:`Failure`,cause:e.cause}:{_tag:`Done`,output:e.value})))).pipe(et):void 0;return yield*et(Mt(e=>Er(function*(){let t=O(tt)?yield*tt.value:yield*e(cr(T)),n=yield*$e(t);return it!==void 0&&(yield*Me(it)),n===void 0?yield*te:yield*N(t,n)}))),Qe}),xC=((e,t)=>e.execution?._tag===`Compiled`?vC(e,t):bC(e,t)),SC=zS(xC,yC),CC=new WeakMap,wC=e=>D(()=>{e.closed=!0;let t=Array.from(e.live).reverse();return e.live.clear(),Nn(t,e=>e.stop,{discard:!0})}),TC=()=>{let e=new Set,t={live:e,hooks:{onReadySync:n=>!t.closed&&(e.add(n),!0),onStopSync:t=>{e.delete(t)}},closed:!1};return t},EC=e=>z(ur,t=>{let n=CC.get(t);if(n!==void 0)return e(n.hooks);let r=TC();return CC.set(t,r),I(w(t,wC(r)),e(r.hooks))});hi(function*(e,t,n){let r=yield*SC,i=n===void 0?{detached:!0,runtime:r}:{...n,detached:!0,runtime:r};return t===`generic`?yield*EC(t=>bC(e,{...i,...t})):t===`compiled`?e.execution?._tag===`Compiled`?yield*EC(t=>vC(e,{...i,...t})):yield*or(Error(`Machine cannot force the compiled runtime for generic process logic`)):yield*EC(t=>xC(e,{...i,...t}))});var DC=hi(function*(e,t){let n=yield*SC;return yield*EC(r=>xC(e,t===void 0?{detached:!0,runtime:n,...r}:{...t,detached:!0,runtime:n,...r}))}),OC=hi(function*(e,t,n){let r=yield*SC,i=yield*r.nextSessionId,a=yield*uS(i);r.inspection=a;let o=XS(),s=yield*xe(),c=n===void 0?{detached:!0,emissions:o,runtime:r,sessionId:i,inspectionRoot:!0,origin:{_tag:`Root`}}:{...n,detached:!0,emissions:o,runtime:r,sessionId:i,inspectionRoot:!0,origin:{_tag:`Root`}},l=yield*ct(EC(n=>{let r={...c,...n};return t===`generic`?bC(e,r):t===`compiled`?e.execution?._tag===`Compiled`?vC(e,r):or(Error(`Machine cannot force the compiled runtime for generic process logic`)):xC(e,r)}).pipe(bt(e=>Ve(s,e))));return{id:n?.id??i,sessionId:i,changes:qe(cr(s).pipe(U(e=>e.changes))),emissions:o.stream,inspection:a.stream,start:l}}),kC=((e,t)=>OC(e,`auto`,t));R({_tag:xn(`MachineSnapshot`),version:xn(2),active:Dr(R({path:N,value:B(Li)})),completed:B(Dr(R({path:N,output:B(Li)}))),history:B(ae(N,R({mode:Ni([`shallow`,`deep`]),active:Dr(N),values:ae(N,Li)})))});var AC=(e,t,n)=>{let r=Z(e,n);if(r.type===`compound`){let r=My(e,t,n);if(r===void 0)throw Error(`Machine expected completed state "${n}" to have an active child`);return AC(e,t,r)}return r.output},jC=(e,t)=>Er(function*(){let n=yield*Cy(e,t),r=new Map,i=new Set,a=t.completed??[];if(!Array.isArray(a))throw Error(`Machine snapshot completion metadata must be an array`);for(let t of a){if(typeof t!=`object`||!t||typeof t.path!=`string`)throw Error(`Machine snapshot contains malformed completion metadata`);let a=t.path;if(i.has(a))throw Error(`Machine snapshot contains duplicate completion "${a}"`);if(!n.active.has(a)||!Fy(e,n,a))throw Error(`Machine snapshot contains invalid completion "${a}"`);i.add(a);let o=AC(e,n,a);if(o===void 0){if(t.output!==void 0)throw Error(`Machine snapshot contains an output for state "${a}" without an output schema`);r.set(a,void 0)}else r.set(a,yield*kv(e,o,t.output,{boundary:`output`,state:a}))}return my(e,{...n,outputs:r})}).pipe(Ln(t=>MC(e,t))),MC=(e,t)=>{if(rn(t))return En(si(t,t=>t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:$t(t)})));let n=qt(t);return O(n)&&n.value instanceof X?V(n.value):V(new X({machineId:e.id,boundary:`configuration`,cause:t}))},NC=e=>e.length===0?F:e.length===1?e[0]:Ee(e,{discard:!0}),PC=(e,t)=>({event:e.event,next:t(e.next),commands:e.commands,emittedEvents:e.emittedEvents,microsteps:e.microsteps.map(e=>({...e,transitions:e.transitions??[],next:t(e.next)})),done:e.done,output:e.output}),FC=new WeakMap,IC=e=>{let t=FC.get(e);if(t!==void 0)return t;let n=Object.values(h_(e).handlers).some(e=>e.invoke!==void 0);return FC.set(e,n),n},LC=P(Qt()),RC=(e,t)=>{let n=eS(e),r=new WeakMap,i=t=>{let n=r.get(t.scope);return n===void 0&&(n=Tx(e,t.scope),r.set(t.scope,n)),n},a=n=>{if(!t)return;let r=n.state();return vx(e,r)?yx(e,r,_x).pipe(U(nn)):void 0},o=e=>D(()=>c(e)??LC),s=(e,t,r,a,s)=>{let c=a.commands.length===0?void 0:Ex(a.commands,e.scope),l=a.emittedEvents.length===0?void 0:Dx(a.emittedEvents,i(e)),u=()=>{let i=D(()=>(t&&e.completeMessage({before:r,plan:PC(a,n.snapshot),after:s}),a.done?P(nn(a.output)):o(e)));return l===void 0?i:l.pipe(I(i))},d=()=>{let t=e.commit(s),n=u(),r=t===void 0?n:t.pipe(I(n));return t===void 0&&l===void 0?r:e.runAfterChanges(r)};return c===void 0?d():e.runAfterChanges(c.pipe(I(D(d))))},c=(t,r)=>{let i=r;for(;;){let r;if(i!==void 0)r=i,i=void 0,t.beginMessage(r);else{let e=t.pollMessage();if(Vt(e))return;r=e.value}let a=bS(r),c=a?r.event:r,l=t.state(),u;try{u=n.plan(t.executionState??n.fromConfiguration(xy(e,l)),c,a,t.scope)}catch(e){return p_(e)}if(t.executionState=u.next,u.microsteps.length===0){a&&t.completeMessage({before:l,plan:PC(u,n.snapshot),after:l});continue}let d=n.snapshot(u.next);if(u.commands.length>0||u.emittedEvents.length>0||u.done)return s(t,a,l,u,d);let f=t.commit(d);if(f!==void 0)return t.runAfterChanges(f.pipe(I(D(()=>(a&&t.completeMessage({before:l,plan:PC(u,n.snapshot),after:d}),o(t))))));a&&t.completeMessage({before:l,plan:PC(u,n.snapshot),after:d})}};return{run:e=>IS(a(e)??o(e),e.scope),runSync:(e,t)=>{let n=a(e);n!==void 0&&e.beginMessage(t);let r=n??c(e,t);return r===void 0?void 0:IS(r,e.scope)}}},zC=class{initialized=!1;initial;constructor(e){this.initial=e}},BC=(e,t)=>{let n=eS(e);return r=>{let i=r.state();if(t&&vx(e,i))return yx(e,i,_x).pipe(U(nn));let a=r.scope,o=r.executionState,s=o instanceof zC?o:new zC;r.executionState=s;let c,l,u;return u=D(()=>{let t=r.pollMessage();if(Vt(t))return l=void 0,P(Qt());let o=t.value,s=bS(o),d=s?o.event:o,f=i,p;try{p=n.plan(l??n.fromConfiguration(xy(e,i)),d,s,a)}catch(e){return p_(e)}if(l=p.next,p.microsteps.length===0)return s&&r.completeMessage({before:f,plan:PC(p,n.snapshot),after:i}),u;let m=p.microsteps.some(e=>e.changed),h=m?p.microsteps.flatMap(e=>e.exitPaths):[],g=new Map;if(m){for(let e of p.microsteps)if(e.changed)for(let t of e.entryPaths)g.set(t,e.event)}let _=n.toConfiguration(p.next),v=n.snapshot(p.next),y=[];if(p.commands.length>0&&y.push(Ex(p.commands,a)),m){let e=r.ownedChildren.stopPaths(h);e!==void 0&&y.push(e)}let b=[];if(p.emittedEvents.length>0&&b.push(Dx(p.emittedEvents,c??=Tx(e,a))),p.done)b.push(r.ownedChildren.stopAll());else if(m)for(let[t,n]of g){let i=mC(e,a,r.ownedChildren,_,[t],n);i!==void 0&&b.push(i)}let x=()=>{let e=r.commit(v);return i=v,e},S=()=>{let e=D(()=>(s&&r.completeMessage({before:f,plan:PC(p,n.snapshot),after:v}),p.done?P(nn(p.output)):u));return b.length===0?e:NC(b).pipe(I(e))},C=()=>{let e=x(),t=S(),n=e===void 0?t:e.pipe(I(t));return e===void 0&&b.length===0?n:r.runAfterChanges(n)};return y.length===0?C():r.runAfterChanges(NC(y).pipe(I(D(C))))}),IS(D(()=>{if(s.initialized)return u;let t=s.initial,o=t?.activeConfiguration??xy(e,i);l=t?.configuration??n.fromConfiguration(o);let c=mC(e,a,r.ownedChildren,o,t?.entryPaths??fy(e,o),_x);return s.initial=void 0,s.initialized=!0,c===void 0?u:c.pipe(I(u))}),a)}},VC=e=>e.done?{state:e.state,done:!0,output:e.output}:{state:e.state,done:!1,output:void 0},HC=(e,t)=>{let n=IC(e),r=eS(e),i=t._tag===`Initial`?t.args:[],a=t._tag===`Initial`?r.initial:void 0,o=a===void 0?void 0:e=>{try{let t=a(i,e);e.inspectInitial(t.initialEntryPaths);let r=VC(t);return n?{...r,executionState:new zC({configuration:t.configuration,activeConfiguration:t.activeConfiguration,entryPaths:t.initialEntryPaths})}:r}catch(e){throw m_(e)}},s=t=>a===void 0?IS(wx(Mb(e,t),...i).pipe(z(n=>{t.inspectInitial(n.initialEntryPaths,n.microsteps);let r=n.commands.length===0?void 0:Ex(n.commands,t),i=n.emittedEvents.length===0?void 0:Dx(n.emittedEvents,Tx(e,t)),a=P(VC(n));return r===void 0?i===void 0?a:i.pipe(I(a)):i===void 0?r.pipe(I(a)):r.pipe(I(i),I(a))})),t):Rt({try:()=>o(t),catch:m_});return{inspection:{kind:`Machine`,definition:e},execution:{_tag:`Compiled`,childless:!n,...t._tag===`Initial`?{initial:s}:{},...o===void 0?{}:{initialSync:o},drain:n?{_tag:`Owned`,run:BC(e,t._tag===`Resume`)}:{_tag:`Owned`,...RC(e,t._tag===`Resume`)}},initial:n=>t._tag===`Resume`?IS(jC(e,t.snapshot),n):s(n).pipe(U(e=>e.state)),run:t=>IS(Er(function*(){let{completeMessage:r,pollMessage:i,receiveMessage:a,state:o,setState:s}=t;if(r===void 0||i===void 0||a===void 0)return yield*or(Error(`Machine statechart started without acknowledged mailbox access`));let c,l=yield*o;if(vx(e,l))return yield*yx(e,l,_x);if(!n){let n,o=Qt(),u;for(;c===void 0;){let d=O(o)?o.value:yield*a;o=Qt();let f=bS(d),p=f?d.event:d,m=l,h;try{h=Cx(e,Xv(n??xy(e,l),t),p)}catch(e){return yield*p_(e)}if(n=h.next,h.microsteps.length>0){let n=my(e,h.next);yield*Ex(h.commands,t),yield*s(n),l=n,h.emittedEvents.length>0&&(yield*Dx(h.emittedEvents,u??=Tx(e,t))),h.done&&(c={output:h.output})}f&&r({before:m,plan:PC(h,t=>my(e,t)),after:l}),c===void 0&&(o=yield*i,Vt(o)&&(n=void 0))}return c===void 0?yield*or(Error(`Machine process stopped receiving events before reaching a terminal configuration`)):c.output}let u=t.ownedChildren;if(u===void 0)return yield*or(Error(`Invoking statechart started without an owned child runtime`));let d=(n,r,i)=>mC(e,t,u,n,r,i)??F,f=e=>u.stopPaths(e)??F;return yield*Er(function*(){let n=yield*Cy(e,l);yield*d(n,fy(e,n),_x),n=void 0;let o=Qt(),p;for(;c===void 0;){let m=O(o)?o.value:yield*a;o=Qt();let h=bS(m),g=h?m.event:m,_=l,v;try{v=Cx(e,Xv(n??xy(e,l),t),g)}catch(e){return yield*p_(e)}if(n=v.next,v.microsteps.length>0){let n=v.microsteps.some(e=>e.changed),r=v.microsteps.flatMap(e=>e.exitPaths),i=new Map;for(let e of v.microsteps)if(e.changed)for(let t of e.entryPaths)i.set(t,e.event);let a=my(e,v.next);if(yield*Ex(v.commands,t),n&&(yield*f(r)),yield*s(a),l=a,v.emittedEvents.length>0&&(yield*Dx(v.emittedEvents,p??=Tx(e,t))),v.done)c={output:v.output},yield*u.stopAll();else if(n)for(let[e,t]of i)yield*d(v.next,[e],t)}h&&r({before:_,plan:PC(v,t=>my(e,t)),after:l}),c===void 0&&(o=yield*i,Vt(o)&&(n=void 0))}return c===void 0?yield*or(Error(`Machine process stopped receiving events before reaching a terminal configuration`)):c.output}).pipe(bt(()=>u.stopAll()))}),t)}},UC=new WeakMap,WC=(e,...t)=>{if(t.length>0)return HC(e,{_tag:`Initial`,args:t});let n=UC.get(e);if(n!==void 0)return n;let r=HC(e,{_tag:`Initial`,args:t});return UC.set(e,r),r},GC=(e,t)=>HC(e,{_tag:`Resume`,snapshot:t}),KC=(e,...t)=>kC(WC(e,...t),e.id===void 0?void 0:{id:e.id}),qC=(e,t)=>DC(GC(e,t),e.id===void 0?void 0:{id:e.id}),JC={atomic:[`schema`,`type`,`annotations`],final:[`schema`,`type`,`output`,`annotations`],compound:[`schema`,`type`,`states`,`annotations`],parallel:[`schema`,`type`,`output`,`states`,`annotations`],history:[`type`,`history`,`annotations`],choice:[`type`,`annotations`]},YC=[`title`,`description`,`documentation`],XC=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ZC=(e,t)=>{let n=typeof t==`symbol`?`[${String(t)}]`:t===``?`<empty>`:String(t);return e===``?n:`${e}.${n}`},Q=(e,t,n)=>{throw Error(`${e} invalid state definition at "${t}": ${n}`)},QC=e=>Number.isFinite(Number(e)),$C=e=>e.length===0||e.some(e=>e===`untagged`)?`untagged`:e.every(e=>e===`tagged`)?`tagged`:`opaque`,ew=(e,t)=>{if(t.has(e))return`opaque`;if(ir(e)||li(e)||Fr(e)||ai(e)||yr(e)||o(e))return`tagged`;if(In(e))return typeof e.literal==`string`||typeof e.literal==`number`?`tagged`:`untagged`;let n=new Set(t).add(e);return wn(e)?$C(e.types.map(e=>ew(e,n))):hn(e)?ew(e.thunk(),n):ut(e)?`opaque`:`untagged`},tw=(e,t=new Set)=>{if(t.has(e))return`opaque`;if(Ar(e)){let n=e.propertySignatures.find(({name:e})=>e===`_tag`)?.type;return n===void 0||Qr(n)?`untagged`:ew(n,new Set(t).add(e))}let n=new Set(t).add(e);return wn(e)?$C(e.types.map(e=>tw(e,n))):hn(e)?tw(e.thunk(),n):ut(e)?`opaque`:`untagged`},nw=e=>A(e)&&tw(mi(e.ast))!==`untagged`,rw=(e,t,n)=>{let r=ZC(t,n);return typeof n==`symbol`?Q(e,r,`state keys must be strings, not symbols`):typeof n==`number`?Q(e,r,`state keys cannot use numeric forms`):n===``?Q(e,r,`state keys cannot be empty`):n===`__proto__`?Q(e,r,`the state key "__proto__" is not allowed`):n.includes(`.`)?Q(e,r,`state keys cannot contain "."`):QC(n)?Q(e,r,`state keys cannot use numeric forms`):r},iw=(e,t,n,r)=>{(typeof n!=`object`||!n||Array.isArray(n))&&Q(e,t,`${r} must be a plain record`);let i=Object.getPrototypeOf(n);i!==Object.prototype&&i!==null&&Q(e,ZC(t===`<root>`?``:t,`__proto__`),`${r} must not declare an implicit "__proto__" state key`)},aw=(e,t,n,r,i)=>{if(typeof n!=`object`||!n||Array.isArray(n)||!XC(n,r))return;let a=n[r];(typeof a!=`object`||!a||A(a)||a.type!==`history`)&&Q(e,`${t}.${r}`,i)},ow=(e,t,n,r)=>{let i=JC[r];for(let a of Reflect.ownKeys(n))i.includes(a)||Q(e,t,`${r} states cannot declare property "${String(a)}"`)},sw=(e,t,n)=>{iw(e,`${t}.annotations`,n,`schema-less state annotations`);for(let r of Reflect.ownKeys(n))YC.includes(r)||Q(e,`${t}.annotations`,`schema-less state annotations cannot declare property "${String(r)}"`),typeof n[r]!=`string`&&Q(e,`${t}.annotations.${String(r)}`,`schema-less state annotation values must be strings`)},cw=(e,t,n,r,i=!1)=>{iw(e,n===``?`<root>`:n,t,`state trees`);for(let a of Reflect.ownKeys(t)){let o=i&&a===``?``:rw(e,n,a),s=t[a];if(A(s)){nw(s)||Q(e,o,`state schemas must decode to an object with a required PropertyKey _tag`);continue}iw(e,o,s,`state nodes`);let c=s.type,l=c===`history`?`history`:c===`choice`?`choice`:c===`parallel`?`parallel`:c===`final`?`final`:XC(s,`states`)?`compound`:`atomic`;if(ow(e,o,s,l),l===`history`||l===`choice`){r||Q(e,o,`${l} states must be declared below an active parent state`),XC(s,`annotations`)&&sw(e,o,s.annotations),l===`history`&&XC(s,`history`)&&s.history!==`shallow`&&s.history!==`deep`&&Q(e,`${o}.history`,`history must be "shallow" or "deep"`);continue}let u=XC(s,`schema`);u&&!nw(s.schema)&&Q(e,`${o}.schema`,`state schemas must decode to an object with a required PropertyKey _tag`),u&&XC(s,`annotations`)&&Q(e,`${o}.annotations`,`schema-backed states must declare annotations on their schema`),!u&&XC(s,`annotations`)&&sw(e,o,s.annotations),l===`atomic`&&XC(s,`type`)&&s.type!==`active`&&Q(e,`${o}.type`,`atomic state type must be "active"`),l===`final`&&s.type!==`final`&&Q(e,`${o}.type`,`final state type must be "final"`),l===`compound`&&XC(s,`type`)&&s.type!==`active`&&Q(e,`${o}.type`,`compound state type must be "active"`),l===`parallel`&&s.type!==`parallel`&&Q(e,`${o}.type`,`parallel state type must be "parallel"`),(l===`final`||l===`parallel`)&&XC(s,`output`)&&!A(s.output)&&Q(e,`${o}.output`,`state output must be an Effect Schema`),l===`compound`?(aw(e,o,s.states,`initial`,`active and choice child states cannot use the reserved target selector key "initial"`),u&&aw(e,o,s.states,`with`,`schema-backed compound child states cannot use the reserved local target selector key "with"`),cw(e,s.states,o,!0)):l===`parallel`&&(XC(s,`states`)||Q(e,`${o}.states`,`parallel states must declare child regions`),aw(e,o,s.states,`initial`,`active and choice child states cannot use the reserved target selector key "initial"`),cw(e,s.states,o,!0))}},lw=e=>typeof e==`object`&&e?Object.freeze({...e}):e,uw=e=>{let t={};for(let n of Object.keys(e)){let r=e[n];if(A(r)){Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!1,writable:!1});continue}let i=r,a={...i};`states`in i&&(a.states=uw(i.states)),`annotations`in i&&(a.annotations=lw(i.annotations)),Object.defineProperty(t,n,{value:Object.freeze(a),enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(t)},dw=e=>uw(e),fw=(e,t=``)=>{if(A(e)||typeof e!=`object`||!e)return e;if(`~effect/Machine/State`in e&&e[`~effect/Machine/State`]===`~effect/Machine/State`&&`node`in e)return e.node;let n=e,r={...n};if(XC(n,`fields`)&&(XC(n,`schema`)&&Q(`Machine.state`,t,`declare fields or schema, not both`),iw(`Machine.state`,t,n.fields,`state fields`),XC(n.fields,`_tag`)&&Q(`Machine.state`,t,`state fields cannot declare _tag`),r.schema=dr(t,n.fields),delete r.fields),XC(n,`states`)){iw(`Machine.state`,t,n.states,`child states`);let e=Object.create(null);for(let r of Reflect.ownKeys(n.states))rw(`Machine.state`,t,r),e[r]=fw(n.states[r],r);r.states=e}return t===``?(cw(`Machine.state`,{"":r},``,!1,!0),dw({"":r})[``]):r},pw=`~effect/Machine`,mw=`~effect/Machine/ChildMachine`,hw={...$r,...Mn,[pw]:pw,toJSON(){return{_id:`Machine`}}},gw=(e,t)=>{let n=Object.create(hw);return n.states=e.states,n.root=e.root,n.events=e.events,n.internalEvents=e.internalEvents,n.emittedEvents=e.emittedEvents,n.parent=e.parent,n.input=e.input,n.id=e.id,n.initial=e.initial,n.initialDefinition=e.initialDefinition,n.stateNodes=e.stateNodes,n.handlers=t,Cv(e,n),n},_w=e=>e.kind===`none`?k_:O_(e.kind,e.path,e.scope,e.updatePath),vw=e=>Object.freeze({path:e.path,kind:e.kind,scope:e.scope}),yw=e=>e.updatePath===void 0?e.kind===`update`&&e.path!==void 0?[e.path]:[]:[e.updatePath],bw=(e,t,n,r,i)=>{if(typeof e!=`object`||!e||!L(e,`target`)||typeof e.target!=`function`)throw Error(`Machine transition for state "${r}" on "${String(i)}" requires a target selector`);let a=e.target(t);if(!A_(a))throw Error(`Machine transition for state "${r}" on "${String(i)}" must select exactly one target`);if(a.updatePath!==void 0){let e=n.byPath.get(a.updatePath);if(a.kind!==`state`&&a.kind!==`choice`||a.scope!==`local`&&a.scope!==`branch`||a.path===void 0||e===void 0||e.schema===void 0||e.type!==`compound`&&e.type!==`parallel`||!ey(r,e.path)||!ey(a.path,e.path))throw Error(`Machine updating owner "${a.updatePath}" must be a valued ancestor retained by source "${r}" and target "${a.path}"`)}return{...e,selection:a}},xw=(e,t,n)=>{if(t.kind===`none`){if(e!==void 0)throw Error(`Machine targetless transition resolver must return undefined`);return}if(t.kind===`update`){if(!M_(e)||e.path!==t.path)throw Error(`Machine state update for "${t.path}" must return its selected update builder`);return}if(t.updatePath!==void 0){if(!P_(e)||e.update.path!==t.updatePath)throw Error(`Machine target updating "${t.updatePath}" must return target construction .update(...)`)}else if(P_(e))throw Error(`Machine combined target requires an updating owner declaration`);if(e===void 0)return;let r=P_(e)?e.target:e,i=typeof r==`object`&&r&&L(r,`path`)&&typeof r.path==`string`?r.path:void 0,a=t.path===void 0?void 0:n.byPath.get(t.path),o=(t.scope===`local`||t.scope===`branch`)&&(a?.type===`compound`||a?.type===`parallel`);if(i===void 0||i!==t.path&&!(o&&ey(i,t.path)))throw Error(`Machine transition resolver selected "${t.path}" but constructed "${i??`<invalid>`}"`)},Sw=(e,t,n,r,i)=>{let a={...t,root:i===``?t.state:t.ancestors[``],decline:V_};delete a.target;let o=e.resolve(a,n);if(H_(o)){if(e.declinable!==!0)throw Error(`Machine transition for state "${i}" returned decline without declaring declinable: true`);return o}return xw(o,e.selection,r),o},Cw=e=>e.kind===`update`?void 0:e.path,ww=e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<4294967295&&String(t)===e},Tw=(e,t,n)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Machine branching transition for state "${t}" on "${String(n)}" requires a branch record`);if(Object.getOwnPropertySymbols(e).length>0)throw Error(`Machine branching transition for state "${t}" on "${String(n)}" cannot use symbol keys`);let r=Object.keys(e);if(r.length===0)throw Error(`Machine branching transition for state "${t}" on "${String(n)}" requires a branch`);return Object.freeze(r.map(r=>{if(r.length===0||ww(r))throw Error(`Machine branching transition for state "${t}" on "${String(n)}" requires non-index string branch keys`);let i=e[r];if(typeof i!=`object`||!i||!L(i,`target`))throw Error(`Machine transition branch "${r}" requires a target selection`);let{target:a,title:o}=i;if(!A_(a))throw Error(`Machine transition branch "${r}" must select exactly one target`);if(o!==void 0&&(typeof o!=`string`||o.length===0))throw Error(`Machine transition branch "${r}" title must be a non-empty string`);return Object.freeze({key:r,title:o??r,selection:_w(a)})}))},Ew=(e,t,n,r={},i)=>{let a=Wy(r);if(e.kind===`choice`&&e.updatePath!==void 0){let{update:n,...r}=a;if(Reflect.ownKeys(r).length>0)throw Error(`Machine pseudo-state construction accepts no data`);let i=t.byPath.get(e.path);return N_(q_(i.path,i.parent),qy(t,e.updatePath,n))}if(e.kind===`none`||e.kind===`history`||e.kind===`choice`){if(Reflect.ownKeys(a).length>0)throw Error(`Machine pseudo-state construction accepts no data`);if(e.kind===`none`)return;let n=t.byPath.get(e.path);return e.kind===`history`?U_(n.path,n.parent):q_(n.path,n.parent)}if(e.kind===`update`)return qy(t,e.path,a);if(e.path===``){if(Reflect.ownKeys(a).some(e=>e!==`input`))throw Error(`Machine initialize branches accept input only`);if(n.initialize===void 0)throw Error(`Machine root initialization is unavailable`);return n.initialize(a.input)}if(e.updatePath!==void 0){let{update:n,...r}=a;return N_(Ky(t,e.path,r,i),qy(t,e.updatePath,n))}return Ky(t,e.path,a,i)},Dw=(e,t,n,r,i)=>Object.freeze(Object.fromEntries(e.map((e,a)=>[e.key,o=>F_(t,a,e.key,e.selection.kind===`none`?R_():Ew(e.selection,n,r,o,i))]))),Ow=(e,t,n)=>{if(t.kind===`none`){if(!z_(e))throw Error(`Machine targetless branch must return its selected targetless builder`)}else{if(e===void 0)throw Error(`Machine transition branch selected "${t.path}" without constructing its target`);xw(e,t,n)}},kw=(e,t)=>({...e,root:t===``?e.state:e.ancestors[``]}),Aw=(e,t,n,r)=>{if(typeof e!=`object`||!e)throw Error(`Machine transition for "${n}" must be an object`);let i={...e},a=[`target`,`update`,`initialize`,`history`,`none`,`branches`,`data`,`decoded`,`resolve`,`guard`,`reenter`,`declinable`];for(let e of Reflect.ownKeys(i))if(typeof e!=`string`||!a.includes(e))throw Error(`Machine transition contains an unknown field`);for(let e of[`resolve`,`guard`])if(i[e]!==void 0&&typeof i[e]!=`function`)throw Error(`Machine transition ${e} must be a function`);let o=typeof i.guard==`function`?i.guard:void 0,s=typeof i.resolve==`function`?i.resolve:void 0;if(i.decoded!==void 0&&typeof i.decoded!=`boolean`)throw Error(`Machine decoded must be a boolean construction flag`);let c=Object.prototype.hasOwnProperty.call(i,`data`);if(i.decoded===!0&&!c)throw Error(`Machine decoded construction requires data`);if(c&&s!==void 0)throw Error(`Machine data and resolve are mutually exclusive`);let l=i.data,u=typeof l==`function`?l:()=>l,d=o!==void 0,f=d||i.declinable===!0;if(typeof i.branches==`string`){let e=t.branches.get(i.branches);if(e===void 0||s===void 0)throw Error(`Machine branching transition requires a registered group and resolver`);if([`target`,`update`,`initialize`,`history`,`none`,`data`,`decoded`].some(e=>i[e]!==void 0))throw Error(`Machine branching transition cannot redeclare its destination`);let a=Object.fromEntries(Object.entries(e).map(([e,i])=>[e,{title:i.title,target:bw({target:()=>eb(t,i)},void 0,r,n,e).selection}]));return{branches:()=>a,reenter:i.reenter,declinable:f,resolve:(e,t)=>d&&!o(e)?V_():s(e,t)}}let p=eb(t,i);if(s!==void 0&&p.kind!==`none`)throw Error(`Machine advanced construction requires a declared branch group`);let m=i.initialize,h=m!==void 0;if(h&&(c||i.decoded!==void 0))throw Error(`Machine initialize accepts machine input instead of data`);if(h&&!t.input&&m!==!0)throw Error(`Machine initialize requires true when the machine declares no input`);let g=t.input?typeof m==`function`?m:()=>m:()=>void 0;return{target:()=>p,reenter:i.reenter,declinable:f,resolve:(e,a)=>{if(d&&!o(e))return V_();if(s!==void 0)return s(e,a);if(h)return Ew(p,r,t,{input:g(e)});let l=u(e);return Ew(p,r,t,p.updatePath===void 0?{...c?{data:l}:{},...i.decoded===void 0?{}:{decoded:i.decoded}}:p.kind===`choice`?{update:{data:l,decoded:i.decoded}}:{...l.target===void 0?{}:{data:l.target,decoded:i.decoded},update:{data:l.update,decoded:i.decoded}},n)}}},jw=(e,t,n,r,i)=>{let a=Aw(e,r,n,t);if(typeof a!=`object`||!a)throw Error(`Machine transition for state "${n}" on "${String(i)}" must be an object`);let o=a,s=o.reenter===!0,c=o.declinable===!0;if(L(o,`branches`)){let e=o;if(typeof e.branches!=`function`||typeof e.resolve!=`function`)throw Error(`Machine branching transition for state "${n}" on "${String(i)}" requires branches and resolve`);let a=e.resolve,l=Tw(e.branches(),n,i),u=Object.freeze({}),d=(e,o)=>{let s={...e,root:n===``?e.state:e.ancestors[``],decline:V_};delete s.target,s.select=Dw(l,u,t,r,n);let d=a(s,o);if(H_(d)){if(!c)throw Error(`Machine branching transition for state "${n}" on "${String(i)}" returned decline without declaring declinable: true`);return{result:d,branchIndex:-1,branchKey:void 0}}if(!I_(d)||d.owner!==u)throw Error(`Machine branching transition for state "${n}" on "${String(i)}" must select one declared branch`);let f=l[d.branchIndex];if(f===void 0||d.branchKey!==f.key)throw Error(`Machine branching transition returned invalid branch evidence`);return Ow(d.result,f.selection,t),{result:d.result,branchIndex:d.branchIndex,branchKey:d.branchKey}};return{reenter:s,declinable:c,targets:[...new Set(l.flatMap(e=>Cw(e.selection)===void 0?[]:[e.selection.path]))],branches:l.map(e=>Object.freeze({type:`branch`,key:e.key,title:e.title,target:Cw(e.selection),selection:vw(e.selection),updates:yw(e.selection)})),evaluate:d,transition:(e,t)=>d(e,t).result}}let l=bw(a,void 0,t,n,i),u=(e,r)=>({result:Sw(l,e,r,t,n),branchIndex:0,branchKey:void 0});return{reenter:s,declinable:c,targets:Cw(l.selection)===void 0?[]:[l.selection.path],branches:[{type:`direct`,target:Cw(l.selection),selection:vw(l.selection),updates:yw(l.selection)}],evaluate:u,transition:(e,t)=>u(e,t).result}},Mw=(e,t,n,r)=>{let i=Object.create(null);for(let a of Reflect.ownKeys(e))i[a]=jw(e[a],t,n,r,a);return i},Nw=(e,t,n,r)=>{let i=(Array.isArray(e)?e:[e]).map(e=>{let i=tb(r,e,n,e=>kw(e,n));for(let e of[`onElement`,`onDone`,`onFailure`,`onSnapshot`])i[e]!==void 0&&(i[e]=jw(i[e],t,n,r,e));return fb(i,n)});return mb(i,n),Array.isArray(e)?Object.freeze(i):i[0]},Pw=(e,t,n,r,i,a)=>{for(let o of Object.keys(a)){let s=r===``?o:`${r}.${o}`;if(!L(n,o))throw Error(`Machine received handler for unknown state "${s}"`);let c=a[o];if(typeof c!=`object`||!c)throw Error(`Machine expected state "${s}" handler to be an object`);let{states:l,...u}=c;typeof u.history==`object`&&u.history!==null&&(u.history=Object.freeze(Object.fromEntries(Object.entries(u.history).map(([e,t])=>[e,typeof t==`object`&&t?Object.freeze({...t}):t]))));let d=u.on;if(typeof d==`object`&&d&&(u.on=Mw(d,t,s,i)),u.always!==void 0&&(u.always=jw(u.always,t,s,i,`always`)),u.onDone!==void 0&&(u.onDone=jw(u.onDone,t,s,i,`done`)),u.choice!==void 0&&(u.choice=jw(u.choice,t,s,i,`choice`)),u.invoke!==void 0&&(u.invoke=Nw(u.invoke,t,s,i)),t.byPath.get(s)?.type===`choice`&&(typeof u.choice!=`object`||u.choice===null||!L(u.choice,`transition`)||typeof u.choice.transition!=`function`||!L(u.choice,`targets`)||!Array.isArray(u.choice.targets)||u.choice.targets.length===0))throw Error(`Machine choice state "${s}" requires a transition`);if(e[s]=u,l!==void 0){let r=Y_(s,n[o]);if(r.states===void 0)throw Error(`Machine expected state "${s}" to declare child states`);if(typeof l!=`object`||!l)throw Error(`Machine expected state "${s}" child handlers to be an object`);Pw(e,t,r.states,s,i,l)}}},Fw=e=>e===``?Xy:e,Iw=e=>{let t=!1;for(let n of e.stateNodes.byPath.values())if(n.type===`choice`){t=!0;break}if(!t)return;let n=$_(e),r=new Map;for(let e of n)e.trigger.type===`choice`&&r.set(e.source,e);for(let e of n)for(let t of e.branches){let n=t.updates[0],i=t.selection.path;if(t.selection.kind!==`choice`||n===void 0||i===void 0)continue;let a=[i],o=new Set;for(;a.length>0;){let t=a.shift();if(!o.has(t)){o.add(t);for(let i of r.get(t)?.branches??[]){let{kind:r,path:o}=i.selection;if(o!==void 0&&r!==`none`&&r!==`update`){if(r===`choice`)a.push(o);else if(!ey(o,n)){let r=i.type===`branch`?`branch "${i.key}"`:`transition`;throw Error(`Machine transition from "${Fw(e.source)}" updates "${Fw(n)}" before choice "${t}", whose ${r} targets "${Fw(o)}" outside that owner`)}}}}}}},Lw=(e,t)=>(n=>{let r=db(t.root,n),i=Object.assign(Object.create(hw),e);if(Cv(e,i),i.states=Object.freeze({"":r.node}),i.stateNodes=X_(i.states),i.stateNodes.byPath.get(``).schema===void 0&&n.root!==void 0)throw Error(`Machine schema-less root cannot construct data`);let a=i.stateNodes.byPath.get(``).schema===void 0?()=>void 0:lb(n.root);i.initial=e=>({...G_(``,a({input:e})),input:{value:e}}),i.initialDefinition=Object.freeze({target:``,selection:Object.freeze({path:``,kind:`initial`,scope:`initial`})});let o=Object.create(null);Pw(o,i.stateNodes,i.states,``,{...t,initialize:e=>i.initial(i.input===void 0?void 0:Vv(i,i.input,e))},{"":r.handlers});let s=gw(i,o);return Iw(s),s}),Rw=e=>{let t=fw(e),n=zw();return Object.freeze({...n,"~effect/Machine/State":`~effect/Machine/State`,node:t})},zw=()=>({path:(e=>e),get:((e,t)=>av(e,t).pipe(Gr(e=>e.value))),getWithParents:((e,t)=>{let n={};return av(e,t,n).pipe(Gr(e=>({value:e.value,parents:n})))}),getSnapshot:av,matches:((e,t)=>O(av(e,t)))}),Bw=e=>{if(Object.hasOwn(e,`initial`)||Object.hasOwn(e,`initialConfiguration`))throw Error(`Machine initial edges and root data belong in handle`);let t=Object.freeze({"":e.root.node}),n=Object.create(Mn);return n.states=t,n.root=e.root,n.events=e.events,n.internalEvents=e.internalEvents??Ov(`internal`,[]),n.emittedEvents=e.emittedEvents??Ov(`emitted`,[]),n.parent=e.parent,n.input=e.input,n.id=e.id,n.handlers=Object.create(null),n.handle=Lw(n,Qy(e.root,e)),Sv(n),n},Vw=e=>{for(let[t,n]of Object.entries(e))if(Object.hasOwn(n,`_tag`))throw Error(`Machine event "${t}" fields cannot declare _tag`);return Object.keys(e).length===0?[]:[We(e)]},Hw=e=>Ov(`public`,Vw(e)),Uw=(e,t)=>Ww(e,t,e=>t.input===void 0?WC(t):WC(t,e)),Ww=(e,t,n)=>({[mw]:mw,id:e,machine:t,[ib]:n}),Gw=KC,Kw=qC,qw=Rw,Jw=Bw,Yw=Hw,Xw=(e,t)=>{try{let n=bx(e,...t);return{machine:e,snapshot:n.done?{status:`done`,state:n.state,output:n.output}:{status:`active`,state:n.state}}}catch{return}},Zw=(e,t)=>{try{let n=u(jC(e,t));if(n._tag===`Failure`)return;let r=n.value;if(!vx(e,r))return{machine:e,snapshot:{status:`active`,state:r}};let i=u(yx(e,r,_x));return i._tag===`Success`?{machine:e,snapshot:{status:`done`,state:r,output:i.value}}:void 0}catch{return}},Qw={spawn:()=>or(Error(`Child operations are unavailable in a planned snapshot`)),sendTo:()=>V(new d_),stop:()=>F},$w=(e,t)=>{if(e.snapshot.status!==`active`)return Qt();try{let n=e.machine,r=xy(n,e.snapshot.state);for(let e of fy(n,r)){let i=jy(n,e);for(let a of hb(i?.invoke)){if(!(`child`in a)||a.child.id!==t.id||a.child.machine!==t.machine)continue;let i=t.machine,o;`input`in a&&(o=typeof a.input==`function`?a.input({...Zv(r)??Nb(n,r),children:Qw,state:r.values.get(e),containingState:dy(n,r,e),ancestors:uy(n,r,e),event:_x}):a.input);let s=Xw(i,i.input===void 0?[]:[o]);return s===void 0?void 0:nn(s)}}return Qt()}catch{return}},eT=class extends Xr(`ChildNotActiveError`){},tT=new WeakMap,nT=new WeakMap,rT=e=>typeof e==`object`&&!!e&&nT.has(e),iT=e=>{if(typeof WeakRef>`u`||typeof FinalizationRegistry>`u`)return Xn(e);let t=De(),n=new FinalizationRegistry(({entry:e,key:n})=>{let r=en(t,n);O(r)&&r.value===e&&Yt(t,n)});return r=>{let i=en(t,r);if(O(i)){let e=i.value.ref.deref();if(e!==void 0)return e}let a=e(r),o={ref:new WeakRef(a)};return on(t,r,o),n.register(a,{key:r,entry:o}),a}},aT=(e,t)=>Ue(qr(t,e=>e.stop).pipe(ze(t=>j(()=>e.setSelf(he(t)))),z(()=>Mi))),oT=(e,t)=>aT(e,e.result(t).pipe(z(e=>e.start))),sT=(e,t,n)=>aT(e,Kw(t,n)),cT=(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[Sr](t):t(e),lT=(e,t)=>{let n;return r=>{let i=e(r);return n!==void 0&&n.inputs.length===i.length&&n.inputs.every((e,t)=>Object.is(e,i[t]))||(n={inputs:i,value:t(...i)}),n.value}},uT=e=>{let t;return()=>(t===void 0&&(t={value:e()}),t.value)},dT=e=>e.snapshot,fT=Oi(e=>e.registry).pipe(_i),pT=e=>D(()=>{let t=e.pending.shift();return t===void 0?(e.draining=!1,F):I(t,pT(e))}),mT=(e,t)=>{let n=e.get(t);return n===void 0&&(n={pending:[],draining:!1},e.set(t,n)),n},hT=(e,t,n)=>Xe(n=>{let r=Pt(n(e),()=>void 0),i=t.get(n.registry);return i===void 0||!i.draining?r:k(Gr(n.self(),Ot),()=>ye(!0))},(r,i)=>{let a=r.get(e),o=r.get(fT),s=mT(t,o);dt(a)||s.draining?(r.setSelf(ye(!0)),s.pending.push(fr(o,e).pipe(z(e=>n(e,i)),Lr,U(e=>{let t=et(e);r.setSelf(s.pending.length===0?t:Ot(t))}))),s.draining||(s.draining=!0,ee(pT(s)))):Fe(a)?r.setSelf(Pt(a,()=>void 0)):ie(n(a.value,i),{onExit:e=>r.setSelf(et(e))})}).pipe(C),gT=e=>Oi(t=>{let n=t(e);return dt(n)?ye(n.waiting):Fe(n)?Ge(n.cause,{previous:t.self(),waiting:n.waiting}):n.value.status===`error`?Ge(n.value.cause,{previous:t.self(),waiting:n.waiting}):he(n.value.state,{waiting:n.waiting})}).pipe(Si(ar),ne(lT(t=>[cT(e,t)],e=>Pt(e,e=>e.state)))),_T=e=>Oi(t=>{let n=t(e);if(dt(n))return ye(n.waiting);if(Fe(n))return Ge(n.cause,{previous:t.self(),waiting:n.waiting});if(Vt(n.value)){let e=t.self();return O(e)&&Fe(e.value)?e.value:he(Qt(),{waiting:n.waiting})}return n.value.value.status===`error`?Ge(n.value.value.cause,{previous:t.self(),waiting:n.waiting}):he(nn(n.value.value.state),{waiting:n.waiting})}).pipe(Si(ar),ne(lT(t=>[cT(e,t)],e=>Pt(e,Gr(e=>e.state))))),vT=(e,t)=>Oi(n=>{let r=n(e);if(dt(r))return ye(r.waiting);if(Fe(r))return Ge(r.cause,{previous:n.self(),waiting:r.waiting});if(Vt(r.value))return he(Qt());let i=r.value.value,a=hr(i.child(t)),o=ie(Jr.pipe(I(i.childChanges(t).pipe(mr(e=>j(()=>n.setSelf(he(e))))))));return n.addFinalizer(o),he(a)}).pipe(C),yT=(e,t)=>gS(e)?e[hS](()=>t(hr(e.snapshot))):ie(e.changes.pipe(mr(e=>j(()=>t(e))))),bT=(e,t,n)=>{let r=Oi(t=>{let n=t(e);if(dt(n))return ye(n.waiting);if(Fe(n))return Ge(n.cause,{previous:t.self(),waiting:n.waiting});if(Vt(n.value))return he(Qt());let r=n.value.value;return t.addFinalizer(yT(r,e=>t.setSelf(he(nn(e))))),he(nn(hr(r.snapshot)))}).pipe(ne(lT(()=>[],()=>{let e=n();return e===void 0?ye(!0):he(Gr(e,dT),{waiting:!0})}))),i=new WeakMap,a=e=>O(e)?P(e.value):V(new eT({id:t.id})),o=hT(e,i,(e,t)=>z(a(e),e=>e.send(t))),s=hT(e,i,(e,t)=>z(a(e),e=>e.stop)),c=xT(e,n);return{ref:e,snapshot:r,result:_T(r),send:o,stop:s,child:c}},xT=(e,t)=>{let n=new WeakMap;return r=>{let i=n.get(r.machine);if(i===void 0){let a=r.machine,o=Xn(n=>{let r=Uw(n,a);return bT(vT(e,r),r,uT(()=>{let e=t();return e===void 0||Vt(e)?e:$w(e.value,r)}))});i=e=>o(e),n.set(a,i)}return i(r.id)}},ST=(e,t,n)=>{let r=C(e),i=Oi(e=>{let t=e(r);if(dt(t))return ye(t.waiting);if(Fe(t))return Ge(t.cause,{previous:e.self(),waiting:t.waiting});let n=t.value;e.addFinalizer(yT(n,t=>e.setSelf(he(t,{waiting:t.status===`active`}))));let i=hr(n.snapshot);return he(i,{waiting:i.status===`active`})}).pipe(ne(lT(()=>[],()=>{let e=n();return e===void 0?ye(!0):he(dT(e),{waiting:!0})}))),a=new WeakMap,o=hT(r,a,(e,t)=>e.send(t)),s=hT(r,a,(e,t)=>e.stop),c=xT(_n(r,nn),()=>{let e=n();return e===void 0?void 0:nn(e)}),l={ref:r,snapshot:i,result:gT(i),send:o,stop:s,child:c};return nT.set(l,t),l},CT=(e,t)=>av(e,t).pipe(Gr(e=>e.value)),wT=(e,t)=>av(e,t),TT=(e,t)=>_n(e,t).pipe(Si(ar),ne(lT(t=>[cT(e,t)],e=>Pt(e,t)))),ET=new WeakMap,DT=(e,t,n,r)=>{let i=ET.get(e);i===void 0&&(i=new Map,ET.set(e,i));let a=i.get(t);a===void 0&&(a=new Map,i.set(t,a));let o=a.get(n);if(o!==void 0)return o;let s=r();return a.set(n,s),s},OT=(e,t)=>DT(e,`select`,t,()=>TT(e.result,e=>CT(e,t))),kT=(e,t)=>DT(e,`selectSnapshot`,t,()=>TT(e.result,e=>wT(e,t))),AT=(e,t)=>DT(e,`selectChild`,t,()=>TT(e.result,Ri(e=>CT(e,t)))),jT=(e,t)=>DT(e,`selectSnapshotChild`,t,()=>TT(e.result,Ri(e=>wT(e,t)))),MT=(e,t)=>DT(e,`matches`,t,()=>TT(e.result,e=>O(av(e,t)))),NT=(e,t)=>DT(e,`matchesChild`,t,()=>TT(e.result,Ie(e=>O(av(e,t))))),PT=(e,t,n)=>{let r=e.atom(()=>Gw(t,...n)),i=ST(e.atom(e=>oT(e,r)),t,uT(()=>Xw(t,n)));return tT.set(i,r),i},FT=(e,t,n)=>ST(e.atom(e=>sT(e,t,n)),t,uT(()=>Zw(t,n))),IT=(e,t,n)=>{let r={owner:e,source:t},i=_(t,e=>e(r.source),{initialValueTarget:t}).pipe(Si((e,t)=>r.source.equals(e,t)),ne(e=>cT(r.source,e)));return n!==void 0&&(i=i.pipe(St(n))),i},LT=(e,t)=>{let n=iT(t=>({bridge:e(t)})),r={};for(let e of Object.keys(t.atoms)){let i=t.atoms[e];r[e]=iT(r=>{let a=n(r);return IT(a,i(a.bridge),t.label?.(r,e))})}return r},RT=e=>{let t=((t,...n)=>PT(e,t,n));return{make:t,factory:(e=>(...n)=>t(e,...n)),resume:((t,n)=>FT(e,t,n)),family:((t,n)=>LT(n=>PT(e,t,[n]),n))}},zT=rT;br(2,OT);var BT=br(2,kT);br(2,AT);var VT=br(2,jT);br(2,MT),br(2,NT);var HT=RT,UT=`https://auth.mp281x.xyz`,WT=gi(Pn(xr(`AUTH_URL`)),Vt);Er(function*(){let e=Dn(N,`GITHUB_ADMINS`);return(yield*WT)?yield*Un(e,[`0`]):yield*e}),pn()(`@deslop/runtime/auth/lib/utils/CurrentUser`);var GT=class extends Nr()(`@deslop/runtime/auth/lib/utils/RpcAuth`,{error:Y}){},KT=R({name:S,open:S,origin:Kf}),qT=Dr(KT);R({origin:Kf});var JT=R({incarnation:S,user:Uf});pn()(`@deslop/auth/services/tokens/schema/CurrentOwner`);var YT=R({...JT.fields,incarnation:H(S,sn(P(`legacy`)))}),XT=R({client_name:B(N.check(Hi(100))),redirect_uris:xt(S.check(Hi(200))).check(Hi(4)),token_endpoint_auth_method:B(xn(`none`))});R({name:N,redirects:XT.fields.redirect_uris}),R({client_id:S.check(Hi(2048)),redirect_uri:B(N),state:B(N)}),R({code_challenge:B(S),code_challenge_method:B(N),resource:B(Ur(N)),response_type:B(N),scope:B(N)});var ZT=R({challenge:S,clientId:S,clientName:N,redirectUri:S,resources:xt(Wf),state:B(S)});R({grant_type:N});var QT=B(Ur(Wf).check(g(1)));Ye([R({client_id:S,code:S,code_verifier:S,grant_type:xn(`authorization_code`),redirect_uri:B(N),resource:QT}),R({client_id:B(N),grant_type:xn(`refresh_token`),refresh_token:S,resource:QT})]);var $T=R({access_token:S,expires_in:dn,refresh_token:S,scope:xn(`deslop`),token_type:xn(`Bearer`)});We({Granted:{tokens:$T},Replayed:{message:N}});var eE=R({address:B(N),userAgent:B(N)}),tE=R({expiresAt:dn,hash:N,resources:Dr(Wf)}),nE=Ni([`Code`,`GitHub`,`Passkey`]),rE=R({...YT.fields,client:N,createdAt:dn,credential:We({App:{access:Dr(tE),clientId:S,expiresAt:dn,generation:xi,hash:N,replaced:B(Ye([N,Dr(N)])),resources:Dr(Wf)},Browser:{expiresAt:dn,hash:N,via:B(nE)}}),device:N,lastActive:dn,origin:eE});ae(N,rE);var iE=R({address:B(N),client:N,createdAt:dn,device:N,expiresAt:dn,family:S,kind:Ni([`App`,`Browser`]),lastActive:dn,resources:Dr(Wf)}),aE=R({family:S});R({client_id:S,token:S}),R({resource:Wf});var oE=Ni([`ble`,`cable`,`hybrid`,`internal`,`nfc`,`smart-card`,`usb`]),sE=xn(`public-key`),cE=Ni([`required`,`preferred`,`discouraged`]),lE=R({id:N,transports:B(me(Dr(oE))),type:sE}),uE=R({attestation:B(Ni([`direct`,`enterprise`,`indirect`,`none`])),authenticatorSelection:B(R({authenticatorAttachment:B(Ni([`cross-platform`,`platform`])),requireResidentKey:B(er),residentKey:B(Ni([`discouraged`,`preferred`,`required`])),userVerification:B(cE)})),challenge:N,excludeCredentials:B(me(Dr(lE))),pubKeyCredParams:me(Dr(R({alg:dn,type:sE}))),rp:R({id:B(N),name:N}),timeout:B(dn),user:R({displayName:N,id:N,name:N})}),dE=R({allowCredentials:B(me(Dr(lE))),challenge:N,rpId:B(N),timeout:B(dn),userVerification:B(cE)}),fE=B(Ni([`cross-platform`,`platform`])),pE=R({authenticatorAttachment:fE,clientExtensionResults:R({}),id:N,rawId:N,response:R({attestationObject:N,clientDataJSON:N,transports:B(Dr(N))}),type:sE}),mE=R({authenticatorAttachment:fE,clientExtensionResults:R({}),id:N,rawId:N,response:R({authenticatorData:N,clientDataJSON:N,signature:N,userHandle:B(N)}),type:sE});R({challenge:N});var hE=R({...YT.fields,addedFrom:N,counter:xi,createdAt:dn,id:S,lastUsed:dn,publicKey:S,synced:er,transports:Dr(oE)});Dr(hE);var gE=R({addedFrom:N,createdAt:dn,id:S,lastUsed:dn,synced:er}),_E=R({id:S}),vE=R({response:pE}),yE=R({next:B(S.check(Hi(2048))),response:mE}),bE=Ni([`Admin`,`Member`,`Waiting`]),xE=R({...Uf.fields,fullName:B(N),role:bE}),SE=R({...xE.fields,via:nE}),CE=R({...xE.fields,since:dn}),wE=Ni([`Waiting`,`Allowed`]),TE=R({fullName:N,id:S,incarnation:YT.fields.incarnation,name:S,since:dn,status:wE});Dr(TE),R({id:xi,login:S,name:B(Di(N))});var EE=R({allow:er,id:S}),DE=R({id:S}),OE=Ni([`App`,`Browser`]),kE=R({address:B(N),clientName:N,createdAt:dn,device:N,expiresAt:dn,id:S,kind:OE,resources:Dr(Wf)}),AE=We({Decided:{},Expired:{},Waiting:{request:kE}}),jE=We({Browser:{next:B(N)},Client:{request:ZT}});We({Redirect:{url:S},Session:{next:B(N),seconds:xi,token:S},Waiting:{}}),R({delivery:jE,origin:eE}),R({next:B(S.check(Hi(2048)))});var ME=R({request:S.check(Hi(20))}),NE=R({code:S.check(Hi(20))}),PE=R({...ME.fields,accept:er}),FE=class extends Nr()(`@deslop/auth/rpcs/RpcOwner`,{error:Y}){},IE=class extends ni(On(`auth.lookup`,{error:Y,payload:NE,stream:!0,success:Dt(kE)}),On(`auth.answer`,{error:Y,payload:PE}),On(`auth.people`,{error:Y,stream:!0,success:Dr(CE)}),On(`auth.admit`,{error:Y,payload:EE,success:CE}),On(`auth.remove`,{error:Y,payload:DE,success:CE}),On(`auth.apps`,{error:Y,stream:!0,success:Dr(iE)}),On(`auth.catalog`,{error:Y,stream:!0,success:qT}),On(`auth.disconnect`,{error:Y,payload:aE}),On(`auth.passkeys`,{error:Y,stream:!0,success:Dr(gE)}),On(`auth.passkeyOptions`,{error:Y,success:uE}),On(`auth.addPasskey`,{error:Y,payload:vE}),On(`auth.removePasskey`,{error:Y,payload:_E})).middleware(GT).middleware(FE).merge(ni(On(`auth.account`,{error:Y,stream:!0,success:SE}),On(`auth.wait`,{error:Y,payload:ME,stream:!0,success:AE}))){};function LE(e){return wr(vr(/[^a-z]/giu,``)(e))}function RE(e){return ft(Ft(e),Zr)}hi(function*(e,t,n){if(Vt(RE(n.response_type)))return yield*Y.make({message:`Send response_type=code`});if(n.response_type!==`code`)return yield*Y.make({error:`unsupported_response_type`,message:`Only response_type=code is supported`});if(n.code_challenge===void 0||n.code_challenge_method!==`S256`)return yield*Y.make({message:`Send a PKCE code_challenge with code_challenge_method=S256`});if(!Br(Cr(An(n.scope??``,` `),Zr),e=>e===`deslop`||e===`offline_access`))return yield*Y.make({error:`invalid_scope`,message:`Only the deslop scope is supported`});let r=yield*H(Ce(xt(Wf))(n.resource??[]),bn(e=>Y.make({cause:e,error:`invalid_target`,message:`Name a Deslop app with the resource parameter`})));return ZT.make({challenge:n.code_challenge,clientId:e.client_id,clientName:t.clientName,redirectUri:t.redirectUri,resources:r,...Te(RE(e.state),{onNone:()=>({}),onSome:e=>({state:e})})})});function zE(e){return H(new URL(e).hostname,An(`.`),Bn(1),v(`.`))}function BE(e,t){let n=zE(t);return be(Mr(e),{onFailure:()=>!1,onSuccess:e=>e.protocol===`https:`&&(e.hostname===n||ci(`.${n}`)(e.hostname))&&kr(e.username)&&kr(e.password)})}var VE=_t(we),HE=R({code:B(N),error:B(N),next:B(N),request:B(N),"sign-out":B(N)}),$=class extends Sn()(`@deslop/auth/lib/utils/RpcClient`,{group:IE,protocol:sp(`@deslop/auth`)}){},UE=_i($.runtime.atom(H($,U(e=>e(`auth.account`,void 0)),qe,ap,Ti(nn),Qn(`AuthError`,()=>b(Qt()))))),WE={accept:er,request:kE},GE=HT($.runtime).make(Jw({branches:{looked:{found:{target:`Code.Found`},missing:{target:`Code.Missing`}}},events:Yw({Answered:WE,Typed:{typed:N}}),root:qw({states:{Code:{fields:{code:N},states:{Failed:{fields:{message:N}},Found:{fields:{request:kE}},Looking:{},Missing:{}}},Typing:{fields:{answered:B(R(WE)),typed:N}}}}),streams:{lookup:e=>ap(qe(U($,t=>t(`auth.lookup`,{code:e}))))}}).handle({initial:{data:{typed:``},target:`Typing`},on:{Answered:{data:e=>({answered:{accept:e.event.accept,request:e.event.request},typed:``}),target:`Typing`},Typed:{data:e=>({typed:e.event.typed}),target:`Typing`}},states:{Code:{initial:{target:`Code.Looking`},invoke:{input:e=>e.state.code,onDone:{none:!0},onElement:{branches:`looked`,resolve:e=>Te(e.element,{onNone:()=>e.select.missing(),onSome:t=>e.select.found({data:{request:t}})})},onFailure:{data:e=>({message:e.error.message}),target:`Code.Failed`},src:`lookup`},states:{Failed:{},Found:{},Looking:{},Missing:{}}},Typing:{always:{data:e=>({code:e.state.typed}),guard:e=>mn(e.state.typed)>=8,target:`Code`}}}})),KE=Xn(e=>Pi(t=>{t.set(GE.send,{_tag:`Typed`,typed:LE(e)})})),qE=_i($.runtime.atom(H($,U(e=>e(`auth.people`,void 0)),qe,ap))),JE=_i($.runtime.atom(H($,U(e=>e(`auth.apps`,void 0)),qe,ap)));function YE(e){return t=>ht(t,t=>j(()=>jg.add({description:t.message,title:e,type:`error`})))}var XE=$.runtime.fn(e=>H(z($,t=>Nn(e,e=>t(`auth.disconnect`,{family:e}),{concurrency:`unbounded`,discard:!0})),YE(`Cannot sign out`))),ZE=Xn(e=>$.runtime.fn(t=>z($,n=>n(`auth.admit`,{allow:t,id:e})))),QE=Xn(e=>$.runtime.fn(()=>z($,t=>t(`auth.remove`,{id:e})))),$E=Xn(e=>$.runtime.atom(H($,U(t=>t(`auth.wait`,{request:e})),qe,ap,lr(t=>H(Rr(t),sr(`Decided`,()=>j(()=>location.assign(`/auth/continue?${new URLSearchParams({request:e})}`))),ti(()=>F))))));function eD(e){return`${pi(0,4)(e)}-${pi(4)(e)}`}function tD(e){return`${location.origin}/?code=${e}`}var nD=_i($.runtime.atom(H($,U(e=>e(`auth.catalog`,void 0)),qe,ap)));function rD(e){return ki(e)?[`browser`]:kn(Ct(e,e=>new URL(e).origin))}var iD=Pi(H(He(`1 minute`),Tt(()=>je))),aD=Pi(H(He(`1 second`),Tt(()=>je)));function oD(e,t){let n=Zn(0,Math.ceil((e-t)/1e3));return`${Math.floor(n/60)}:${ii(2,`0`)(`${n%60}`)}`}var sD=Wn(e=>H(h({catch:e=>Y.make({cause:e,message:`Cannot copy the code; type it in instead`}),try:()=>navigator.clipboard.writeText(e)}),I(Je(`1200 millis`))));function cD(e,t){return Math.floor(nr(Vn(Tr(e),Tr(t))))}function lD(e){return e<1?`now`:e<60?`${e}m`:e<1440?`${Math.floor(e/60)}h`:`${Math.floor(e/1440)}d`}function uD(e,t){return`${e} · ${t}`}function dD(e){return Ze(e,0,(e,t)=>Zn(e,t.lastActive))}function fD(e){return H(Tr(e),Vr({day:`numeric`,month:`short`}))}function pD(e){return`https://avatars.githubusercontent.com/u/${Cn(`github:`,``)(e)}?s=96`}var mD=$.runtime.fn((e,t)=>H($,z(t=>t(`auth.answer`,{accept:e.accept,request:e.request.id})),I(j(()=>t.set(GE.send,{_tag:`Answered`,...e})))));function hD(e){return L(e.cause,`name`)&&e.cause.name===`NotAllowedError`}var gD=hi(function*(e){return e.status===429?yield*Y.make({message:`Too many tries; wait a minute and try again`}):yield*Y.make({message:(yield*n(R({error_description:N}))(e)).error_description})}),_D=VE.fn(e=>H(Er(function*(){let t=yield*Zt,r=yield*t.get(`/auth/passkey`);if(r.status!==200)return yield*gD(r);let i=yield*n(dE)(r),a=yield*ui(h({catch:e=>Y.make({cause:e,message:`No passkey was used`}),try:()=>s_({optionsJSON:i})}),hD,()=>$n),o=yield*H(Rn(`/auth/passkey`),di(yE)({...Te(Ft(e),{onNone:()=>({}),onSome:e=>({next:e})}),response:a}),z(e=>t.execute(e)),z(hi(function*(e){return e.status===200?yield*n(R({next:B(N)}))(e):yield*gD(e)})));yield*j(()=>Te(Ft(o.next),{onNone:()=>location.reload(),onSome:e=>location.assign(e)}))}),bn(e=>gt(Y)(e)?e:Y.make({cause:e,message:`Cannot sign in with a passkey`})))),vD=_i($.runtime.atom(H($,U(e=>e(`auth.passkeys`,void 0)),qe,ap))),yD=_i($.runtime.fn(hi(function*(){let e=yield*$,t=yield*e(`auth.passkeyOptions`,void 0);yield*e(`auth.addPasskey`,{response:yield*H(h({catch:e=>Y.make({cause:e,message:`No passkey was added`}),try:()=>n_({optionsJSON:t})}),ui(hD,()=>$n),z(Ce(pE)))}),jg.add({title:`Passkey added`})},YE(`Cannot add a passkey`)))),bD=`adding-passkey`,xD=Wn(()=>Rt({catch:e=>Y.make({cause:e,message:`Cannot start GitHub sign-in`}),try:()=>{sessionStorage.setItem(bD,`true`),location.assign(`/auth/github`)}})),SD=_i($.runtime.fn(e=>H(z($,t=>t(`auth.removePasskey`,{id:e})),YE(`Cannot remove the passkey`)))),CD=Wn(()=>Rt({catch:e=>Y.make({cause:e,message:`Cannot start GitHub sign-in`}),try:()=>location.assign(`/auth/github${location.search}`)})),wD=Wn(e=>Rt({catch:e=>Y.make({cause:e,message:`Cannot start the sign-in`}),try:()=>location.assign(Te(Ft(e),{onNone:()=>`/auth/code`,onSome:e=>`/auth/code?${new URLSearchParams({next:e})}`}))}));function TD(e){return H(Zt.use(e=>Gt(e).post(`/auth/sign-out`)),I(j(()=>location.replace(H(Ft(e),ft(e=>BE(e,UT)),k(()=>location.pathname))))),bn(e=>Y.make({cause:e,message:`Cannot sign out: ${e.message}`})))}var ED=VE.fn(TD),DD=VE.fn(e=>YE(`Cannot sign out`)(TD(e)));export{ug as $,Dl as $n,Gp as $t,$E as A,Lu as An,ma as Ar,vm as At,Wg as B,tu as Bn,mm as Bt,cD as C,Rf as Cn,Oa as Cr,Hm as Ct,qE as D,rd as Dn,ca as Dr,Rm as Dt,vD as E,Af as En,Ca as Er,Gm as Et,ED as F,Cu as Fn,Qi as Fr,gm as Ft,fg as G,Tl as Gn,am as Gt,Cg as H,Yl as Hn,hm as Ht,LE as I,Su as In,Zi as Ir,um as It,bg as J,Hl as Jn,em as Jt,mg as K,Kl as Kn,nm as Kt,zT as L,bu as Ln,Ji as Lr,pm as Lt,aD as M,Iu as Mn,la as Mr,wm as Mt,CD as N,Du as Nn,oa as Nr,_m as Nt,QE as O,Ku as On,ya as Or,Bm as Ot,uD as P,wu as Pn,$i as Pr,Sm as Pt,og as Q,Ll as Qn,Yp as Qt,BT as R,vu as Rn,dm as Rt,iD as S,Lf as Sn,wa as Sr,zm as St,_D as T,jf as Tn,Ea as Tr,Wm as Tt,xg as U,Vl as Un,om as Ut,Eg as V,Ql as Vn,fm as Vt,vg as W,Rl as Wn,sm as Wt,gg as X,Ul as Xn,Qp as Xt,dg as Y,Gl as Yn,Zp as Yt,hg as Z,wl as Zn,$p as Zt,fD as _,rp as _n,rc as _r,ph as _t,ZE as a,Hp as an,Ml as ar,ig as at,KE as b,zf as bn,Ia as br,th as bt,tD as c,Bp as cn,pl as cr,Gh as ct,nD as d,wp as dn,Gc as dr,Eh as dt,qp as en,Ol as er,_g as et,GE as f,hp as fn,Pc as fr,Dh as ft,sD as g,ip as gn,ic as gr,fh as gt,mD as h,np as hn,nc as hr,mh as ht,yD as i,Up as in,jl as ir,sg as it,eD as j,Ru as jn,ga as jr,bm as jt,SD as k,Hu as kn,ta as kr,ym as kt,JE as l,Op as ln,rl as lr,xh as lt,xD as m,cp as mn,oc as mr,vh as mt,HE as n,Jp as nn,Al as nr,lg as nt,lD as o,zp as on,zl as or,ag as ot,wD as p,gp as pn,uc as pr,yh as pt,pg as q,Cl as qn,tm as qt,UE as r,Wp as rn,kl as rr,cg as rt,rD as s,Lp as sn,yl as sr,Yh as st,bD as t,Kp as tn,Bl as tr,yg as tt,pD as u,kp as un,Xc as ur,bh as ut,XE as v,Pf as vn,ms as vr,sh as vt,dD as w,Mf as wn,Ta as wr,Um as wt,DD as x,Ff as xn,Pa as xr,eh as xt,oD as y,Bf as yn,La as yr,ih as yt,VT as z,iu as zn,lm as zt};