@deslop/auth 0.1.1254 → 0.1.1258

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,Aa as c,Ai as l,An as u,Ar as d,At as f,Ba as p,Bi as m,Bn as h,Br as g,Bt as _,C as v,Ci as y,Cn as b,Cr as x,Ct as S,D as C,Da as w,Di as T,Dn as ee,Dr as te,Dt as E,E as ne,Ea as D,Ei as re,En as ie,Et as ae,Fa as oe,Fi as se,Fn as O,Fr as ce,Ft as le,G as ue,Gi as de,Gn as fe,Gr as pe,Gt as k,H as me,Ha as A,Hi as he,Hn as ge,Hr as j,Ht as _e,I as ve,Ia as ye,Ii as be,In as xe,Ir as Se,It as Ce,J as we,Ji as Te,Jn as Ee,Jr as De,Jt as Oe,K as ke,Ki as Ae,Kn as je,Kr as Me,Kt as Ne,L as Pe,La as Fe,Li as Ie,Ln as Le,Lr as Re,Lt as ze,Ma as Be,Mi as Ve,Mn as He,Mr as M,Mt as Ue,N as We,Na as Ge,Ni as Ke,Nn as qe,Nr as N,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as P,P as et,Pa as tt,Pi as nt,Pn as rt,Pr as F,Pt as it,Q as at,Qa as ot,Qn as st,Qr as ct,Qt as lt,R as ut,Ra as dt,Ri as ft,Rn as pt,Rr as mt,Rt as ht,S as gt,Si as _t,Sn as vt,Sr as yt,St as I,T as bt,Ti as xt,Tn as St,Tr as Ct,Tt as wt,U as Tt,Ua as Et,Ui as Dt,Un as Ot,Ur as kt,Ut as At,V as jt,Va as Mt,Vi as Nt,Vn as Pt,Vr as Ft,Vt as It,W as Lt,Wa as Rt,Wi as zt,Wn as Bt,Wr as Vt,Wt as Ht,X as Ut,Xa as Wt,Xi as Gt,Xn as Kt,Xr as qt,Xt as Jt,Y as Yt,Ya as Xt,Yi as Zt,Yn as Qt,Yr as $t,Yt as en,Za as L,Zi as tn,Zn as nn,Zr as rn,Zt as an,_a as on,_i as sn,_n as cn,_r as R,_t as ln,a as un,aa as dn,ai as fn,an as pn,ar as z,b as mn,bi as hn,bn as gn,br as _n,bt as vn,c as yn,ca as bn,ci as xn,cn as Sn,cr as Cn,ct as wn,d as Tn,di as En,dn as Dn,dr as On,dt as kn,ea as An,ei as jn,en as Mn,eo as Nn,er as Pn,et as Fn,f as In,fi as Ln,fn as Rn,fr as zn,ft as Bn,g as Vn,gi as Hn,gn as Un,gr as Wn,gt as Gn,h as Kn,hi as qn,hn as Jn,hr as Yn,ht as Xn,i as Zn,ii as Qn,in as $n,ir as er,it as tr,ja as nr,ji as rr,jn as ir,jr as ar,jt as or,k as sr,ka as cr,ki as lr,kn as ur,kr as dr,kt as fr,l as pr,ln as mr,lr as hr,lt as gr,m as _r,mi as vr,mn as yr,mr as br,mt as xr,n as Sr,na as Cr,ni as wr,nn as Tr,no as B,nr as Er,nt as Dr,o as Or,oi as kr,on as Ar,or as jr,ot as Mr,p as Nr,pi as Pr,pn as Fr,pr as Ir,pt as Lr,q as Rr,qi as zr,qn as V,qr as Br,qt as Vr,r as Hr,ra as Ur,rn as Wr,ro as Gr,rr as Kr,rt as qr,s as Jr,sa as Yr,si as Xr,sn as Zr,sr as H,t as Qr,ta as $r,ti as ei,tn as ti,to as ni,tr as ri,tt as ii,u as ai,ua as oi,ui as si,un as ci,ur as li,ut as ui,v as di,vi as fi,vn as pi,vr as mi,vt as hi,w as gi,wi as _i,wn as vi,wr as yi,wt as bi,x as xi,xa as Si,xi as Ci,xn as wi,xr as Ti,xt as Ei,y as Di,yi as Oi,yn as ki,yr as Ai,yt as ji,za as Mi,zi as Ni,zn as Pi,zr as Fi,zt as Ii}from"./effect-CarHrcH-.js";import{a as Li,i as Ri,n as zi,o as Bi,r as Vi}from"./react-COyt-gOi.js";var U=e(Bi(),1),Hi=U.use,Ui=U.useLayoutEffect,Wi=U.createContext(null);function Gi(e){return U.useContext(Wi)}function Ki(e){let t=Gi();return U.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function qi(e){let t=Gi(),n=Ki(),r=U.useRef(null);return Ui(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Ji(e){return e[e.length-1]}function Yi(e,t){return typeof e==`function`?e(t):e}var Xi=Object.prototype.hasOwnProperty;function Zi(e){for(let t in e)if(Xi.call(e,t))return!0;return!1}var Qi=()=>Object.create(null),$i=(e,t)=>ea(e,t,!0);function ea(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&&!(ta(e)&&ta(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&&Ji(a)!==`${o-1}`||c&&Ji(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`?ea(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`?ea(d,o,n,r):o,i&&=u===d&&(a[l]===f||Xi.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?Qi():{};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`?ea(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function ta(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function na(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&&!na(a,o,n,r))return!1}return!0}if(ta(e)&&ta(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!na(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||!na(e[a],t[a],n,r)))return!1;return i===0}return!1}function ra(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 ia=/[\x00-\x1f\x7f"<>`{}]/g;function aa(e){return e.replace(ia,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function oa(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 aa(t)}var sa=[`http:`,`https:`,`mailto:`,`tel:`];function ca(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 la=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function ua(e,t){if(!e)return!1;if(la.test(e))return!0;let n=ca(e);return n?!t.has(n):!1}var da={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},fa=/[&><\u2028\u2029]/g;function pa(e){return e.replace(fa,e=>da[e])}function ma(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+=oa(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=oa(r?e.slice(r):e)}return t}function ha(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ga(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 _a(){throw Error(`Invariant failed`)}function va(e){return e.replace(/\/{2,}/g,`/`)}function ya(e){return e===`/`?e:e.replace(/^\/+/,``)}function ba(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function xa(e){return ba(ya(e))}function Sa(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ca(e,t,n=`never`,r){if(t.includes(`//`)&&(t=va(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=va(e)),o=e.split(`/`);o.length>1&&Ji(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&&(Ji(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?va(s):s)||`/`;return a&&r&&r.set(a,c),c}function wa(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 Ta(e){return e==null||e===``}function Ea(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 Da(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&&Ta(f)){if(c===`/`&&!d)continue;f=``}o+=c+Ea(s,f,r)+(d||``)}}return o+a||`/`}function Oa(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function ka(e){return e?.isNotFound===!0}var Aa=`__root__`;function ja(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 Ma(e){return e instanceof Response&&!!e.options}function Na(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 Pa=4,Fa=5;function Ia(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 La(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 Ra(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=Ji(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=La(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=Ba(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=Ba(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=Ba(r,Fa);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=Ba(r,Pa);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 za(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 Ba(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 Va(e,t){let n=Ba(),r=[];function i(e,t,n,a){let[o,s,c]=Ra(!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(za);t.masksTree=n,t.flatCache=Na(1e3)}function Ha(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Ka(e,t.masksTree);return t.flatCache.set(e,r),r}function Ua(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ba(),Ra(t,{from:e},1,o),i.singleCache.set(a,o)),Ka(r,o,n)}function Wa(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=Ka(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Ja(a.route)),t.matchCache.set(r,a),a}function Ga(e,t=!1){let n=Ba(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&_a(),i[e.id]=e,o!==0&&e.path){let t=ba(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Ra(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(za);return{processedTree:{segmentTree:n,singleCache:Na(1e3),matchCache:Na(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Ka(e,t,n=!1){let r=e.split(`/`),i=Xa(e,r,t,n);if(!i)return null;let[a]=qa(e,r,i);return{route:i.node.route,rawParams:a}}function qa(e,t,n){let r=Ya(n.node),i=n.node.data&&Ia(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===Pa)break;if(u.kind===Fa){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 Ja(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ya(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Xa(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!Ji(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&&!eo(l,n))continue;if(i.parse){if(!$a(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Pa&&eo(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Pa||i.kind===2)&&eo(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&&($a(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Qa(f,o))return n;eo(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+Za(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+Za(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+Za(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+Za(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 Za(e,t){return 2**(e-t-1)}function Qa(e,t){return e===2**(t-1)-1}function $a(e,t,n){let r,i;try{[r,i]=qa(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 eo(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===Pa)>(e.node.kind===Pa)||t.node.kind===Pa==(e.node.kind===Pa)&&t.node.depth>e.node.depth)))}function to(){try{return sessionStorage}catch{return}}var no=`tsr-scroll-restoration-v1_3`,ro=to();function io(){try{return JSON.parse(ro?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var ao=io(),oo=`data-scroll-restoration-id`,so=e=>e.state.__TSR_key||e.href;function co(e){let t=e.getAttribute(oo);if(t)return`[${oo}="${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 lo=!1,uo=`window`;function fo(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function po(e){let t=new Set;for(let n of e){if(n===uo)continue;let e=fo(n);e&&t.add(e)}return t}function mo(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||so,a=new Set,o=e=>{let t=ao[e]||={};for(let e of a)e===document?t[uo]={scrollX,scrollY}:e.isConnected&&(t[co(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,lo=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{lo||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{ro?.setItem(no,JSON.stringify(ao))}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=ao[d];if(e){let t=ao[u];for(let n in e){if(n===uo){if(s)continue}else{let e=fo(n);if(!e||s&&o&&(l??=po(o),l.has(e)))continue}t||=ao[u]={},t[n]??=e[n]}}}lo=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=po(o));let t=e&&i&&c,s=r.e?ao[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===uo){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=fo(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{lo=!1}}))}function ho(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 go(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function _o(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]=go(r):Array.isArray(t)?t.push(go(r)):n[e]=[t,go(r)]}return n}var vo=/^(?:\s|["[{\d-]|fa|nu|tr)/,yo=xo(JSON.parse),bo=So(JSON.stringify,JSON.parse);function xo(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=_o(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!vo.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function So(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&&!vo.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=ho(e,r);return t?`?${t}`:``}}function Co(e,t,n){let r=xa(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=va(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>wo(n,s.input({url:e})),output:({url:e})=>s.output({url:To(n,e)})}:s}function wo(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 To(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 Eo(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(()=>{ga(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 Do=`__TSR_index`,Oo=`popstate`,ko=`beforeunload`,Ao=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function jo(e){let t=Ao.exec(e);return t?`/`+e.slice(t[0].length):e}function Mo(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
2
+ \r`.includes(e)?``:encodeURIComponent(e))),jo(e)}function No(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=Io(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[Do];i=Po(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[Do];i=Po(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[Do]!==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 Po(e,t){let n=Lo();return{...t,key:n,__TSR_key:n,[Do]:e}}function Fo(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=>Mo(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Io(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Lo();t.history.replaceState({[Do]: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=Io(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[Do]-l.state[Do],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=No({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(ko,x,{capture:!0}),t.removeEventListener(Oo,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(ko,x,{capture:!0}),t.addEventListener(Oo,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 Io(e,t){let n=Mo(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Lo();t={[Do]: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 Lo(){return(Math.random()+1).toString(36).slice(7)}function Ro(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function zo(e){return e.pathname+e.search+e.hash}function Bo(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Vo(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Ho({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Uo(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Wo(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 Go=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:Fo()),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!==`/`&&xa(n)?Co(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=Eo(this.latestLocation,e),mo(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Ga(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Va(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:Na(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:ma(e),external:!1,searchStr:o,search:$i(t?.search,i),hash:ma(r.slice(1)),state:ea(t?.state,a)}}let o=wo(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:ma(jo(o.pathname)),external:!!this.rewrite&&Ro(o,this.origin),searchStr:c,search:$i(t?.search,s),hash:ma(o.hash.slice(1)),state:ea(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=Wa(ba(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=Io(n.href,{});n={...n,to:wo(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=Ca(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[ba(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Ja(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??Ra(!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??=Xo(n.params,e),!Zi(p))break;p===e&&(p=Object.assign(Qi(),p));try{Object.assign(p,t(p))}catch{}}}p??=Xo(n.params,Zo(n.params,f)?o()[3]:Qo);let m=e.leaveParams?c:jo(ma(f?Da(c,f,p,this.pathParamsDecoder):c)),h=$o(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,Yo(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?es(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||Qo,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:Qo,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=To(this.rewrite,e);C=zo(e),Ro(n,t)?(w=n.href,T=!0):w=jo(zo(n))}else C=ha(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=Ha(r.pathname,this.processedTree);if(t){let i=Object.assign(Qi(),t.rawParams),{from:a,params:o,...s}=t.route,c=Xo(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 Ko(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=ba(this.latestLocation.href)===ba(n.href)&&na(Ho(n.state),Ho(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?ca(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 Ko(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 Js(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(Vo(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`)&&Bo(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(la.test(n)||(r=ca(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:Ro(e,this.origin)||(n=zo(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=as,this.preloadRoute=e=>Ys(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Ca(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=Ua(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!na(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?na(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=wa(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??bo,parseSearch:e.parseSearch??yo,protocolAllowlist:e.protocolAllowlist??sa}),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=Ra(!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[`**`]:ba(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?ts(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=Yo(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof qo||(r=new qo(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=Qi(),_=i._interpolation?Da(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{ns(i,d)}catch(e){if(x=ka(e)||Ma(e)?e:new Jo(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:$i(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Bo(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?$i(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?ea(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`?$i(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=Ji(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=Ji(a),c={...e.search};for(let e of a)try{Object.assign(c,Yo(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{ns(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Ko(e,t,{replace:n,ignoreBlocker:r}){if(!ua(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 qo=class extends Error{},Jo=class extends Error{};function Yo(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new qo(`Async validation not supported`);if(n.issues)throw new qo(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 Xo(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 Zo(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!Xi.call(e,t[1]))}var Qo=Object.freeze({});function $o(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=Yo(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 es(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=Yi(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 ts(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 Aa}function ns(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function rs(e,t){return e.options[t]?.preload?.()}function is(e,t){let n=rs(e,`component`),r=rs(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function as(e,t,n){let r=()=>t===!1?void 0:t?rs(e,t):is(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 os(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function ss(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}function cs(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 ls=0,us=1,ds=2,fs=3,ps=[4];function ms(e){return typeof e[0]==`number`}function hs(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 gs(e,t){return e.routesById[t.routeId]}function _s(e,t,n){return Ma(e)?[fs,e]:ka(e)?(e.routeId||=n,[ds,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[us,e]):[ls,e]}function vs(e,t){let n=_s(t,!0,e.id);if(n[0]!==us)return n;try{e.options.onError?.(n[1])}catch(t){n=_s(t,!0,e.id)}return n}function ys(e,t,n,r,i){return i[0].signal.aborted?ps:Fs(e,t,n,vs(n,r),i)}async function bs(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=gs(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 Ss(e,r),[i,ys(e,t,u,a,n)]}if(c.aborted)return[i,ps];let p=r.paramsError??r.searchError;if(p!==void 0)return Ss(e,r),[i,ys(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{Ts(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?hs(a,c):a);if(c.aborted)return[i,ps];let s=Fs(e,t,u,_s(o,!1,u.id),n);if(s[0]!==ls)return Ss(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Ss(e,r),[i,ys(e,t,u,a,n)]}finally{r.status=h,Ts(e,r,!1,n[0])}}i()}function xs(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 Ss(e,t){let n=t._flight;t._flight=void 0,xs(e,t,n)?.abort()}function Cs(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=xs(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function ws(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Ts(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 Es(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 Ds(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return ps;if(!i)return[ls,void 0];let l=n._flight;Ts(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Es(e,t,n,r,s,a,!!o[3]))).then(e=>_s(e,!1,r.id),e=>_s(e,!0,r.id)).then(t=>(t[0]!==ls&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===us&&l[2]?vs(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Fs(e,t,r,await hs(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Ss(e,n),ps}finally{Ts(e,n,!1,s)}}function Os(e,t,n){t[0]!==fs&&(e.status=`success`,e.error=void 0,t[0]===ls?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function ks(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&&Ss(e,r)}function As(e,t){return t[0]===us||t[0]===ds?{...e,status:t[0]===us?`error`:`notFound`,error:t[1],_flight:void 0}:e}function js(e,t,n,r,i,a,o){let s=t[1][n],c=gs(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(Es(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=ps)),!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,Ss(e,s),p=ys(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,xs(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Ds(e,t,s,c,g,i,a).then(t=>(Os(s,t,l),t[0]===ls&&(m&&!a[0].signal.aborted&&ks(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[ls,s.loaderData]),T=(async()=>{try{let e=as(c,void 0,C);e&&await hs(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,ys(e,t,c,r,a)]}let r=await w;x&&r[0]===ls&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>As(s,e));let ee={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let te=Ds(e,t,ee,c,g,i,a).then(e=>(s.isFetching=!1,Os(ee,e,!1),e));return(t[2]??=[]).push([n,te,T,ee]),te.then(e=>As(ee,e))}async function Ms(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=gs(e,t[n]);try{let e=as(i,!1);e&&await hs(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Ns(e,t){t[2]&&=(Cs(e,t[2].map(e=>e[3])),void 0)}async function Ps(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]>=fs)throw[a,t];!i&&t[0]!==ls&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===fs)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Fs(e,t,n,r,i,a){for(;r[0]===fs;){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]?[fs,t]:[fs,t,a]}return[fs,o,n]}catch(e){r=a?[us,e]:vs(n,e),a=!0}}return r}async function Is(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]===ds?Ms(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=fs)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]!==ls&&t[0]<fs&&!(`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)>=fs){let n=s[1];if(n[0]!==fs||n[1].options.reloadDocument||n[2])return Ns(e,t),n;c=!0,s=[0,[us,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===us?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=gs(e,u);try{await hs(i?Promise.resolve().then(()=>as(m,l===us?`errorComponent`:`notFoundComponent`)):Promise.all([as(m),as(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Ns(e,t),ps}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Ns(e,t),Cs(e,o),p()):u.status=`success`}return t}async function Ls(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=gs(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 hs(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 Rs(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 Ms(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=js(e,i,t,u,f,r,l)},m=await bs(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===ds){let t=await Ms(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=fs&&(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=Is(e,i,u,r[0],Ps(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Ps(i[2],void 0,void 0,h.then(e=>ms(e)?0:os(n).length,()=>0))),o=await h}catch(t){if(Ns(e,i),t===a&&a.aborted)return ps;throw t}return ms(o)?o:Ls(e,o,a,r[6]===n.length?r[6]:0)}function zs(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=gs(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(()=>zs(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 Bs(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 Vs(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!os(t[3]).some(e=>e.id===n[1]))return;let i;try{await hs(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Hs(e,t){e._committed=t,e.stores.setMatches(t)}function Us(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=os(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=gs(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=Uo(n);Hs(e,n),Cs(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Wo(e,i,n,a,l,t)}async function Ws(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Gs(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 Ks(e,t,n,r,i){let a=n.map(e=>({...e}));ws(a);for(let t of r)Ss(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Is(e,o,r,t[0],i)}catch(t){throw Cs(e,a),t}if(ms(s))Cs(e,a),s[0]===fs&&e._tx===t&&e._committed===n&&await Gs(e,t,s);else if(await Ls(e,s,t[0].signal),e._tx!==t||e._committed!==n)Cs(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),Ss(e,n))}Hs(e,a),Cs(e,n,a)}}async function qs(e,t,n,r,i,a){let o=await Rs(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(ms(o)){let n=o[0]===fs&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Bs(e,t),Cs(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Bs(e,t);return}await Gs(e,t,o);return}let s=o[1];if(e._tx===t&&await Vs(e,t),e._tx!==t){Bs(e,t),Cs(e,s),Ns(e,o);return}let c=t[2],l=Vo(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Vs(e,t),e._tx!==t){Bs(e,t),Cs(e,s),Ns(e,o);return}let n=await e.startTransition(()=>{Bs(e,t),Us(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&&Ks(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)):Ns(e,o)})}async function Js(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=Vo(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Ws(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});ws(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Cs(e,m),await Ws(e,n);return}e._preflight=void 0;let g,_=()=>qs(e,y,f,()=>zs(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(()=>Ws(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Ts(e,t,!1)}n[0].abort(),Cs(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))&&zs(e,y),g?.(_()),await y[5]):(Cs(e,y[3]),y[3]=[],g?.(),await Ws(e,y))}async function Ys(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}),ws(a),o=(e._preloads??=new Map).set(i,a),s=await Rs(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Cs(e,a)),i.abort()}if(!ms(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){ka(e)||console.error(e);return}}}function Xs(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{ss(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 Zs=U.createContext(void 0),Qs=U.createContext(void 0),$s=t((e=>{var t=Bi();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})),ec=t(((e,t)=>{t.exports=$s()})),tc=t((e=>{var t=Bi(),n=ec();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}})),nc=t(((e,t)=>{t.exports=tc()}))();function rc(e,t){return e===t}function ic(e,t=e=>e,n){let r=n?.compare??rc,i=(0,U.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,U.useCallback)(()=>e.get(),[e]);return(0,nc.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function ac({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 oc(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 sc=[],cc=0,{link:lc,unlink:uc,propagate:dc,checkDirty:fc,shallowPropagate:pc}=ac({update(e){return e._update()},notify(e){sc[hc++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,yc(e))}}),mc=0,hc=0,gc,_c=0;function vc(e){try{++_c,e()}finally{--_c||bc()}}function yc(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=uc(n,e)}function bc(){if(!(_c>0)){for(;mc<hc;){let e=sc[mc];sc[mc++]=void 0,e.notify()}mc=0,hc=0}}function xc(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 gc!==void 0&&lc(i,gc,cc),i._snapshot},subscribe(e){let t=oc(e),n={current:!1},r=Sc(()=>{i.get(),n.current?(gc=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=gc,o=t?.compare??Object.is;if(n)gc=i,++cc,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{gc=a,n&&(i.flags&=-5),yc(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&fc(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&pc(e)}}else e&32&&(i.flags=e&-33);return gc!==void 0&&lc(i,gc,cc),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(dc(e),pc(e),bc())}},i}function Sc(e){let t=()=>{let t=gc;gc=n,++cc,n.depsTail=void 0,n.flags=6;try{return e()}finally{gc=t,n.flags&=-5,yc(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&&fc(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,yc(this)}};return t(),n}var W=Li(),Cc=class extends U.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?U.createElement(this.props.errorComponent??wc,{error:e[0],reset:this.reset}):this.props.children}};function wc({error:e}){let[t,n]=U.useState(!1);return(0,W.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,W.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,W.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,W.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,W.jsx)(`div`,{children:(0,W.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,W.jsx)(`code`,{children:e.message}):null})}):null]})}var Tc=()=>!0,Ec=()=>!1;function Dc({children:e,fallback:t=null}){return(0,W.jsx)(U.Fragment,{children:Oc()?e:t})}function Oc(e=!0){return U.useSyncExternalStore(kc,Tc,e?Ec:Tc)}function kc(){return()=>{}}function Ac(e){let t=Gi(),n=`not-found-${ic(t.stores.location,e=>e.pathname)}-${ic(t.stores.status)}`;return(0,W.jsx)(Cc,{getResetKey:()=>n,onCatch:(t,n)=>{if(ka(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(ka(t))return e.fallback?.(t);throw t},children:e.children})}function jc(){return(0,W.jsx)(`p`,{children:`Not Found`})}function Mc(e,t,n){return t.options.notFoundComponent?(0,W.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,W.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,W.jsx)(jc,{})}function Nc(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,W.jsx)(n,{}):null}var Pc=(e,t)=>e[0]===t[0]&&e[1]===t[1],Fc=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ic=U.memo(function({routeId:e}){let t=Gi();return Lc(t,ic(t.stores.getMatchStore(e)))});function Lc(e,t){let n=e.routesById[t.routeId],r=Nc(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=Fc(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,W.jsx)(Rc,{match:t});s&&(l=(0,W.jsx)(Dc,{fallback:r,children:l})),o&&(l=(0,W.jsx)(Ac,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return U.createElement(o,e)},children:l})),i&&(l=(0,W.jsx)(Cc,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(ka(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,W.jsx)(U.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,W.jsx)(Zs.Provider,{value:t.routeId,children:(0,W.jsxs)(u,{children:[l,null]})}):(0,W.jsxs)(Zs.Provider,{value:t.routeId,children:[l,null]})}var Rc=U.memo(function({match:e}){let t=Gi(),n=e.routeId,r=t.routesById[n],i=U.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=U.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,W.jsx)(e,{},i):(0,W.jsx)(zc,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Fc(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Nc(t,r)}if(e.status===`notFound`)return Mc(t,r,e.error);if(e.status===`error`)throw e.error;return a}),zc=U.memo(function(){let e=Gi(),t=U.useContext(Zs),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=ic(a,e=>[!!e._notFound,e.error],{compare:Pc}),i=ic(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Mc(e,e.routesById[t],r);if(!i)return null;let a=(0,W.jsx)(Ic,{routeId:i});return t===`__root__`?(0,W.jsx)(U.Suspense,{fallback:Nc(e),children:a}):a});function Bc(e,t){let n=e[1];e.length=0,n?.(t)}function Vc({t:e}){let t=Gi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Bc(n,!1),n.push(i,a),e(t),U.startTransition(r)}),Ui(()=>{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(ba(r.publicHref)!==ba(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`,...Vo(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Hc(){let e=Gi(),t=e.routesById[Aa],n=Nc(e,t),r=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Vc,{t:U.useState()[1]}),e.ssr?(0,W.jsx)(Uc,{}):(0,W.jsx)(U.Suspense,{fallback:n,children:(0,W.jsx)(Uc,{})})]});return e.options.InnerWrap?(0,W.jsx)(e.options.InnerWrap,{children:r}):r}function Uc(){let e=Gi(),t=e._rendered,n=ic(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Ui(()=>{t[0]===n&&Bc(t,!0)},[t,n]);let a=i?(0,W.jsx)(Ic,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,W.jsx)(Cc,{getResetKey:()=>r,onCatch:void 0,children:a})}function Wc(){let e=Gi();return U.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,ic(e.stores.location,e=>e.href),ic(e.stores.resolvedLocation,e=>e?.href),ic(e.stores.status)])}var Gc=e=>({createMutableStore:xc,createReadonlyStore:xc,batch:vc}),Kc=e=>new qc(e),qc=class extends Go{constructor(e){super(e,Gc)}};function Jc({router:e,children:t,...n}){Zi(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,W.jsx)(Wi.Provider,{value:e,children:t});return e.options.Wrap?(0,W.jsx)(e.options.Wrap,{children:r}):r}function Yc({router:e,...t}){return(0,W.jsx)(Jc,{router:e,...t,children:(0,W.jsx)(Hc,{})})}var Xc=(0,U.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),Zc=U.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}=U.useContext(Xc);return U.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&&U.createElement(`title`,null,n),s,c.get(a??f))});Zc.displayName=`IconBase`;var Qc=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),$c=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:Qc}));$c.displayName=`CheckCircleIcon`;var el=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),tl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:el}));tl.displayName=`HouseIcon`;var nl=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),rl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:nl}));rl.displayName=`InfoIcon`;var il=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),al=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:il}));al.displayName=`QuestionIcon`;var ol=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),sl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:ol}));sl.displayName=`SpinnerIcon`;var cl=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),ll=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:cl}));ll.displayName=`WarningIcon`;var ul=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),dl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:ul}));dl.displayName=`WarningCircleIcon`;var fl=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),pl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:fl}));pl.displayName=`XIcon`;var ml=new Map([[`bold`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`,U.createElement(U.Fragment,null,U.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`}))]]),hl=U.forwardRef((e,t)=>U.createElement(Zc,{ref:t,...e,weights:ml}));hl.displayName=`XCircleIcon`;var gl=ec(),_l=e(Ri(),1),G=zi();function vl(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=vl(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function yl(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=vl(e))&&(r&&(r+=` `),r+=t);return r}var bl=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,xl=yl,Sl=(e,t)=>n=>{if(t?.variants==null)return xl(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=bl(t)||bl(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 xl(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)},Cl=(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},wl=(e,t)=>({classGroupId:e,validator:t}),Tl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),El=`-`,Dl=[],Ol=`arbitrary..`,kl=e=>{let t=Ml(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return jl(e);let n=e.split(El);return Al(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Cl(i,t):t:i||Dl}return n[e]||Dl}}},Al=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Al(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(El):e.slice(t).join(El),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},jl=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?Ol+r:void 0})(),Ml=e=>{let{theme:t,classGroups:n}=e;return Nl(n,t)},Nl=(e,t)=>{let n=Tl();for(let r in e){let i=e[r];Pl(i,n,r,t)}return n},Pl=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Fl(i,t,n,r)}},Fl=(e,t,n,r)=>{typeof e==`string`?Il(e,t,n):typeof e==`function`?Ll(e,t,n,r):Rl(e,t,n,r)},Il=(e,t,n)=>{let r=e===``?t:zl(t,e);r.classGroupId=n},Ll=(e,t,n,r)=>{Bl(e)?Pl(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(wl(n,e)))},Rl=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Pl(o,zl(t,a),n,r)}},zl=(e,t)=>{let n=e,r=t.split(El),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Tl(),n.nextPart.set(t,i)),n=i}return n},Bl=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Vl=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)}}},Hl=`!`,Ul=`:`,Wl=[],Gl=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Kl=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===Ul){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(Hl)?(c=s.slice(0,-1),l=!0):s.startsWith(Hl)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Gl(t,l,c,u)};if(t){let e=t+Ul,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Gl(Wl,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ql=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}},Jl=e=>({cache:Vl(e.cacheSize),parseClassName:Kl(e),sortModifiers:ql(e),postfixLookupClassGroupIds:Yl(e),...kl(e)}),Yl=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},Xl=/\s+/,Zl=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Xl),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?_+Hl:_,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},Ql=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=$l(n))&&(i&&(i+=` `),i+=r);return i},$l=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=$l(e[r]))&&(n&&(n+=` `),n+=t);return n},eu=(e,...t)=>{let n,r,i,a,o=o=>(n=Jl(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=Zl(e,n);return i(e,a),a};return a=o,(...e)=>a(Ql(...e))},tu=[],nu=e=>{let t=t=>t[e]||tu;return t.isThemeGetter=!0,t.themeKey=e,t},ru=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,iu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,au=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ou=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,su=/\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$/,cu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,lu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,du=e=>au.test(e),K=e=>!!e&&!Number.isNaN(Number(e)),fu=e=>!!e&&Number.isInteger(Number(e)),pu=e=>e.endsWith(`%`)&&K(e.slice(0,-1)),mu=e=>ou.test(e),hu=()=>!0,gu=e=>su.test(e)&&!cu.test(e),_u=()=>!1,vu=e=>lu.test(e),yu=e=>uu.test(e),bu=e=>!q(e)&&!J(e),xu=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)),Su=e=>Lu(e,Vu,_u),q=e=>ru.test(e),Cu=e=>Lu(e,Hu,gu),wu=e=>Lu(e,Uu,K),Tu=e=>Lu(e,Gu,hu),Eu=e=>Lu(e,Wu,_u),Du=e=>Lu(e,zu,_u),Ou=e=>Lu(e,Bu,yu),ku=e=>Lu(e,Ku,vu),J=e=>iu.test(e),Au=e=>Ru(e,Hu),ju=e=>Ru(e,Wu),Mu=e=>Ru(e,zu),Nu=e=>Ru(e,Vu),Pu=e=>Ru(e,Bu),Fu=e=>Ru(e,Ku,!0),Iu=e=>Ru(e,Gu,!0),Lu=(e,t,n)=>{let r=ru.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ru=(e,t,n=!1)=>{let r=iu.exec(e);return r?r[1]?t(r[1]):n:!1},zu=e=>e===`position`||e===`percentage`,Bu=e=>e===`image`||e===`url`,Vu=e=>e===`length`||e===`size`||e===`bg-size`,Hu=e=>e===`length`,Uu=e=>e===`number`,Wu=e=>e===`family-name`,Gu=e=>e===`number`||e===`weight`,Ku=e=>e===`shadow`,qu=eu(()=>{let e=nu(`color`),t=nu(`font`),n=nu(`text`),r=nu(`font-weight`),i=nu(`tracking`),a=nu(`leading`),o=nu(`breakpoint`),s=nu(`container`),c=nu(`spacing`),l=nu(`radius`),u=nu(`shadow`),d=nu(`inset-shadow`),f=nu(`text-shadow`),p=nu(`drop-shadow`),m=nu(`blur`),h=nu(`perspective`),g=nu(`aspect`),_=nu(`ease`),v=nu(`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=()=>[du,`full`,`auto`,...w()],ee=()=>[fu,`none`,`subgrid`,J,q],te=()=>[`auto`,{span:[`full`,fu,J,q]},fu,J,q],E=()=>[fu,`auto`,J,q],ne=()=>[`auto`,`min`,`max`,`fr`,J,q],D=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ie=()=>[`auto`,...w()],ae=()=>[du,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],oe=()=>[s,du,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],se=()=>[du,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],O=()=>[e,J,q],ce=()=>[...b(),Mu,Du,{position:[J,q]}],le=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ue=()=>[`auto`,`cover`,`contain`,Nu,Su,{size:[J,q]}],de=()=>[pu,Au,Cu],fe=()=>[``,`none`,`full`,l,J,q],pe=()=>[``,K,Au,Cu],k=()=>[`solid`,`dashed`,`dotted`,`double`],me=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],A=()=>[K,pu,Mu,Du],he=()=>[``,`none`,m,J,q],ge=()=>[`none`,K,J,q],j=()=>[`none`,K,J,q],_e=()=>[K,J,q],ve=()=>[du,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[mu],breakpoint:[mu],color:[hu],container:[mu],"drop-shadow":[mu],ease:[`in`,`out`,`in-out`],font:[bu],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[mu],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[mu],shadow:[mu],spacing:[`px`,K],text:[mu],"text-shadow":[mu],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,du,q,J,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,J,q]}],"container-named":[xu],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:[fu,`auto`,J,q]}],basis:[{basis:[du,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[K,du,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,K,J,q]}],shrink:[{shrink:[``,K,J,q]}],order:[{order:[fu,`first`,`last`,`none`,J,q]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...D(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...D()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],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:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mbs:[{mbs:ie()}],mbe:[{mbe:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ae()}],"inline-size":[{inline:[`auto`,...oe()]}],"min-inline-size":[{"min-inline":[`auto`,...oe()]}],"max-inline-size":[{"max-inline":[`none`,...oe()]}],"block-size":[{block:[`auto`,...se()]}],"min-block-size":[{"min-block":[`auto`,...se()]}],"max-block-size":[{"max-block":[`none`,...se()]}],w:[{w:[s,`screen`,...ae()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ae()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ae()]}],h:[{h:[`screen`,`lh`,...ae()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ae()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...ae()]}],"font-size":[{text:[`base`,n,Au,Cu]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Iu,Tu]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,pu,q]}],"font-family":[{font:[ju,Eu,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,wu]}],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:O()}],"text-color":[{text:O()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...k(),`wavy`]}],"text-decoration-thickness":[{decoration:[K,`from-font`,`auto`,J,Cu]}],"text-decoration-color":[{decoration:O()}],"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:[fu,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:ce()}],"bg-repeat":[{bg:le()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},fu,J,q],radial:[``,J,q],conic:[``,fu,J,q]},Pu,Ou]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],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:[...k(),`hidden`,`none`]}],"divide-style":[{divide:[...k(),`hidden`,`none`]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...k(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[K,J,q]}],"outline-w":[{outline:[``,K,Au,Cu]}],"outline-color":[{outline:O()}],shadow:[{shadow:[``,`inner`,`none`,u,Fu,ku]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":[`none`,d,Fu,ku]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:pe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[K,Cu]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":[`none`,f,Fu,ku]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[K,J,q]}],"mix-blend":[{"mix-blend":[...me(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":me()}],"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":A()}],"mask-image-linear-to-pos":[{"mask-linear-to":A()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":A()}],"mask-image-t-to-pos":[{"mask-t-to":A()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":A()}],"mask-image-r-to-pos":[{"mask-r-to":A()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":A()}],"mask-image-b-to-pos":[{"mask-b-to":A()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":A()}],"mask-image-l-to-pos":[{"mask-l-to":A()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":A()}],"mask-image-x-to-pos":[{"mask-x-to":A()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":A()}],"mask-image-y-to-pos":[{"mask-y-to":A()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[J,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":A()}],"mask-image-radial-to-pos":[{"mask-radial-to":A()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"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":A()}],"mask-image-conic-to-pos":[{"mask-conic-to":A()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:le()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,J,q]}],filter:[{filter:[``,`none`,J,q]}],blur:[{blur:he()}],brightness:[{brightness:[K,J,q]}],contrast:[{contrast:[K,J,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Fu,ku]}],"drop-shadow-color":[{"drop-shadow":O()}],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":he()}],"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:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":[`scale-3d`],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[J,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":[`translate-none`],zoom:[{zoom:[fu,J,q]}],accent:[{accent:O()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:O()}],"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":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"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`,...O()]}],"stroke-w":[{stroke:[K,Au,Cu,wu]}],stroke:[{stroke:[`none`,...O()]}],"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 Ju(...e){return qu(yl(e))}var Yu=Vi(),Xu=Sl(`group/alert relative grid w-full gap-1 border bg-background px-4 py-3 text-left text-sm after:absolute after:-inset-y-px after:-left-px after:w-0.5 has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground after:bg-foreground`,destructive:`bg-card text-destructive after:bg-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Zu(e){let t=(0,G.c)(10),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;t[4]!==n||t[5]!==i?(a=Ju(Xu({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,W.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Qu(e){let t=(0,G.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=Ju(`text-sm font-semibold group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $u(e){let t=(0,G.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=Ju(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ed(e){let t=(0,G.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=Ju(`absolute top-2.5 right-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`alert-action`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function td(){return typeof window<`u`}function nd(e){return ad(e)?(e.nodeName||``).toLowerCase():`#document`}function rd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function id(e){return((ad(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ad(e){return td()?e instanceof Node||e instanceof rd(e).Node:!1}function od(e){return td()?e instanceof Element||e instanceof rd(e).Element:!1}function sd(e){return td()?e instanceof HTMLElement||e instanceof rd(e).HTMLElement:!1}function cd(e){return!td()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof rd(e).ShadowRoot}function ld(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=bd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ud(e){return/^(table|td|th)$/.test(nd(e))}function dd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var fd=/transform|translate|scale|rotate|perspective|filter/,pd=/paint|layout|strict|content/,md=e=>!!e&&e!==`none`,hd;function gd(e){let t=od(e)?bd(e):e;return md(t.transform)||md(t.translate)||md(t.scale)||md(t.rotate)||md(t.perspective)||!vd()&&(md(t.backdropFilter)||md(t.filter))||fd.test(t.willChange||``)||pd.test(t.contain||``)}function _d(e){let t=Sd(e);for(;sd(t)&&!yd(t);){if(gd(t))return t;if(dd(t))return null;t=Sd(t)}return null}function vd(){return hd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),hd}function yd(e){return/^(html|body|#document)$/.test(nd(e))}function bd(e){return rd(e).getComputedStyle(e)}function xd(e){return od(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sd(e){if(nd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||cd(e)&&e.host||id(e);return cd(t)?t.host:t}function Cd(e){let t=Sd(e);return yd(t)?(e.ownerDocument||e).body:sd(t)&&ld(t)?t:Cd(t)}function wd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Cd(e),i=r===e.ownerDocument?.body,a=rd(r);if(i){let e=Td(a);return t.concat(a,a.visualViewport||[],ld(r)?r:[],e&&n?wd(e):[])}return t.concat(r,wd(r,[],n))}function Td(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ed={...U},Dd={};function Od(e,t){let n=U.useRef(Dd);return n.current===Dd&&(n.current=e(t)),n}var kd=Ed.useInsertionEffect,Ad=kd&&kd!==Ed.useLayoutEffect?kd:e=>e();function jd(e){let t=Od(Md).current;return t.next=e,Ad(t.effect),t.trampoline}function Md(){let e={next:void 0,callback:Nd,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Nd(){}var Pd=typeof document<`u`?U.useLayoutEffect:()=>{};function Fd(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Id={};function Ld(e,t,n,r,i){if(!n&&!r&&!i&&!e)return zd(t);let a=zd(e);return t&&(a=Bd(a,t)),n&&(a=Bd(a,n)),r&&(a=Bd(a,r)),i&&(a=Bd(a,i)),a}function Rd(e){if(e.length===0)return Id;if(e.length===1)return zd(e[0]);let t=zd(e[0]);for(let n=1;n<e.length;n+=1)t=Bd(t,e[n]);return t}function zd(e){return Wd(e)?{...e(Id)}:Vd(e)}function Bd(e,t){return Wd(t)?t(e):Hd(e,t)}function Vd(e){let t={...e};for(let e in t){let n=t[e];Ud(e,n)&&(t[e]=Kd(n))}return t}function Hd(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Fd(e.style,r);break;case`className`:e[n]=Jd(e.className,r);break;default:e[n]=Ud(n,r)?Gd(e[n],r):r}}return e}function Ud(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 Wd(e){return typeof e==`function`}function Gd(e,t){return t?e?(...n)=>{let r=n[0];if(Yd(r)){let i=r;qd(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Kd(t):e}function Kd(e){return e&&((...t)=>{let n=t[0];return Yd(n)&&qd(n),e(...t)})}function qd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Jd(e,t){return t?e?t+` `+e:t:e}function Yd(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Xd(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 Zd=Xd(`https://base-ui.com/production-error`,`Base UI`),Qd=U.createContext(void 0);function $d(e=!1){let t=U.useContext(Qd);if(t===void 0&&!e)throw Error(Zd(16));return t}function ef(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:U.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 tf(e){return e?.ownerDocument||document}function nf(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(rd(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 rf(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=U.useRef(null),s=$d(!0),c=a??s!==void 0,{props:l}=ef({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=U.useCallback(()=>{let e=o.current;af(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Pd(u,[u]),{getButtonProps:U.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Ld({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(qd(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=af(r),s=!i&&of(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(),nf(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),nf(r,e)))},onKeyUp(e){t||(qd(e),a?.(e),e.target===e.currentTarget&&i&&c&&af(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),nf(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:jd(e=>{o.current=e,u()})}}function af(e){return sd(e)&&e.tagName===`BUTTON`}function of(e){return sd(e)&&e.tagName===`A`&&!!e.href}function sf(e,t,n,r){let i=Od(lf).current;return uf(i,e,t,n,r)&&ff(i,[e,t,n,r]),i.callback}function cf(e){let t=Od(lf).current;return df(t,e)&&ff(t,e),t.callback}function lf(){return{callback:null,cleanup:null,refs:[]}}function uf(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function df(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function ff(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 pf=19;function mf(e){return pf>=e}function hf(e){if(!U.isValidElement(e))return null;let t=e,n=t.props;return(mf(19)?n?.ref:t.ref)??null}function gf(){}var _f=Object.freeze([]),vf=Object.freeze({});function yf(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 bf(e,t){return typeof e==`function`?e(t):e}function xf(e,t){return typeof e==`function`?e(t):e}function Sf(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Ef(r));let i=Cf(t,n,r);if(n.enabled===!1)return null;let a=n.state??vf;return Df(e,r,i,a)}function Cf(e,t,n){let{className:r,style:i}=e,{state:a=vf,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?bf(r,a):void 0,d=l?xf(i,a):void 0,f=l?yf(a,c):vf,p=l&&s?wf(s):void 0,m=l?Fd(f,p)??{}:vf;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?cf([m.ref,hf(n),...o]):sf(m.ref,hf(n),o):sf(null,null)),l?(u!==void 0&&(m.className=Jd(m.className,u)),d!==void 0&&(m.style=Fd(m.style,d)),m):vf}function wf(e){return Array.isArray(e)?Rd(e):Ld(void 0,e)}var Tf=Symbol.for(`react.lazy`);function Ef(e){if(e?.$$typeof!==Tf)return e;let t=U.Children.toArray(e)[0];return U.isValidElement(t)?t:e}function Df(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Ld(n,t.props);return e.ref=n.ref,U.cloneElement(t,e)}return Of(e,n)}function Of(e,t){return e===`button`?(0,U.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,U.createElement)(`img`,{alt:``,...t,key:t.key}):U.createElement(e,t)}var kf=U.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}=rf({disabled:i,focusableWhenDisabled:a,native:o});return Sf(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Af=Sl(`group/button inline-flex shrink-0 items-center justify-center rounded-none border border-transparent bg-clip-padding text-xs font-semibold tracking-widest whitespace-nowrap uppercase 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-3.5`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-transparent hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover: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 underline-offset-4 hover:underline`,search:`border-0 border-b border-input bg-transparent px-0 text-muted-foreground normal-case tracking-normal hover:bg-transparent hover:text-foreground dark:hover:bg-transparent`},size:{default:`h-10 gap-1.5 px-6 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4`,xs:`h-7 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3`,sm:`h-9 gap-1 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,lg:`h-11 gap-1.5 px-8 has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5`,icon:`size-10`,"icon-xs":`size-7 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-9`,"icon-lg":`size-11`,search:`h-9 w-full justify-start gap-2.5 px-0 text-sm`}},defaultVariants:{variant:`default`,size:`default`}});function jf(e){let t=(0,G.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=Ju(Af({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,W.jsx)(kf,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function Mf(e){let t=(0,G.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=Ju(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 border-dashed p-12 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nf(e){let t=(0,G.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=Ju(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Pf=Sl(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-none bg-muted text-foreground [&_svg:not([class*='size-'])]:size-5`}},defaultVariants:{variant:`default`}});function Ff(e){let t=(0,G.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=Ju(Pf({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,W.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 If(e){let t=(0,G.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=Ju(`text-lg font-semibold tracking-wider uppercase`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`empty-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lf(e){let t=(0,G.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=Ju(`mt-0.5 text-sm/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,W.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rf(e){let t=(0,G.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=Ju(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zf(e){let t=(0,G.c)(21);if(e.action===void 0&&e.description===void 0){let n;t[0]===e.icon?n=t[1]:(n=(0,W.jsx)(Ff,{variant:`icon`,children:e.icon}),t[0]=e.icon,t[1]=n);let r;return t[2]!==e.label||t[3]!==n?(r=(0,W.jsx)(Mf,{role:`status`,"aria-label":e.label,children:n}),t[2]=e.label,t[3]=n,t[4]=r):r=t[4],r}let n;t[5]===e.icon?n=t[6]:(n=(0,W.jsx)(Ff,{variant:`icon`,className:`mb-3`,children:e.icon}),t[5]=e.icon,t[6]=n);let r;t[7]===e.label?r=t[8]:(r=(0,W.jsx)(`h2`,{className:`font-heading text-2xl leading-none tracking-tight`,children:e.label}),t[7]=e.label,t[8]=r);let i;t[9]===e.description?i=t[10]:(i=e.description!==void 0&&(0,W.jsx)(Lf,{children:e.description}),t[9]=e.description,t[10]=i);let a;t[11]!==n||t[12]!==r||t[13]!==i?(a=(0,W.jsxs)(Nf,{children:[n,r,i]}),t[11]=n,t[12]=r,t[13]=i,t[14]=a):a=t[14];let o;t[15]===e.action?o=t[16]:(o=e.action!==void 0&&(0,W.jsx)(Rf,{children:e.action}),t[15]=e.action,t[16]=o);let s;return t[17]!==e.label||t[18]!==a||t[19]!==o?(s=(0,W.jsxs)(Mf,{role:`status`,"aria-label":e.label,children:[a,o]}),t[17]=e.label,t[18]=a,t[19]=o,t[20]=s):s=t[20],s}function Bf(){let e=(0,G.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsxs)(Nf,{children:[(0,W.jsx)(Ff,{variant:`icon`,children:(0,W.jsx)(al,{className:`size-5`,weight:`light`})}),(0,W.jsx)(`h2`,{className:`font-heading text-2xl leading-none tracking-tight`,children:`Page not found`}),(0,W.jsx)(Lf,{children:`The link is old, or it never existed.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsxs)(Mf,{"aria-label":`Page not found`,children:[t,(0,W.jsx)(Rf,{children:(0,W.jsxs)(jf,{variant:`outline`,render:(0,W.jsx)(`a`,{href:`/`,"aria-label":`Go home`}),children:[(0,W.jsx)(tl,{}),`Go home`]})})]}),e[1]=n):n=e[1],n}function Vf(e){let t=(0,G.c)(10),n=e.label??`Unavailable`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsx)(dl,{}),t[0]=r):r=t[0];let i=e.label??`Can’t load this view`,a;t[1]===i?a=t[2]:(a=(0,W.jsx)(Qu,{children:i}),t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)($u,{children:`The server did not answer. Nothing was lost; try the same view again.`}),t[3]=o):o=t[3];let s;t[4]===e.reset?s=t[5]:(s=(0,W.jsx)(ed,{children:(0,W.jsx)(jf,{variant:`destructive`,size:`sm`,className:`max-sm:h-11`,onClick:e.reset,children:`Retry`})}),t[4]=e.reset,t[5]=s);let c;return t[6]!==n||t[7]!==a||t[8]!==s?(c=(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,W.jsxs)(Zu,{variant:`destructive`,role:`alert`,"aria-label":n,className:`max-w-md`,children:[r,a,o,s]})}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}var Y=class extends fr()(`AuthError`,{cause:Ht(Xn()),error:k(vn([`invalid_request`,`invalid_client`,`invalid_client_metadata`,`invalid_redirect_uri`,`invalid_grant`,`invalid_target`,`invalid_scope`,`unsupported_grant_type`,`unsupported_response_type`,`access_denied`,`authorization_pending`,`expired_token`,`temporarily_unavailable`])),message:E}){},Hf=P({id:I,name:I});P({aud:ji(`deslop`),azp:I,exp:ln,iat:ln,iss:I,name:I,sid:I,sub:I});var Uf=P({name:E,redirects:Ei(I.check(ht(200))).check(ht(4))});P({client_id:I,code:I,code_verifier:I,redirect_uri:I}),P({session:I}),P({access_token:I,expires_in:Gn,refresh_token:I});var Wf=E.check(_e(e=>cr(D(Dr(e)),e=>dn([`http:`,`https:`],e.protocol)&&e.username===``&&e.password===``&&e.hash===``),{expected:`an HTTP(S) URL without credentials or a fragment`})).check(_e(e=>cr(D(Dr(e)),e=>e.pathname===`/`&&e.search===``),{expected:`an HTTP(S) origin without a path or query`})),Gf=Wf.check(_e(e=>cr(D(Dr(e)),e=>e.protocol===`https:`||dn([`localhost`,`127.0.0.1`,`[::1]`],e.hostname)),{expected:`HTTPS outside loopback`}));E.check(Ii(/^\d{1,5}$/u),_e(e=>cr(Ln(e),e=>e>=1&&e<=65535),{expected:`a port between 1 and 65535`}));var Kf=E.check(Ii(/^0\.1\.\d+$/u)),qf=`/api/runtime`,Jf=P({auth:k(Wf),name:E,traces:E,version:Kf}),Yf=`/api/rpc`;P({...Hf.fields,signOut:xr}),P({config:P({port:ln}),name:E,version:Kf});function Xf(e,t,n,r){return B(Ci(zn(function*(){let i=`${yield*Dt}`,a=yield*mr,o={attributes:{"scope.run.started_unix_nano":i,"scope.runtime":n,"service.instance.id":i},serviceName:e,serviceVersion:oe(dt(r,e=>e!==`0.1.0`))};return B(Hn(Lt({resource:o,url:new URL(`/v1/traces`,t).href}),ue({resource:o,url:new URL(`/v1/logs`,t).href}),Oi(mr)([...a,`code`,`state`,`request`,`access_token`,`refresh_token`,`id_token`,`client_secret`,`client_assertion`,`code_verifier`,`session`,`token`])),sn([ke,we]))})),Pr(e=>zr(e)?vr(Ir):vr(Wn(`Telemetry is unavailable`))))}function Zf(e){return Ci(zn(function*(){let t=yield*B((yield*Yt).get(qf),H(at),H(n(Jf)),Re(`3 seconds`),Ti);return p(t,{onNone:()=>qn,onSome:t=>t.traces===``?qn:Xf(`${e}-client`,t.traces,`web`,t.version)})}))}var Qf=Pt(Mt()),$f=new WeakSet,ep=Vn(e=>{let t=Yn(`Web error`,de(e.error),...Rt(Be(e.stack)));return p(h(Qf),{onNone:()=>t,onSome:n=>yt(B(t,V(Er(e.error)),Vt(`Web.error`,{attributes:{"web.error.source":e.source,"web.route.id":e.route},root:!0}),er),n)})});function tp(e,t){let n=document.querySelector(`#root`);if(ot(n))throw TypeError(`Missing application mount element with id "root"`);return{root:n,router:Kc({context:{},defaultErrorComponent:Vf,defaultNotFoundComponent:Bf,defaultPreload:`intent`,getScrollRestorationKey:t,routeTree:e,scrollRestoration:!0})}}function np(e){return t=>tt(Je(e)(t),()=>it(e)({}))}function rp(e){let t=s();function n(n,r,i){if(Nn(n)){if($f.has(n))return;$f.add(n)}t.set(ep,{error:n,route:B(oi(e.router.state.matches,e=>e.error===n),A(()=>on(e.router.state.matches)),nr(e=>dt(e.routeId,ei)),tt(()=>`__root__`)),source:r,stack:i})}e.router.update({defaultOnCatch:(e,t)=>n(e,`route`,t.componentStack)}),(0,Yu.createRoot)(e.root,{onCaughtError:(e,t)=>n(e,`caught`,t.componentStack),onUncaughtError:(e,t)=>n(e,`uncaught`,t.componentStack)}).render((0,W.jsx)(U.StrictMode,{children:(0,W.jsx)(Yc,{router:e.router})}))}function ip(e){return B(e,ie(e=>B(e(qt(`1 second`)),rn(e=>e.input._tag===`RpcClientError`||ze(Y)(e.input)&&e.input.error===`temporarily_unavailable`))))}var ap=B(pr({pingTimeout:`15 seconds`,retryTransientErrors:!0}),sn(B(In(F(()=>`${location.origin}${Yf}`)),sn(Nr))),fi(ai()));function op(e){return gt.addGlobalLayer(B(Zf(e),sn(we),hn(e=>ye(Ur(e,Rr))?j:fe(F(()=>ge(Qf,Et(e))),()=>F(()=>Ot(Qf,c(t=>t!==e))))))),ap}function sp(e){U.useEffect(e,_f)}var cp=U.createContext(void 0);function lp(){let e=U.useContext(cp);if(!e)throw Error(Zd(73));return e}var up=[],dp=void 0;function fp(){return dp}function pp(e){up.push(e)}function mp(e){let t=(t,n)=>{let r=Od(gp).current,i;try{dp=r;for(let e of up)e.before(r);i=e(t,n);for(let e of up)e.after(r);r.didInitialize=!0}finally{dp=void 0}return i};return t.displayName=e.displayName||e.name,t}function hp(e){return U.forwardRef(mp(e))}function gp(){return{didInitialize:!1}}var _p=mf(19)?bp:xp;function vp(e,t,n,r,i){return _p(e,t,n,r,i)}function yp(e,t,n,r,i){let a=U.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,gl.useSyncExternalStore)(e.subscribe,a,a)}pp({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,gl.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bp(e,t,n,r,i){let a=fp();if(!a)return yp(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 xp(e,t,n,r,i){return(0,nc.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Sp=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 vp(this,e,t,n,r)}},Cp=class extends Sp{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){U.useDebugValue(e);let n=this;Pd(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Pd(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Pd(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){U.useDebugValue(e);let n=this,r=t!==void 0;Pd(()=>{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 U.useDebugValue(e),vp(this,this.selectors[e],t,n,r)}useContextCallback(e,t){U.useDebugValue(e);let n=jd(t??gf);this.context[e]=n}useStateSetter(e){let t=U.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)}})}},wp=0;function Tp(e){return wp+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${wp}`}var Ep=0,Dp=class e{static create(){return new e}currentId=Ep;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ep,t()},e)}isStarted(){return this.currentId!==Ep}clear=()=>{this.currentId!==Ep&&(clearTimeout(this.currentId),this.currentId=Ep)};disposeEffect=()=>this.clear};function Op(){let e=Od(Dp.create).current;return sp(e.disposeEffect),e}function kp(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 Ap(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:jp,platform:Mp,maxTouchPoints:Np}=Ap(),Pp=jp.toLowerCase(),Fp=Mp.toLowerCase(),Ip=/^i(os$|p)/.test(Fp)||Fp===`macintel`&&Np>1,Lp=`android`,Rp=Fp===Lp||Pp.includes(Lp),zp=!Ip&&Fp.startsWith(`mac`);Fp.startsWith(`win`),!Rp&&/^(linux|chrome os)/.test(Fp);var Bp=zp||Ip,Vp=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Vp&&Pp.includes(`firefox`),!Vp&&Pp.includes(`chrom`);var Hp=Bp,Up=/jsdom|happydom/.test(Pp);function Wp(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Gp(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&cd(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Kp(e,t){let n=e;for(;n;){if(od(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(cd(n)?n.host:null)}return null}function qp(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Jp=`data-base-ui-focusable`,Yp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Xp=`ArrowLeft`,Zp=`ArrowRight`,Qp=`ArrowUp`,$p=`ArrowDown`,em=`data-starting-style`,tm=`data-ending-style`,nm={[em]:``},rm={[tm]:``},im={transitionStatus(e){return e===`starting`?nm:e===`ending`?rm:null}},am=`data-popup-open`,om=`data-pressed`,sm=`data-trigger-disabled`;function cm(e,t){if(!od(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(sm);for(let[,e]of t.entries())if(Gp(e,n))return!e.hasAttribute(sm);return!1}function lm(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 um(e){return e.matches(`html,body`)}function dm(e){return sd(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function fm(e){return Kp(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Yp}`)!=null}function pm(e){return e?e.getAttribute(`role`)===`combobox`&&dm(e):!1}function mm(e){if(!e||Up)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function hm(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function gm(e,t){return t<0||t>=e.length}function _m(e,t){return bm(e.current,{disabledIndices:t})}function vm(e,t){return bm(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function ym(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>bm(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:gm(e,u)?-1:u,wrapped:d}}function bm(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&&xm(e,a,r));return a}function xm(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!Cm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Sm(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Cm(e,t=e?bd(e):null){return!e||!e.isConnected||!t||Sm(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var wm=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Tm(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return cd(n)?n.host:null}function Em(e){for(let t of Array.from(e.children))if(nd(t)===`summary`)return t;return null}function Dm(e,t){let n=Em(t);return!!n&&(e===n||Gp(n,e))}function Om(e){let t=e?nd(e):``;return e!=null&&e.matches(wm)&&(t!==`summary`||e.parentElement!=null&&nd(e.parentElement)===`details`&&Em(e.parentElement)===e)&&(t!==`details`||Em(e)==null)&&(t!==`input`||e.type!==`hidden`)}function km(e){if(!Om(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Tm(t)){let n=t!==e,r=nd(t)===`slot`;if(t.hasAttribute(`inert`)||n&&nd(t)===`details`&&!t.open&&!Dm(e,t)||t.hasAttribute(`hidden`)||!r&&!Am(t,n))return!1}return!0}function Am(e,t){let n=bd(e);return t?n.display!==`none`:Cm(e,n)}function jm(e){let t=e.tabIndex;if(t<0){let t=nd(e);if(t===`details`||t===`audio`||t===`video`||sd(e)&&e.isContentEditable)return 0}return t}function Mm(e){if(nd(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Nm(e,t){let n=Mm(e);if(!n)return!0;let r=t.find(e=>{let t=Mm(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Mm(e);return t?.name===n.name&&t.form===n.form})===n}function Pm(e){if(sd(e)&&nd(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return sd(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Fm(e,t){Pm(e).forEach(e=>{Om(e)&&t.push(e),Fm(e,t)})}function Im(e,t,n){Pm(e).forEach(e=>{sd(e)&&e.matches(t)&&n.push(e),Im(e,t,n)})}function Lm(e){return km(e)&&jm(e)>=0}function Rm(e){let t=[];return Fm(e,t),t.filter(km)}function zm(e){let t=Rm(e);return t.filter(e=>jm(e)>=0&&Nm(e,t))}function Bm(e,t){let n=zm(e),r=n.length;if(r===0)return;let i=Wp(tf(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Vm(e){return Bm(tf(e).body,1)||e}function Hm(e){return Bm(tf(e).body,-1)||e}function Um(e,t,n){if(!e)return null;let r=[];Fm(tf(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(km);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Gp(n,o)&&Lm(o)&&Nm(o,a))return o}return r[i]}function Wm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Gp(n,r)}function Gm(e){zm(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Km(e){let t=[];Im(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 qm(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 Jm(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 Ym={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},Xm=class extends Cp{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:qm(e.toasts)},{},Ym)}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=Jm(this.state.toasts,t);r.toasts=e,r.toastMetadata=qm(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=Ym.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||Tp(`toast`);if(e.id){let t=Ym.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(Jm(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),Ym.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{let n=Ym.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=Ym.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)),Ym.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=Ym.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=Jm(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=kp(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=kp(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=kp(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??=Dp.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=qp(e);Gp(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=Ym.expandedOrOutOfFocus(this.state)?void 0:Dp.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:qm(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=Wp(tf(this.state.viewport));if(!this.state.viewport||!Gp(this.state.viewport,t)||!mm(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=Ym.toasts(this.state),r=Ym.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()}},Zm=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=Od(()=>new Xm({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return sp(a.disposeEffect),U.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,W.jsxs)(cp.Provider,{value:a,children:[(0,W.jsx)(Qm,{store:a,timeout:n,limit:r}),t]})};function Qm(e){let{store:t,timeout:n,limit:r}=e;return Pd(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}function $m(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function eh(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}var th={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},nh={...th,position:`fixed`,margin:0,top:0,left:0};({...th});var rh=U.forwardRef(function(e,t){let[n,r]=U.useState();Pd(()=>{Hp&&Vp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,W.jsx)(`span`,{...e,ref:t,style:nh,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),ih=`--toast-frontmost-height`,ah=U.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=lp(),c=Op(),l=U.useRef(!1),u=U.useRef(!1),d=U.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`);U.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=rd(e),n=tf(e);function r(t){t.key===`F6`&&qp(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,Wp(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){qp(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=qp(n),i=Wp(tf(e));r!==t&&Gp(e,r)&&mm(i)||s.resumeTimers(),c.start(0,()=>s.set(`isWindowFocused`,!0))}return eh($m(t,`keydown`,r),$m(t,`blur`,i,!0),$m(t,`focus`,a,!0),$m(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&&qp(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)}U.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||mm(Wp(tf(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function E(e){m&&!Gp(s.state.viewport,e.relatedTarget)&&(s.set(`focused`,!1),s.select(`expandedOrOutOfFocus`)||s.resumeTimers())}let ne={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:E,onKeyDown:x,onClick:te,onPointerDown:T,onPointerUp:ee,onPointerCancel:ee,style:{[ih]:_?`${_}px`:void 0}},D={expanded:h},re=!f&&g&&(0,W.jsx)(rh,{onFocus:b}),ie=Sf(`div`,e,{ref:[t,s.setViewport],state:D,props:[ne,o,{children:(0,W.jsxs)(U.Fragment,{children:[re,a,re]})}]});return(0,W.jsxs)(U.Fragment,{children:[re,ie,!m&&y.length>0&&(0,W.jsx)(`div`,{style:nh,children:y.map(e=>(0,W.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,W.jsx)(`div`,{children:e.title}),(0,W.jsx)(`div`,{children:e.description})]},e.id))})]})});function oh(e){return mf(19)?e:e?`true`:void 0}var sh=U.createContext(void 0);function ch(){let e=U.useContext(sh);if(!e)throw Error(Zd(66));return e}var lh=null;globalThis.requestAnimationFrame;var uh=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)}},dh=class e{static create(){return new e}static request(e){return uh.request(e)}static cancel(e){return uh.cancel(e)}currentId=lh;request(e){this.cancel(),this.currentId=uh.request(()=>{this.currentId=lh,e()})}cancel=()=>{this.currentId!==lh&&(uh.cancel(this.currentId),this.currentId=lh)};disposeEffect=()=>this.cancel};function fh(){let e=Od(dh.create).current;return sp(e.disposeEffect),e}function ph(e){return e==null?e:`current`in e?e.current:e}function mh(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var hh=null;function gh(e){if(!hh){let e=[];hh=e,queueMicrotask(()=>{hh=null,_l.flushSync(()=>{for(let t of e)t()})})}hh.push(e)}function _h(e,t=!1,n=!1){let r=fh();return jd((i,a=null)=>{r.cancel();let o=ph(e);if(o==null)return;let s=o,c=()=>{n?gh(()=>{a?.aborted||i()}):_l.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(mh(s).map(e=>e.finished.then(gf))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(mh(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=em;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 vh(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=jd(a),s=_h(r,n,i);U.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var yh={style:{transition:`none`}},bh=`data-base-ui-click-trigger`,xh=`data-base-ui-swipe-ignore`,Sh=`data-swipe-ignore`,Ch=`[${xh}]`,wh=`[${Sh}]`,Th={fallbackAxisSide:`none`},Eh={fallbackAxisSide:`end`},Dh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function Oh(e,t){let n=(t??rd(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 kh(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 Ah=`--toast-index`,jh=`--toast-offset-y`,Mh=`--toast-height`,Nh=`--toast-swipe-movement-x`,Ph=`--toast-swipe-movement-y`,Fh=`data-swipe-direction`,Ih={...im,swipeDirection(e){return e?{[Fh]:e}:null}},Lh=40,Rh=10,zh=.5,Bh=1,Vh=`${Ch},${wh}`,Hh=U.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=lp(),[f,p]=U.useState(void 0),[m,h]=U.useState(!1),[g,_]=U.useState(!1),[v,y]=U.useState({x:0,y:0}),[b,x]=U.useState({x:0,y:0,scale:1}),[S,C]=U.useState(),[w,T]=U.useState(),[ee,te]=U.useState(null),E=U.useRef(null),ne=U.useRef(void 0),D=U.useRef({x:0,y:0}),re=U.useRef({x:0,y:0,scale:1}),ie=U.useRef(void 0),ae=U.useRef(0),oe=U.useRef(!1),se=U.useRef({x:0,y:0}),O=U.useRef(!1),ce=U.useRef({x:0,y:0}),le=U.useRef(null),ue=U.useRef(null),de=d.useState(`toastIndex`,n.id),fe=d.useState(`toastVisibleIndex`,n.id),pe=d.useState(`toastOffsetY`,n.id),k=d.useState(`focused`),me=d.useState(`expanded`);vh({open:n.transitionStatus!==`ending`,ref:E,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let A=jd((e=!1)=>{let t=E.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:E,height:i,transitionStatus:void 0})}e?_l.flushSync(a):a()});Pd(()=>{let e=ne.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),x({x:0,y:0,scale:1}),he({x:0,y:0})),ne.current=n.id,A())},[A,n.id,n.transitionStatus]);function he(e){ce.current=e,y(e)}Pd(()=>()=>{ue.current?.abort()},[]);function ge(e,t){let n=e=>e>0?e**zh:-(Math.abs(e)**zh),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 j=jd(e=>{if(e.pointerId!==le.current)return;le.current=null,ue.current?.abort(),ue.current=null,h(!1),_(!1),te(null);let t=re.current;if(e.type===`pointercancel`||oe.current){he({x:t.x,y:t.y}),p(void 0);return}let r=ce.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(kh(e,i,a)>Lh){o=e;break}o?(p(o),d.closeToast(n.id)):(he({x:t.x,y:t.y}),p(void 0))});function _e(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),Kp(qp(e.nativeEvent),`button,a,input,textarea,[role="button"],${Vh}`)))return;oe.current=!1,ie.current=void 0,ae.current=0,le.current=e.pointerId,D.current={x:e.clientX,y:e.clientY},se.current=D.current;let t=e.currentTarget,n=Oh(t);re.current=n,x(n),he({x:n.x,y:n.y}),d.set(`hovering`,!0),h(!0),_(!1),te(null),O.current=!0,ue.current?.abort();let r=new AbortController;ue.current=r;let i=tf(t);i.addEventListener(`pointerup`,j,{signal:r.signal}),i.addEventListener(`pointercancel`,j,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function ve(e){if(e.pointerId!==le.current)return;e.preventDefault(),O.current&&=(D.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>se.current.y||i>0&&t<se.current.y)&&(se.current={x:se.current.x,y:t}),(r<0&&n>se.current.x||r>0&&n<se.current.x)&&(se.current={x:n,y:se.current.y});let a=n-D.current.x,o=t-D.current.y,s=t-se.current.y,c=n-se.current.x,u=ee;if(!g&&Math.sqrt(a*a+o*o)>=Bh){_(!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(!ie.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)&&(ie.current=d,ae.current=kh(d,a,o),p(d));else{let e=ie.current,t=kh(e,c,s);t>Lh?(oe.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&ae.current-t>=Rh&&(oe.current=!0)}let f=ge(a,o),m=re.current.x,h=re.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),he({x:m,y:h})}function ye(e){if(e.key===`Escape`){if(!E.current||!Gp(E.current,Wp(tf(E.current))))return;d.closeToast(n.id)}}U.useEffect(()=>{let e=E.current;if(!u||!e)return;function t(t){le.current!==null&&Gp(e,qp(t))&&t.preventDefault()}return $m(e,`touchmove`,t,{passive:!1})},[u]);function be(){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,[Nh]:`${e}px`,[Ph]:`${t}px`}}let xe=n.priority===`high`,Se={role:xe?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":S,"aria-describedby":w,"aria-hidden":xe&&!k?!0:void 0,onPointerDown:u?_e:void 0,onPointerMove:u?ve:void 0,onPointerUp:u?j:void 0,onPointerCancel:u?j:void 0,onKeyDown:ye,inert:oh(n.limited),style:{...be(),[Ah]:n.transitionStatus===`ending`?de:fe,[jh]:`${pe}px`,[Mh]:n.height?`${n.height}px`:void 0}},Ce=U.useMemo(()=>({toast:n,setTitleId:C,setDescriptionId:T,recalculateHeight:A,visibleIndex:fe,expanded:me}),[n,C,T,A,fe,me]),we={transitionStatus:n.transitionStatus,expanded:me,limited:n.limited||!1,type:n.type,swiping:m,swipeDirection:f},Te=Sf(`div`,e,{ref:[t,E],state:we,stateAttributesMapping:Ih,props:[Se,s]});return(0,W.jsx)(sh.Provider,{value:Ce,children:Te})}),Uh=U.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=ch(),l=U.useRef(null);return Pd(()=>{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]),Sf(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function Wh(){let[,e]=U.useState({});return U.useCallback(()=>{e({})},[])}var Gh=0;function Kh(e,t=`mui`){let n=U.useRef(void 0),r=Wh(),i=e??n.current;return U.useEffect(()=>{n.current??(Gh+=1,n.current=`${t}-${Gh}`,e??r())},[e,t,r]),i}var qh=Ed.useId;function Jh(e,t){if(qh!==void 0){let n=qh();return e??(t?`${t}-${n}`:n)}return Kh(e,t)}function Yh(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(Yh)}function Xh(e){return U.isValidElement(e)&&Yh(e.props.children)}function Zh(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=ch(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:Jh(e),children:s,type:r.type,setId:o}}function Qh(e,t,n){let r=Xh(e);return Pd(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var $h=U.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}=Zh(a,o,`description`);return Qh(Sf(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),eg=U.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}=Zh(a,o,`title`);return Qh(Sf(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),tg=U.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=lp(),{toast:l,expanded:u}=ch(),[d,f]=U.useState(!1),{getButtonProps:p,buttonRef:m}=rf({disabled:a,native:o}),h={type:l.type};return Sf(`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]})}),ng=U.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=ch(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=rf({disabled:a,native:o}),f={type:c.type},p=Sf(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return Xh(p)?p:null});function rg(e,t,n,r){let i=!1,a=!1,o=r??vf;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 ig(e,t,n){let r=n??vf;return{reason:e,event:t??new Event(`base-ui`),...r}}var ag=`none`,og=`trigger-press`,sg=`trigger-hover`,cg=`trigger-focus`,lg=`outside-press`,ug=`item-press`,dg=`close-press`,fg=`focus-out`,pg=`escape-key`,mg=`list-navigation`,hg=`keyboard`,gg=`pointer`,_g=`cancel-open`,vg=`sibling-open`,yg=`imperative-action`;function bg(e){return`data-base-ui-${e}`}var xg=U.createContext(null),Sg=()=>U.useContext(xg),Cg=bg(`portal`);function wg(e={}){let{ref:t,container:n,componentProps:r=vf,elementProps:i}=e,a=Jh(),o=Sg()?.portalNode,[s,c]=U.useState(null),[l,u]=U.useState(null),d=jd(e=>{e!==null&&u(e)}),f=U.useRef(null);Pd(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(ad(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=Sf(`div`,r,{ref:[t,d],props:[{id:a,[Cg]:``},i]}),m=s&&p?_l.createPortal(p,s):null;return{node:l,nodeId:U.isValidElement(p)?p.props.id:void 0,subtree:m}}var Tg=U.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}=wg({container:o,ref:t,componentProps:e,elementProps:c}),f=U.useRef(null),p=U.useRef(null),m=U.useRef(null),h=U.useRef(null),[g,_]=U.useState(null),v=U.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;U.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Wm(e)&&(e.type===`focusin`?v.current&&=(Km(l),!1):(Gm(l),v.current=!0))}return eh($m(l,`focusin`,e,!0),$m(l,`focusout`,e,!0))},[l,y]),Pd(()=>{l&&b===!0&&v.current&&(Km(l),v.current=!1)},[b,l]);let S=U.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,W.jsxs)(U.Fragment,{children:[d,(0,W.jsxs)(xg.Provider,{value:S,children:[x&&l&&(0,W.jsx)(rh,{"data-type":`outside`,ref:f,onFocus:e=>{Wm(e,l)?m.current?.focus():Hm(g?g.domReference:null)?.focus()}}),x&&l&&(0,W.jsx)(`span`,{role:s,"aria-owns":u,style:Dh}),l&&_l.createPortal(a,l),x&&l&&(0,W.jsx)(rh,{"data-type":`outside`,ref:p,onFocus:e=>{Wm(e,l)?h.current?.focus():(Vm(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,rg(`focus-out`,e.nativeEvent)))}})]})]})}),Eg=U.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=wg({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,W.jsxs)(U.Fragment,{children:[l,c&&_l.createPortal(n,c)]})}),Dg=U.forwardRef(function(e,t){return(0,W.jsx)(Eg,{ref:t,...e})});function Og(){let e=lp(),t=e.useState(`toasts`);return U.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function kg(){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||Tp(`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 Ag=kg();function jg(e){let t=(0,G.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,W.jsx)(Zm,{...n}),t[2]=n,t[3]=r),r}function Mg(e){let t=(0,G.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,W.jsx)(Dg,{"data-slot":`toast-portal`,...n}),t[2]=n,t[3]=r),r}function Ng(e){let t=(0,G.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=Ju(`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,W.jsx)(ah,{"data-slot":`toast-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pg(e){let t=(0,G.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=Ju(`group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-none! 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,W.jsx)(Hh,{"data-slot":`toast`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fg(e){let t=(0,G.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=Ju(`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,W.jsx)(Uh,{"data-slot":`toast-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ig(e){let t=(0,G.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=Ju(`text-sm font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(eg,{"data-slot":`toast-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lg(e){let t=(0,G.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=Ju(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)($h,{"data-slot":`toast-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rg({className:e,render:t=(0,W.jsx)(jf,{variant:`outline`,size:`sm`}),...n}){return(0,W.jsx)(ng,{"data-slot":`toast-action`,render:t,className:Ju(`shrink-0`,e),...n})}function zg({className:e,children:t,render:n=(0,W.jsx)(jf,{variant:`ghost`,size:`icon-sm`}),...r}){return(0,W.jsx)(tg,{"data-slot":`toast-close`,"aria-label":`Close toast`,render:n,className:Ju(`relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground`,e),...r,children:t??(0,W.jsx)(pl,{"aria-hidden":`true`})})}function Bg(e){let t=(0,G.c)(7),{type:n}=e,r=null;if(n===`success`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)($c,{"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,W.jsx)(rl,{"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,W.jsx)(ll,{"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,W.jsx)(hl,{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,W.jsx)(sl,{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,W.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 Vg(){let e=(0,G.c)(2),{toasts:t}=Og(),n;return e[0]===t?n=e[1]:(n=t.map(Hg),e[0]=t,e[1]=n),n}function Hg(e){return(0,W.jsx)(Pg,{toast:e,children:(0,W.jsxs)(Fg,{children:[(0,W.jsx)(Bg,{type:e.type}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsx)(Ig,{}),(0,W.jsx)(Lg,{})]}),(0,W.jsx)(Rg,{}),(0,W.jsx)(zg,{})]})},e.id)}function Ug(e){let t=(0,G.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?Ag:i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(Mg,{children:(0,W.jsx)(Ng,{children:(0,W.jsx)(Vg,{})})}),t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==r||t[7]!==a?(s=(0,W.jsxs)(jg,{toastManager:a,...r,children:[n,o]}),t[5]=n,t[6]=r,t[7]=a,t[8]=s):s=t[8],s}function Wg(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 Gg(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 Kg(){return qg.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var qg={stubThis:e=>e};function Jg(e){let{id:t}=e;return{...e,id:Gg(t),transports:e.transports,type:e.type}}function Yg(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 Xg=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 Zg({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 Xg({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 Xg({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 Xg({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 Xg({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 Xg({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Xg({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 Xg({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Xg({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(!Yg(t))return new Xg({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Xg({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 Xg({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 Xg({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 Qg=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}}},$g=[`cross-platform`,`platform`];function e_(e){if(e&&!($g.indexOf(e)<0))return e}async function t_(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(!Kg())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Gg(t.challenge),user:{...t.user,id:Gg(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Jg)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Qg.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Zg({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){n_(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Wg(e))}catch(e){n_(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Wg(c.getAuthenticatorData())}catch(e){n_(`getAuthenticatorData()`,e)}return{id:o,rawId:Wg(s),response:{attestationObject:Wg(c.attestationObject),clientDataJSON:Wg(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:e_(a.authenticatorAttachment)}}function n_(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 r_(){if(!Kg())return i_.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?i_.stubThis(new Promise(e=>e(!1))):i_.stubThis(e.isConditionalMediationAvailable())}var i_={stubThis:e=>e};function a_({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 Xg({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Xg({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Yg(t))return new Xg({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Xg({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 Xg({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 o_(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(!Kg())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(Jg));let a={...t,challenge:Gg(t.challenge),allowCredentials:i},o={};if(n){if(!await r_())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=Qg.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw a_({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=Wg(u.userHandle)),{id:c,rawId:Wg(l),response:{authenticatorData:Wg(u.authenticatorData),clientDataJSON:Wg(u.clientDataJSON),signature:Wg(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:e_(s.authenticatorAttachment)}}r(`MachineSchemaEncodeError`);var X=class extends r(`MachineSchemaDecodeError`){},s_=class extends r(`InfiniteTransitionError`){},c_=class extends r(`StartupError`){},l_=class extends r(`ChildAlreadyExistsError`){};r(`ProcessLocalError`);var u_=class extends r(`StoppedError`){},d_=e=>e instanceof s_||e instanceof X,f_=e=>d_(e)?z(e):Er(e),p_=e=>d_(e)||e instanceof c_?e:new c_({cause:zt(e)}),m_=e=>e,h_=`~effect/Machine/Target`,g_=Symbol(`effect/Machine/TargetSnapshot`),__=Symbol(`effect/Machine/StateInput`),v_=Symbol(`effect/Machine/HistoryTarget`),y_=Symbol(`effect/Machine/InitialTarget`),b_=Symbol(`effect/Machine/ChoiceTarget`),x_=Symbol(`effect/Machine/NoTarget`),S_=Symbol(`effect/Machine/Declined`),C_=Symbol(`effect/Machine/TargetSelection`),w_=Symbol(`effect/Machine/StateUpdate`),T_=Symbol(`effect/Machine/CombinedTarget`),E_=Symbol(`effect/Machine/SelectedBranch`),D_=(e,t,n,r)=>Object.freeze({[C_]:C_,kind:e,scope:n,path:t,...r===void 0?{}:{updatePath:r}}),O_=D_(`none`,void 0,`local`),k_=e=>L(e,C_),A_=(e,t)=>Object.freeze({[w_]:w_,path:e,value:t}),j_=e=>L(e,w_),M_=(e,t)=>Object.freeze({[T_]:T_,target:e,update:t}),N_=e=>L(e,T_),P_=(e,t,n,r)=>Object.freeze({[E_]:E_,owner:e,branchIndex:t,branchKey:n,result:r}),F_=e=>L(e,E_),I_=Object.freeze({[x_]:x_}),L_=()=>I_,R_=e=>L(e,x_),z_=Object.freeze({[S_]:S_}),B_=()=>z_,V_=e=>L(e,S_),H_=(e,t)=>({[v_]:v_,path:e,parent:t}),U_=e=>L(e,v_),W_=(e,t,n)=>({[y_]:y_,_tag:`InitialTarget`,path:e,value:t,...n===void 0?{}:{values:n}}),G_=e=>L(e,y_),K_=(e,t,n)=>({[b_]:b_,path:e,parent:t,...n===void 0?{}:{values:n}}),q_=e=>L(e,b_),J_=(e,t)=>{if(!_(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(!_(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(_(t))return{schema:t,output:void 0,annotations:Ne(t),type:`atomic`,history:void 0,initial:void 0,states:void 0};let n=L(t,`schema`)&&_(t.schema)?t.schema:void 0,r=n===void 0?t.annotations:Ne(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:_(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=_(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}},Y_=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=J_(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)}},X_=e=>typeof e==`object`&&e&&`branches`in e&&Array.isArray(e.branches)?Array.from(e.branches):[],Z_=e=>typeof e==`object`&&e&&`declinable`in e&&e.declinable===!0?`declinable`:`required`,Q_=e=>{let t=[];for(let n of e.stateNodes.byPath.values()){let r=m_(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:X_(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:Z_(i),branches:X_(i)})}r.always!==void 0&&t.push({source:n.path,trigger:{type:`always`},reenter:!1,acceptance:Z_(r.always),branches:X_(r.always)}),r.onDone!==void 0&&t.push({source:n.path,trigger:{type:`done`},reenter:!1,acceptance:Z_(r.onDone),branches:X_(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:Z_(a),branches:X_(a)})}}}return t},$_=(e,t,n)=>({[h_]:h_,[g_]:n?.snapshot,path:e,value:t,values:n?.values}),ev=e=>L(e,h_),tv=e=>({[__]:__,input:e}),nv=e=>L(e,__),rv=e=>L(e,`path`)&&L(e,`value`),iv=(e,t,n)=>{if(e.path===t)return Et(e);if(e.path!==``&&!t.startsWith(`${e.path}.`))return Mt();if(n!==void 0&&e.value!==void 0&&(n[e.path]=e.value),L(e,`state`)&&rv(e.state))return iv(e.state,t,n);if(L(e,`states`)&&typeof e.states==`object`&&e.states!==null){for(let r of Object.values(e.states))if(rv(r)){let e=iv(r,t,n);if(Fe(e))return e}}return Mt()},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},av=e=>{if(e.schema===void 0)throw Error(`Machine state "${e.path}" has no value schema`);return e.schema},ov=new WeakMap,sv=Symbol(`effect/Machine/EventConstruction`),cv=new WeakMap,lv=new WeakMap,uv=new WeakMap,dv=e=>{let t=e,n=lv.get(t);if(n!==void 0)return n;let r=le(Oe(e));return lv.set(t,r),r},fv=e=>{let t=e,n=uv.get(t);if(n!==void 0)return n;let r=Ce(Oe(e));return uv.set(t,r),r},pv=Symbol.for(`effect/Machine/protocol`),mv=e=>{let t=e[pv];if(t===void 0)throw Error(`Machine protocol is unavailable`);return t},hv=(e,t)=>{Object.defineProperty(e,pv,{value:t,enumerable:!1})},gv=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},_v=(e,t)=>{let n=ov.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},vv=e=>_v(e.events,`public`).schemas,yv=e=>_v(e.internalEvents,`internal`).schemas,bv=e=>_v(e.emittedEvents,`emitted`).schemas,xv=e=>{let t=vv(e),n=yv(e),r=bv(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];hv(e,{event:Ue(a),emit:Ue(r),eventConstructors:gv(a),emissionConstructors:gv(r)})},Sv=(e,t)=>hv(t,mv(e)),Cv=e=>L(e,`_tag`)?String(e._tag):void 0,wv=(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={[sv]:sv,_tag:n};return cv.set(o,{kind:e,schema:t,input:i,...a===void 0?{}:{inputError:a}}),Object.freeze(o)},Tv=e=>typeof e==`object`&&!!e&&cv.has(e),Ev=(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=>lt(e)?typeof e.literal==`string`||typeof e.literal==`number`?[e.literal]:[]:Zr(e)?[e.symbol]:an(e)?e.enums.map(([,e])=>e):Ar(e)?e.types.flatMap(a):Wr(e)?a(e.thunk()):[],o=e=>{let t=Sn(e.ast);if(Mn(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 Ue([e]).pipe(Vr(`_tag`)).discriminants}catch{return[]}};for(let t of n){let n=o(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)=>wv(e,t,r,n.length===0?{}:n[0]),enumerable:!0})}}return i},Dv=(e,t)=>{let n=Object.freeze(Array.from(t)),r=Ev(e,n);return ov.set(r,{kind:e,schemas:n}),Object.freeze(r)},Ov=(e,t,n,r)=>dv(t)(n).pipe(mi(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}}))),kv=(e,t,n,r)=>{let i=fv(t)(n);if(w(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},Av=(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:It(t)?t:L(n,`~effect/SchemaIssue/Issue`)?new ae(n):zt(t),...r.state===void 0?{}:{state:r.state},...r.event===void 0?{}:{event:r.event}})}},jv=(e,t,n)=>new X({machineId:e.id,boundary:n,event:String(t._tag),cause:zt(Error(`Constructed ${n} schema does not belong to the machine ${n} protocol`))}),Mv=(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}},Nv=(e,t,n,r)=>new X({machineId:e.id,boundary:n,event:String(t._tag),cause:zt(r)}),Pv=(e,t,n,r)=>{let i=cv.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)?z(jv(e,n,r)):Fi({try:()=>Mv(n,i),catch:t=>Nv(e,n,r,t)}).pipe(H(t=>i.schema.makeEffect(t).pipe(mi(t=>new X({machineId:e.id,boundary:r,event:String(n._tag),cause:new ae(t)})))))},Fv=(e,t,n,r)=>{let i=cv.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 jv(e,n,r);let o;try{o=Mv(n,i)}catch(t){throw Nv(e,n,r,t)}return Av(e,i.schema,o,{boundary:r,event:String(n._tag)})},Iv=(e,t)=>{let n=mv(e);if(Tv(t))return Pv(e,n,t,`event`);let r=Cv(t);return Ov(e,n.event,t,r===void 0?{boundary:`event`}:{boundary:`event`,event:r})},Lv=(e,t)=>{let n=mv(e);if(Tv(t))return Fv(e,n,t,`event`);let r=Cv(t);return kv(e,n.event,t,r===void 0?{boundary:`event`}:{boundary:`event`,event:r})},Rv=(e,t)=>{let n=mv(e);if(Tv(t))return Pv(e,n,t,`emission`);let r=Cv(t);return Ov(e,n.emit,t,r===void 0?{boundary:`emission`}:{boundary:`emission`,event:r})},zv=(e,t)=>{let n=mv(e);if(Tv(t))return Fv(e,n,t,`emission`);let r=Cv(t);return kv(e,n.emit,t,r===void 0?{boundary:`emission`}:{boundary:`emission`,event:r})},Bv=(e,t,n)=>kv(e,t,n,{boundary:`input`}),Vv=(e,t,n)=>nv(n)?av(t).makeEffect(n.input).pipe(mi(n=>new X({machineId:e.id,boundary:`state`,state:t.path,cause:new ae(n)}))):Ov(e,av(t),n,{boundary:`state`,state:t.path}),Hv=(e,t,n)=>nv(n)?Av(e,av(t),n.input,{boundary:`state`,state:t.path}):kv(e,av(t),n,{boundary:`state`,state:t.path}),Uv=(e,t,n)=>t.output===void 0?M(n):Ov(e,t.output,n,{boundary:`output`,state:t.path}),Wv=(e,t,n)=>t.output===void 0?n:kv(e,t.output,n,{boundary:`output`,state:t.path}),Gv=(e,t)=>{let n=new Set(ty(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)&&!ey(r,t.parent))throw Error(`Machine history contains state "${r}" outside parent "${t.parent}"`);if(t.mode===`shallow`&&$v(r,t.parent)&&Z(e,r).parent!==t.parent)throw Error(`Machine shallow history contains deep descendant "${r}"`)}},Kv=(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`||!(ey(n,t.parent)||ty(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,Hv(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}),Gv(e,n.get(r))}return n},qv=Cn(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*z(new X({machineId:e.id,boundary:`history`,state:r,cause:zt(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`||!(ey(n,t.parent)||ty(e,t.parent).includes(n)))return yield*z(new X({machineId:e.id,boundary:`history`,state:n,cause:zt(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*z(new X({machineId:e.id,boundary:`history`,state:n,cause:zt(Error(`Machine snapshot contains a value for structural state "${n}"`))}))}else{if(!s)return yield*z(new X({machineId:e.id,boundary:`history`,state:n,cause:zt(Error(`Machine snapshot omits remembered value for "${n}"`))}));o.set(n,yield*Ov(e,av(r),i.values[n],{boundary:`history`,state:n}))}}if(!a.has(t.parent)||Object.keys(i.values).length!==o.size)return yield*z(new X({machineId:e.id,boundary:`history`,state:r,cause:zt(Error(`Machine snapshot contains incomplete history record "${r}"`))}));n.set(r,{mode:i.mode,parent:t.parent,active:a,values:o});try{Gv(e,n.get(r))}catch(t){return yield*z(new X({machineId:e.id,boundary:`history`,state:r,cause:zt(t)}))}}return n}),Jv=(e,t)=>{let n={};for(let[r,i]of t){let t=Array.from(i.active).sort((t,n)=>ry(e,t,n));n[r]={mode:i.mode,active:t,values:Object.fromEntries(i.values)}}return n},Yv=(e,t)=>({...e,machineReferences:{self:t.self,parent:t.parent}}),Xv=e=>e.machineReferences,Zv=new WeakMap,Qv=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$v=(e,t)=>e!==t&&(t===``||e.startsWith(`${t}.`)),ey=(e,t)=>e===t||$v(e,t),ty=(e,t)=>{let n=Zv.get(e.stateNodes);n===void 0&&(n=new Map,Zv.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},ny=(e,t)=>ty(e,t).length,ry=(e,t,n)=>Z(e,t).order-Z(e,n).order,iy=(e,t,n)=>Z(e,n).children.some(e=>t.active.has(e)),ay=(e,t)=>{let n=Array.from(t.active).filter(n=>!iy(e,t,n)).sort((t,n)=>ry(e,t,n));if(n.length===0)throw Error(`Machine expected an active leaf state`);return n},oy=(e,t)=>ay(e,t)[0],sy=(e,t,n)=>{let r=ay(e,t).filter(e=>ey(e,n));if(r.length===0)throw Error(`Machine expected state "${n}" to have an active leaf state`);return r[0]},cy=(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`)},ly=(e,t,n)=>{let r={},i=ty(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},uy=(e,t,n)=>{let r=Z(e,n).parent;return r===void 0?void 0:t.values.get(r)},dy=(e,t)=>{let n=r=>t.active.has(r)?[r,...Z(e,r).children.flatMap(n)]:[];return e.stateNodes.roots.flatMap(n)},fy=(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=fy(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]=fy(e,t,i)}i.states=a}return i},py=(e,t)=>{let n=fy(e,t,cy(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:Jv(e,t.history)}),n},my=(e,t,n)=>{let r=fy(e,t,n);return t.history.size>0&&Object.assign(r,{history:Jv(e,t.history)}),r},hy=(e,t,n)=>{if(!L(n,`state`)||!rv(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},gy=(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},_y=(e,t,n,r)=>{let i=Z(e,n),a=r[i.key];if(!Qv(r,i.key)||!rv(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},vy=(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,Hv(e,i,t.value));if(i.type===`compound`&&a(hy(e,i,t)),i.type===`parallel`){let n=gy(i,t);for(let t of i.children)a(_y(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:Kv(e,t)}},yy=(e,t)=>vy(e,t),by=(e,t)=>{try{return vy(e,t)}catch(t){throw t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:zt(t)})}},xy=Cn(function*(e,t){let n=new Set,r=new Map,i=t.completed,a=Cn(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*Vv(e,i,t.value));if(i.type===`compound`&&(yield*a(hy(e,i,t))),i.type===`parallel`){let n=gy(i,t);for(let t of i.children)yield*a(_y(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*qv(e,t)}}),Sy=(e,t)=>xy(e,t).pipe(st(t=>{if(zr(t))return jr(tn(t,t=>t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:de(t)})));let n=Ae(t);return Fe(n)&&n.value instanceof X?z(n.value):z(new X({machineId:e.id,boundary:`configuration`,cause:t}))})),Cy=(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 ty(e,n.parent))t.active.has(r)&&o.add(r);for(let i of t.active)(i===n.parent||r===`deep`&&$v(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}},wy=(e,t)=>e.history.get(t),Ty=(e,t,n)=>{let r=new Set(n.active),i=new Map(n.values),a=new Map,o=ty(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)ey(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}};Cn(function*(e,t,n,r,i){let a=Z(e,n),o=new Set,s=new Map,c=new Map,l=ty(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&&Qv(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*Vv(e,c,r));else if(i!==void 0&&Qv(i,n))s.set(n,yield*Vv(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)ey(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}}),Cn(function*(e,t,n,r){let i=yield*xy(e,n),a=new Set(i.active),o=new Map(i.values),s=new Map(i.outputs),c=ty(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&&Qv(r,i))throw Error(`Machine structural target "${i}" cannot contain a value`)}else if(r!==void 0&&Qv(r,i))o.set(i,yield*Vv(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)ey(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&&Qv(r,n))for(let[t,i]of Object.entries(r)){if(!ey(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*Vv(e,r,i))}}}}return{active:a,values:o,outputs:s,history:new Map([...t.history,...i.history])}});var Ey=(e,t,n,r,i,a=!1)=>{let o=Z(e,n),s=new Set,c=new Map,l=new Map,u=ty(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&&Qv(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,Hv(e,a,r));else if(i!==void 0&&Qv(i,n))c.set(n,Hv(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)ey(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}},Dy=(e,t,n)=>{let r=Ey(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,Hv(e,n,r))}return{...r,active:i,values:a}},Oy=(e,t,n,r)=>{let i=vy(e,n),a=new Set(i.active),o=new Map(i.values),s=new Map(i.outputs),c=ty(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&&Qv(r,i))throw Error(`Machine structural target "${i}" cannot contain a value`)}else if(r!==void 0&&Qv(r,i))o.set(i,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)ey(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&&Qv(r,n))for(let[t,i]of Object.entries(r)){if(!ey(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,Hv(e,r,i))}}}}return{active:a,values:o,outputs:s,history:new Map([...t.history,...i.history])}},ky=(e,t,n)=>{if(ev(n)){let r=n[g_];if(r!==void 0){if(String(r.path)!==String(n.path))throw Error(`Machine expected target snapshot path to be "${n.path}"`);return Oy(e,t,r,n.values)}return Ey(e,t,n.path,n.value,n.values)}if(rv(n)){let r=by(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`)},Ay=(e,t)=>m_(e).handlers[t],jy=(e,t,n)=>Z(e,n).children.find(e=>t.active.has(e)),My=(e,t)=>Z(e,t).type===`final`,Ny=(e,t)=>Ay(e,t)?.onDone!==void 0,Py=(e,t,n)=>{if(!t.active.has(n))return!1;let r=Z(e,n);if(r.type===`compound`){let r=jy(e,t,n);return r!==void 0&&(n===``?!Ny(e,r)&&Py(e,t,r):My(e,r))}if(r.type===`parallel`){for(let n of r.children)if(!Py(e,t,n))return!1;return!0}return My(e,n)},Fy=(e,t)=>{let n=cy(e,t);return Py(e,t,n)&&!Ny(e,n)},Iy=(e,t,n)=>e.has(t)?{path:t,output:e.get(t),isNew:!1}:(e.set(t,n),{path:t,output:n,isNew:!0}),Ly=Cn(function*(e,t,n,r,i){let a=Z(e,n),o=Ay(e,n)?.output?.({state:t.values.get(n),containingState:uy(e,t,n),ancestors:ly(e,t,n),event:r,outputs:i});return yield*Uv(e,a,o)}),Ry=Cn(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=jy(e,t,n);if(o===void 0||(n===``?Ny(e,o):!My(e,o)))return;let s=yield*Ry(e,t,o,r,i,a);if(s===void 0)return;let c=Iy(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*Ry(e,t,n,r,i,a);o===void 0?c=!1:s[Z(e,n).key]=o.output}if(!c)return;let l=Iy(i,n,yield*Ly(e,t,n,r,s));return l.isNew&&a.push(l),l}if(!My(e,n))return;let s=Iy(i,n,yield*Ly(e,t,n,r));return s.isNew&&a.push(s),s}),zy=Cn(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=ny(e,n)-ny(e,t);return r===0?ry(e,t,n):r}))yield*Ry(e,a,t,n,r,i);return{configuration:a,completions:i}}),By=(e,t,n,r,i)=>{let a=Z(e,n),o=Ay(e,n)?.output?.({state:t.values.get(n),containingState:uy(e,t,n),ancestors:ly(e,t,n),event:r,outputs:i});return Wv(e,a,o)},Vy=(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=jy(e,t,n);if(o===void 0||(n===``?Ny(e,o):!My(e,o)))return;let s=Vy(e,t,o,r,i,a);if(s===void 0)return;let c=Iy(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=Vy(e,t,n,r,i,a);o===void 0?c=!1:s[Z(e,n).key]=o.output}if(!c)return;let l=Iy(i,n,By(e,t,n,r,s));return l.isNew&&a.push(l),l}if(!My(e,n))return;let s=Iy(i,n,By(e,t,n,r));return s.isNew&&a.push(s),s},Hy=(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=ny(e,n)-ny(e,t);return r===0?ry(e,t,n):r}))Vy(e,a,t,n,r,i);return{configuration:a,completions:i}},Uy=e=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Machine construction must be an object`);return e},Wy=(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 tv(Object.hasOwn(t,`data`)?t.data:{})}},Gy=(e,t,n={},r)=>{let i=e.byPath.get(t);if(i?.type===`atomic`||i?.type===`final`){let e=Uy(n);if(Reflect.ownKeys(e).some(e=>e!==`data`&&e!==`decoded`))throw Error(`Machine leaf construction accepts only data and decoded`);return $_(t,Wy(i,e))}let a=new Map,o=(t,n)=>{let i=Uy(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=Wy(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=Uy(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=Uy(n);for(;u.states!==void 0;){let t=e.byPath.get(l),n=Uy(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=Uy(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 K_(l,d.parent??``,p);if(d.type===`atomic`||d.type===`final`)return $_(l,f,{values:p});let m=new Map([...a].filter(([e])=>e.startsWith(`${l}.`)));return{...W_(l,f,p),...m.size===0?{}:{children:m}}},Ky=(e,t,n)=>{let r=Uy(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 A_(t,Wy(i,r))},qy=(e,t,n=``)=>{let r=Uy(t),i=e.byPath.get(n);Gy(e,n,r);let a=Wy(i,r);if(i.type===`choice`)return K_(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=Uy(r.states),s=Object.fromEntries(Object.entries(o).map(([t,r])=>[t,qy(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]}},Jy=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(t);return e},Yy=`root`,Xy=e=>{let t=new Map,n=(e,r)=>{let i=!_(e)&&`type`in e?e.type:void 0;if(t.set(r,i===`history`||i===`choice`?i:`state`),!_(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 "${Yy}" is reserved for the root`);return t},Zy=(e,t)=>{let n=Xy(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(Jy(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(Jy(t.branches,`Machine branches must be a map`))){let t=Jy(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={...Jy(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 $y({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}},Qy=(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}},$y=(e,t)=>{let n=[`target`,`history`,`none`,`initialize`].filter(e=>t[e]!==void 0);if(n.length===0&&t.update!==void 0){let n=Qy(t.update,e);if(n.kind!==`state`)throw Error(`Machine update requires an active state reference`);return D_(`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 O_}if(r===`initialize`){if(t.update!==void 0)throw Error(`Machine initialize cannot update a retained owner`);return D_(`state`,``,`branch`)}let i=Qy(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:Qy(t.update,e).path;if(a!==void 0&&r!==`target`)throw Error(`Machine owner updates require an ordinary destination`);return D_(i.kind,i.path,r===`history`?`full`:`branch`,a)},eb=(e,t,n,r)=>{let i=Jy(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`&&br(a.value))&&!(a.kind===`streams`&&gn(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}},tb=Symbol(`effect/Machine/InitialEvent`),nb=Symbol(`effect/Machine/SnapshotBuilderState`),rb=Symbol(`effect/Machine/ChildMachineLogic`),ib=new WeakSet,ab=e=>ib.has(e),ob=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Machine ${t} must be an object`);return e},sb=e=>typeof e==`function`?e:()=>e,cb=e=>{if(typeof e==`object`&&e&&L(e,`decoded`)&&e.decoded===!0&&L(e,`data`)){let t=ob(e,`decoded construction`);if(Reflect.ownKeys(t).some(e=>e!==`decoded`&&e!==`data`))throw Error(`Machine decoded construction accepts only decoded and data`);return sb(t.data)}let t=sb(e);return n=>tv(e===void 0?{}:t(n))},lb=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 sb(e.data)}let t=sb(e.data);return n=>tv(L(e,`data`)?t(n):{})},ub=(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(_(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?{}:ob(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?{}:ob(i,`parallel initial regions`);for(let[n,r]of Object.entries(t)){let t=e.states[n];if(t===void 0||!_(t)&&(t.type===`history`||t.type===`choice`))throw Error(`Machine invalid initial region "${n}"`);if(!_(t)&&(!(`schema`in t)||t.schema===void 0))throw Error(`Machine schema-less region "${n}" cannot construct data`);d[n]=cb(r)}}else{let t=ob(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||_(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=lb(t),l=e.states[a];if(L(t,`data`)&&!_(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?{}:ob(c[t],`state handler`),e);l[t]=a.node,(_(i)||i.type!==`history`)&&(c[t]!==void 0||!_(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{[nb]:i}};return ib.add(g),{node:m,handlers:{...s,...h.length===0?{}:{initialize:g},states:u}}};return n(e.node,t,``)},db=(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)},fb=e=>`child`in e?e.child.id:e.id,pb=(e,t)=>{let n=new Set;for(let r of e){let e=fb(r);if(n.has(e))throw Error(`Machine invocations for state "${t}" must have distinct ids; "${e}" is declared twice`);n.add(e)}},mb=e=>e===void 0?[]:Array.isArray(e)?e:[e],hb=e=>{let t=[],n=[],r=[];return{commands:t,raisedEvents:n,emittedEvents:r,enqueue:{raise:t=>{n.push(Lv(e,t))},emit:t=>{r.push(zv(e,t))},sendTo:(e,n)=>{t.push({_tag:`SendTo`,target:e,event:n})},stop:e=>{t.push({_tag:`Stop`,child:e})}}}},gb=(e,t)=>{let n=e.stateNodes.byPath.get(t);if(n===void 0)throw Error(`Machine expected state path "${t}" to exist`);return n},_b=e=>{let t={};return Object.defineProperty(t,"decoded",{value:e,enumerable:!1}),Object.defineProperty(t,"from",{value:(...t)=>e(tv(t.length===0?{}:t[0])),enumerable:!1}),t},vb=e=>{let t={};return Object.defineProperty(t,nb,{value:e,enumerable:!1}),t},yb=(e,t,n)=>{let r=vb(n);for(let i of t.children){let a=gb(e,i);a.schema===void 0||L(n,a.key)||(r[a.key]=_b(r=>{let i=Object.assign({},n);return i[a.key]=r,yb(e,t,i)}))}return r},bb=(e,t)=>{let n=gb(e,t);if(n.type===`parallel`)return yb(e,n,{});if(n.type!==`compound`)throw Error(`Machine state "${t}" cannot initialize child states`);let r=gb(e,n.initial);if(r.schema===void 0)throw Error(`Machine state "${t}" has no schema-valued initial child`);return _b(e=>vb({[r.key]:e}))},xb=(e,t)=>{if(typeof t!=`object`||!t||!L(t,nb))throw Error(`Machine initialize handler for "${e}" must return its builder result`);return t[nb]},Sb=Symbol(`effect/Machine/InvocationEvent`),Cb=(e,t,n)=>({[Sb]:!0,path:e,id:t,type:`done`,output:n}),wb=(e,t,n)=>({[Sb]:!0,path:e,id:t,type:`element`,element:n}),Tb=(e,t,n)=>({[Sb]:!0,path:e,id:t,type:`failure`,error:n}),Eb=(e,t,n)=>({[Sb]:!0,path:e,id:t,type:`snapshot`,snapshot:n}),Db=e=>typeof e==`object`&&!!e&&Sb in e,Ob=new WeakMap,kb=new WeakMap,Ab=(e,t)=>e.parent===void 0?{self:t.self}:{self:t.self,parent:t.parent},jb=(e,t)=>{let n=Object.create(e);return kb.set(n,Ab(e,t)),n},Mb=(e,t)=>{let n=t.machineReferences;if(n!==void 0)return Ab(e,n);let r=kb.get(e);if(r!==void 0)return r;let i=Ob.get(e);if(i!==void 0)return i;let a=Ab(e,{self:{id:e.id??`Machine`,sessionId:`Machine.plan`,send:()=>z(new u_)},parent:void 0});return Ob.set(e,a),a},Nb=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}},Pb=(e,t,n)=>{let r=hb(e);return t===void 0||t(n,r.enqueue),{commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents}},Fb=(e,t,n,r)=>{let i=hb(e),a=r===void 0?{result:t(n,i.enqueue),branchIndex:0,branchKey:void 0}:r(n,i.enqueue);return V_(a.result)?{declined:!0}:{declined:!1,state:R_(a.result)?void 0:a.result,branchIndex:a.branchIndex,branchKey:a.branchKey,commands:i.commands,raisedEvents:i.raisedEvents,emittedEvents:i.emittedEvents}},Ib=(e,t,n)=>{let r=hb(e);return{value:t(n,r.enqueue),commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents}},Lb=(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)=>ry(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=px(e,m,K_(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=G_(i)?zb(e,r,i,n):U_(i)?Bb(e,r,i,n):void 0;r=ky(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=m_(e).handlers[d]?.initialize;if(t===void 0){a.set(p.path,Hv(e,p,tv({}))),u=!0;continue}let i=Ib(e,t,{...Mb(e,m),state:m.values.get(d),containingState:uy(e,m,d),ancestors:ly(e,m,d),event:n,...d===``&&r!==void 0?{input:r.value}:{},...ab(t)?{}:{builder:bb(e,d)}}),l=xb(d,i.value);a.set(p.path,Hv(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:m_(e).handlers[d]?.initialize,h=m===void 0?void 0:Ib(e,m,{...Mb(e,p),state:p.values.get(d),containingState:uy(e,p,d),ancestors:ly(e,p,d),event:n,...d===``&&r!==void 0?{input:r.value}:{},...ab(m)?{}:{builder:bb(e,d)}}),g=h===void 0?void 0:xb(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,Hv(e,n,tv({})));continue}if(g===void 0||!Object.prototype.hasOwnProperty.call(g,n.key)){if(m!==void 0&&ab(m)){a.set(n.path,Hv(e,n,tv({})));continue}throw Error(`Machine parallel state initializer for "${d}" must return region "${n.key}"`)}a.set(n.path,Hv(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 Rb(e,t,n,r){let i=Dy(e,t,n);if(n.children===void 0||![...n.children.keys()].some(t=>Z(e,t).type===`choice`))return Lb(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=px(e,i,K_(t,n.parent),r);for(let t of[l.target,...l.additionalTargets]){let n=G_(t)?zb(e,i,t,r):U_(t)?Bb(e,i,t,r):void 0;i=ky(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=Lb(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 zb(e,t,n,r){let i=Rb(e,t,n,r),a=my(e,i.configuration,n.path);return{target:$_(n.path,a.value,{snapshot:a,values:n.values}),commands:i.commands,raisedEvents:i.raisedEvents,emittedEvents:i.emittedEvents,transitions:i.transitions}}function Bb(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=wy(t,n.path);if(a!==void 0){let i=Lb(e,Ty(e,t,a),r),o=my(e,i.configuration,n.parent),s=Object.fromEntries(i.configuration.values);return n.parent!==``&&t.active.has(``)&&delete s[``],{target:$_(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=m_(e).handlers[n.parent]?.history?.[o]?.default;if(s===void 0)throw Error(`Machine history state "${n.path}" requires a default implementation`);let c=Fb(e,s,{event:r,target:t=>qy(e.stateNodes,t),owner:n.parent});if(c.state===void 0||U_(c.state)||!rv(c.state))throw Error(`Machine history default for "${n.path}" must return a complete snapshot containing its owner`);let l=dx(c.state)===void 0?void 0:px(e,{active:new Set,values:new Map,outputs:new Map,history:t.history},c.state,r),u=l===void 0?by(e,c.state):ky(e,{active:new Set,values:new Map,outputs:new Map,history:t.history},l.target);for(let t of l?.additionalTargets??[])u=ky(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=my(e,u,n.parent),f=Object.fromEntries(u.values);return n.parent!==``&&t.active.has(``)&&delete f[``],{target:$_(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 Vb=(e,t)=>{if(!t.transition.declinable)return t;let n=Fb(e,t.transition.transition,t.context,t.transition.evaluate);return n.declined?void 0:{...t,collected:n}},Hb=(e,t)=>[...ty(e,t)].reverse(),Ub=(e,t,n)=>{let r=ty(e,t),i=ty(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},Wb=(e,t)=>{if(e!==void 0&&t!==void 0)return e===t||$v(e,t)?t:e},Gb=(e,t,n)=>Jb(e,Array.from(t.active).filter(e=>n===void 0||$v(e,n))),Kb=(e,t,n)=>Yb(e,Array.from(t.active).filter(e=>n===void 0||$v(e,n))),qb=(e,t)=>e.active.size===t.active.size&&Array.from(e.active).every(e=>t.active.has(e)),Jb=(e,t)=>Array.from(new Set(t)).sort((t,n)=>{let r=ty(e,n).length-ty(e,t).length;return r===0?Z(e,n).order-Z(e,t).order:r}),Yb=(e,t)=>Array.from(new Set(t)).sort((t,n)=>{let r=ty(e,t).length-ty(e,n).length;return r===0?ry(e,t,n):r}),Xb=(e,t,n,r)=>({...Mb(e,t),state:t.values.get(n),containingState:uy(e,t,n),ancestors:ly(e,t,n),event:r}),Zb=(e,t,n,r,i)=>({...Mb(e,t),state:t.values.get(n),containingState:uy(e,t,n),ancestors:ly(e,t,n),event:r,snapshot:i}),Qb=(e,t,n,r,i,a)=>({...Mb(e,t),state:t.values.get(n),containingState:uy(e,t,n),ancestors:ly(e,t,n),event:r,output:i,snapshot:a}),$b=(e,t,n,r,i)=>{let a=[],o=[],s=[];for(let c of n){let n=Pb(e,m_(e).handlers[c]?.[i],Xb(e,t,c,r));a.push(...n.commands),o.push(...n.raisedEvents),s.push(...n.emittedEvents)}return{commands:a,emittedEvents:s,raisedEvents:o}},ex=(e,t,n)=>{let r=[],i=new Set,a=new Map,o,s=()=>o??=py(e,t);for(let o of ay(e,t))for(let c of Hb(e,o)){let l=Nb(m_(e).handlers[c]?.always);if(l!==void 0){let u=a.get(c);if(a.has(c)||(u=Vb(e,{sourcePath:c,leafPath:o,trigger:{type:`always`},transition:l,context:{...Mb(e,t),state:t.values.get(c),containingState:uy(e,t,c),ancestors:ly(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},tx=(e,t,n,r)=>{let i=[],a=new Set,o,s=()=>o??=py(e,t);for(let o of r){let r=Nb(m_(e).handlers[o.path]?.onDone);if(r!==void 0&&!a.has(o.path)){a.add(o.path);let c=Vb(e,{sourcePath:o.path,leafPath:sy(e,t,o.path),trigger:{type:`done`},transition:r,context:Qb(e,t,o.path,n,o.output,s())});c!==void 0&&i.push(c)}}return i},nx=(e,t,n)=>{let r=[],i=new Set,a=new Map,o,s=()=>o??=py(e,t);for(let o of ay(e,t))for(let c of Hb(e,o)){let l=Nb(m_(e).handlers[c]?.on?.[n._tag]);if(l!==void 0){let u=a.get(c);if(a.has(c)||(u=Vb(e,{sourcePath:c,leafPath:o,trigger:{type:`event`,event:n._tag},transition:l,context:Zb(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},rx=(e,t,n)=>{if(!t.active.has(n.path))return[];let r=m_(e).handlers[n.path],i=mb(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=Nb(n.type===`element`?i.onElement:n.type===`done`?i.onDone:n.type===`failure`?i.onFailure:i.onSnapshot);if(a===void 0)return[];let o=py(e,t),s={...Mb(e,t),state:t.values.get(n.path),containingState:uy(e,t,n.path),ancestors:ly(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=Vb(e,{sourcePath:n.path,leafPath:sy(e,t,n.path),trigger:{type:`invoke`,id:n.id,outcome:n.type},transition:a,context:s});return c===void 0?[]:[c]},ix=e=>{if(U_(e)||q_(e)||ev(e)||rv(e))return String(e.path);throw Error(`Machine expected transition target to be a snapshot or target builder result`)},ax=(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(`, `)}`)}},ox=(e,t)=>{for(let n of e)if(t.includes(n))return!0;return!1},sx=(e,t)=>Array.from(t).sort((t,n)=>ry(e,t.selection.sourcePath,n.selection.sourcePath)),cx=e=>e.filter(t=>!e.some(e=>e.sourcePath!==t.sourcePath&&$v(e.sourcePath,t.sourcePath))),lx=(e,t)=>{let n=[];for(let r of sx(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(ox(r.exitPaths,i.exitPaths)||n){if($v(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},ux=(e,t={})=>{let n={...t},r=[],i=e=>{if(q_(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:K_(e.path,e.parent,n),values:n}))},dx=(e,t={})=>ux(e,t)[0],fx=(e,t)=>{if(q_(e))return K_(e.path,e.parent,{...t,...e.values??{}});if(G_(e))return{...e,values:{...t,...e.values}};if(!ev(e)||Object.keys(t).length===0)return e;let n=e[g_];return $_(e.path,e.value,{...n===void 0?{}:{snapshot:n},values:{...t,...e.values??{}}})};function px(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=ux(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 s_({machineId:e.id,state:d.target.path,maxIterations:hx});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=m_(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,Hv(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=Fb(e,p.transition,{...Mb(e,h),containingState:uy(e,h,f.path),ancestors:ly(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`);ax(f.path,{type:`choice`},p.targets,g.state);let _=ix(g.state);n=fx(g.state,d.values);let v=dx(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(!ev(n)&&!rv(n)&&!U_(n)&&!G_(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 mx=(e,t,n)=>{let r=n.leafPath,i=n.collected??Fb(e,n.transition.transition,n.context,n.transition.evaluate);if(i.declined)throw Error(`Machine transition returned decline without declaring declinable: true`);let a=N_(i.state)?i.state:void 0,o=a?.target??i.state,s=o===void 0||j_(o)?void 0:o;ax(n.sourcePath,n.trigger,n.transition.targets,s);let c=a?.update??(j_(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:Hv(e,n,c.value)}})(),u=l!==void 0&&(G_(s)||q_(s))?{...t,values:new Map(t.values).set(l.path,l.value)}:t,d=s===void 0?void 0:px(e,u,s,n.context.event),f=d?.target??s,p=f!==void 0&&G_(f)?zb(e,u,f,n.context.event):void 0,m=p?.target??f,h,g=U_(m)&&n.transition.reenter&&t.active.has(m.parent)?m:void 0;if(m!==void 0&&U_(m)){let i=n.transition.reenter?Z(e,n.sourcePath).parent:Ub(e,r,m.parent),a=g===void 0?Gb(e,t,i):Jb(e,Array.from(t.active).filter(e=>ey(e,m.parent)));h=Bb(e,a.includes(m.parent)?Cy(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(G_(r)){let i=zb(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(!U_(r)){S.push(r);continue}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)}let C=_===void 0?void 0:S.length===0||s===void 0?ix(_):ix(s),w=_===void 0?l===void 0?t:{...t,values:new Map(t.values).set(l.path,l.value)}:ky(e,t,_);for(let t of S)w=ky(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||!qb(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:Ub(e,r,C),E=Z(e,n.sourcePath).parent,ne=n.transition.reenter?Wb(te,E):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?Gb(e,t,ne):Jb(e,Array.from(t.active).filter(e=>ey(e,g.parent))),entryPaths:g===void 0?Kb(e,w,ne):Yb(e,Array.from(w.active).filter(e=>ey(e,g.parent))),choiceTransitions:[...d?.transitions??[],...p?.transitions??[],...h?.transitions??[],...x]}},hx=1e3,gx={_tag:tb},_x=(e,t)=>Fy(e,yy(e,t)),vx=(e,t,n)=>Sy(e,t).pipe(H(t=>zy(e,t,n)),H(t=>{let n=cy(e,t.configuration);return!Fy(e,t.configuration)||!t.configuration.outputs.has(n)?Er(Error(`Machine attempted to read terminal output from a non-terminal configuration`)):M(t.configuration.outputs.get(n))})),yx=(e,...t)=>{let n=e.input===void 0?t:t.length===0?(Bv(e,e.input,void 0),t):[Bv(e,e.input,t[0])],r=e.initial(...n),i={active:new Set,values:new Map,outputs:new Map,history:new Map},a=zb(e,i,r,gx),o=ky(e,i,a.target),s=py(e,o),c=dy(e,o),l=a.commands,u=a.raisedEvents,d=a.emittedEvents,f=$b(e,o,c,gx,`entry`),p=xx(e,o,gx,[...f.commands],[...u,...f.raisedEvents],[...d,...f.emittedEvents],a.transitions.length===0?[]:[{next:o,event:gx,transitions:a.transitions,commands:l,raisedEvents:[...u],emittedEvents:d,exitPaths:[],entryPaths:[],changed:!1,stabilize:!1}]),m={startingState:s,initialEntryPaths:c,state:py(e,p.next),commands:[...l,...p.commands],emittedEvents:p.emittedEvents,microsteps:p.microsteps.map(t=>({next:py(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}},bx=(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=cx(r),a=[];for(let n of i)a.push(mx(e,t,n));let o=lx(e,a),s=sx(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:ix(e.unresolvedTarget),resolvedTarget:e.target===void 0?void 0:ix(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=ky(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=Jb(e,s.flatMap(e=>e.exitPaths)),_=Yb(e,s.flatMap(e=>e.entryPaths));l=Cy(e,t,l,g);let v=$b(e,t,g,n,`exit`),y=$b(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}},xx=(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 s_({machineId:e.id,state:String(oy(e,s)),maxIterations:hx});let t=Hy(e,s,c);for(s=t.configuration,m.push(...t.completions.filter(t=>m_(e).handlers[t.path]?.onDone!==void 0));m.length>0&&!s.active.has(m[0].path);)m.shift();let n=tx(e,s,c,m.length===0?[]:[m.shift()]);if(n.length>0){let t=bx(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(Fy(e,s)){let t=cy(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?ex(e,s,c):[];if(h.length>0){let t=bx(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=nx(e,s,_);if(v.length===0){l=!0;continue}let y=bx(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}},Sx=(e,t,n)=>{let r=Db(n)?n:Lv(e,n);if(Fy(e,t)){let n=Hy(e,t,r),i=cy(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=Db(r)?rx(e,t,r):nx(e,t,r);if(i.length===0)return{event:r,next:t,commands:[],emittedEvents:[],microsteps:[],done:!1,output:void 0};let a=bx(e,t,r,i),o=[...a.commands],s=[...a.raisedEvents],c=[...a.emittedEvents],l=[a];return{...xx(e,a.next,r,o,s,c,l),event:r}},Cx=(e,...t)=>Fi({try:()=>yx(e,...t),catch:p_}),wx=(e,t)=>({raise:n=>Iv(e,n).pipe(H(e=>t.sendTo(t.self,e))),emit:n=>Rv(e,n).pipe(H(e=>t.emit(e)))}),Tx=(e,t)=>hr(e,e=>e._tag===`SendTo`?t.sendTo(e.target,e.event):t.stopChild(e.child),{discard:!0}),Ex=(e,t)=>je(Array.from(e,e=>t.emit(e)),{discard:!0}),Dx=new WeakMap,Ox=e=>{let t=Dx.get(e);if(t!==void 0)return t;let n={self:{id:e.id??`Machine`,sessionId:`Machine.plan`,send:()=>z(new u_)},parent:void 0};return Dx.set(e,n),n},kx=(e,t)=>{let n=t===void 0?Ox(e):t;return e.parent===void 0?{self:n.self}:{self:n.self,parent:n.parent}},Ax=new Set([`initialize`,`invoke`,`on`,`output`]),jx=e=>{if(e===void 0)return!0;for(let t of Reflect.ownKeys(e))if(!Ax.has(t))return!1;return!0},Mx=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=m_(e).handlers[a.path];if(!jx(o))return;if(o?.on===void 0)continue;let s=new Map;for(let e of Reflect.ownKeys(o.on)){let t=Nb(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)=>ry(e,t,n)),r.sort((t,n)=>ry(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=>ty(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&&(m_(e).handlers[``]===void 0||Reflect.ownKeys(m_(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}},Nx=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()}),Px=(e,t)=>t?{...e,next:Nx(e.next)}:e,Fx=(e,t,n)=>{e.values[t]=n},Ix=(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}},Lx=(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}},Rx=(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=Rx(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]=Rx(e,t,i)}i.states=a}return i},zx=(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=Rx(e,t,n);return t.completedOrder.length>0&&(r.completed=t.completedOrder.map(n=>({path:e.nodes[n].path,output:t.outputs[n]}))),r},Bx=(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{...kx(e,a),state:n.values[r],containingState:o<0?void 0:n.values[o],ancestors:s,event:i,snapshot:zx(t,n)}},Vx=Object.freeze([]),Hx=(e,t,n,r)=>{let i,a,o,s={raise:t=>{(a??=[]).push(Lv(e,t))},emit:t=>{(o??=[]).push(zv(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:R_(c.result)?void 0:c.result,branchIndex:c.branchIndex,branchKey:c.branchKey,commands:i??Vx,raisedEvents:a??Vx,emittedEvents:o??Vx}},Ux=(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:Bx(e,t,n,c,r,i)})}}}return a},Wx=(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},Gx=(e,t,n,r,i)=>{if((ev(r)?t.indexByPath.get(String(r.path)):void 0)===i&&n.active[i]===1&&ev(r)&&r[g_]===void 0&&r.values===void 0&&n.completedOrder.length===0&&t.valued[i]){let a=n.values.slice();return a[i]=Hv(e,t.nodes[i],r.value),{...n,values:a}}return Ix(t,ky(e,Lx(t,n),r))},Kx=(e,t,n,r)=>{let i=Hx(e,r.transition.transition,r.context,r.transition.evaluate),a=N_(i.state)?i.state:void 0,o=a?.target??i.state,s=a?.update??(j_(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:Hv(e,i,s.value)}})(),l=o===void 0||j_(o)?void 0:o;ax(r.sourcePath,r.trigger,r.transition.targets,l);let u=l!==void 0&&G_(l)?zb(e,(()=>{let e=Lx(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&&!ev(d)&&!rv(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=Nx(n);return e.values[t.indexByPath.get(c.path)]=c.value,e})():Gx(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||!Wx(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:ix(d),g=h===void 0?t.nodes[r.sourceIndex].parent:Ub(e,r.leafPath,h),_=t.nodes[r.sourceIndex].parent,v=r.transition.reenter?Wb(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:Gb(e,Lx(t,n),v),entryPaths:Kb(e,Lx(t,f),v),choiceTransitions:u?.transitions??[]}},qx=(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:ix(e.unresolvedTarget),resolvedTarget:e.target===void 0?void 0:ix(e.target),updates:e.update===void 0?[]:[e.update.path]});if(i.length===1){let s=Kx(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=sx(e,lx(e,i.filter(e=>!i.some(t=>t.sourceIndex!==e.sourceIndex&&$v(t.sourcePath,e.sourcePath))).map(r=>Kx(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=Gx(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?Jb(e,s.flatMap(e=>e.exitPaths)):[],entryPaths:f?Yb(e,s.flatMap(e=>e.entryPaths)):[],changed:f}},Jx=(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 s_({machineId:e.id,state:t.nodes[o.activeLeaves[0]].path,maxIterations:hx});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=Hy(e,Lx(t,o),s).configuration,i=cy(e,n);if(!n.outputs.has(i))throw Error(`Machine reached a terminal indexed configuration without a completed root output`);return{event:r,next:Ix(t,n),commands:c??Vx,emittedEvents:u??Vx,microsteps:d??Vx,done:!0,output:n.outputs.get(i)}}let m=t.nodes[n].path,h=Nb(m_(e).handlers[m]?.on?.[s._tag]);if(h!==void 0){let r=Hx(e,h.transition,{...kx(e,a),state:o.values[n],containingState:void 0,ancestors:{},event:s,snapshot:zx(t,o)},h.evaluate),f=j_(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`);Fx(o,n,Hv(e,r,f.value))}if(ax(m,{type:`event`,event:s._tag},h.targets,p),p!==void 0&&!ev(p)&&!rv(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=ev(p)?p[g_]===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]?Fx(o,n,Hv(e,t.nodes[n],p.value)):g=Gx(e,t,o,p,n)}let _=h.reenter||!Wx(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:ix(p),resolvedTarget:p===void 0?void 0:ix(p),updates:f===void 0?[]:[f.path]}]}:void 0,commands:r.commands,raisedEvents:r.raisedEvents,emittedEvents:r.emittedEvents,exitPaths:_?[m]:Vx,entryPaths:_?[t.nodes[v].path]:Vx,changed:_};o=g,(d??=[]).push(Px(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??Vx,emittedEvents:u??Vx,microsteps:d??Vx,done:!1,output:void 0};f+=1,s=g}},Yx=(e,t,n,r,i,a)=>{if(Db(r)){let i=Sx(e,a===void 0?Lx(t,n):Yv(Lx(t,n),a),r);return{event:i.event,next:Ix(t,i.next),commands:i.commands,emittedEvents:i.emittedEvents,microsteps:i.microsteps.map(e=>({next:Ix(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=Lv(e,r);if(t.flat)return Jx(e,t,n,o,i,a);if(t.finalIndices.some(e=>n.active[e]===1)){let r=Lx(t,n);if(Fy(e,r)){let n=Hy(e,r,o).configuration,i=cy(e,n);if(!n.outputs.has(i))throw Error(`Machine reached a terminal indexed configuration without a completed root output`);return{event:o,next:Ix(t,n),commands:[],emittedEvents:[],microsteps:[],done:!0,output:n.outputs.get(i)}}}let s=Ux(e,t,n,o,a);if(s.length===0)return{event:o,next:n,commands:[],emittedEvents:[],microsteps:[],done:!1,output:void 0};let c=qx(e,t,n,o,s,i),l=c.next,u=o,d=[...c.commands],f=[...c.raisedEvents],p=[...c.emittedEvents],m=[Px(c,i)],h=0,g=0;for(;;){if(g+=1,g>1e3)throw new s_({machineId:e.id,state:t.nodes[t.leafIndices.find(e=>l.active[e]===1)].path,maxIterations:hx});if(t.finalIndices.some(e=>l.active[e]===1)){let n=Hy(e,Lx(t,l),u).configuration;if(l=Ix(t,n),Fy(e,n)){let t=cy(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=Ux(e,t,l,n,a);if(r.length===0)continue;let s=qx(e,t,l,n,r,i);l=s.next,d.push(...s.commands),f.push(...s.raisedEvents),p.push(...s.emittedEvents),m.push(Px(s,i))}},Xx=new WeakMap,Zx=e=>({fromConfiguration:e=>e,toConfiguration:e=>e,snapshot:t=>py(e,t),plan:(t,n,r,i)=>Sx(e,i===void 0?t:Yv(t,i),n)}),Qx=(e,t)=>({fromConfiguration:e=>Ix(t,e),toConfiguration:e=>Lx(t,e),snapshot:e=>zx(t,e),plan:(n,r,i=!1,a)=>Yx(e,t,n,r,i,a),...Object.values(m_(e).handlers).some(e=>e.initialize!==void 0&&!ab(e.initialize))?{}:{initial:(n,r)=>{let i=e.input===void 0?n:n.length===0?(Bv(e,e.input,void 0),n):[Bv(e,e.input,n[0])],a=e.initial(...i),o=G_(a)?Rb(e,{active:new Set,values:new Map,outputs:new Map,history:new Map,...r===void 0?{}:{machineReferences:r}},a,gx).configuration:by(e,a),s=Hy(e,r===void 0?o:Yv(o,r),gx).configuration,c=Ix(t,s),l=zx(t,c);if(!Fy(e,s))return{state:l,configuration:c,activeConfiguration:s,initialEntryPaths:dy(e,s),done:!1,output:void 0};let u=cy(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:dy(e,s),done:!0,output:s.outputs.get(u)}}}}),$x=e=>{let t=Xx.get(e);if(t!==void 0)return t;let n=Mx(e),r=n===void 0?Zx(e):Qx(e,n);return Xx.set(e,r),r},eS=`Machine.invocation:`,tS=e=>e.startsWith(eS),nS=(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,lr(t,j)}},rS=e=>N(()=>{if(e.values!==void 0){let t=e.values;return e.values=void 0,M(t)}let t=Ke();return e.waiter=t,T(t).pipe(V(rS(e)))}),iS=(e,t)=>e._tag===`Started`&&(typeof t==`string`||e.descriptor!==void 0&&e.descriptor.id===t.id&&e.descriptor.machine===t.machine),aS=(e,t,n)=>{if(e.closed)return Mt();let r=e.children.get(t);return r!==void 0&&iS(r,n)?Et(r.ref):Mt()},oS=e=>{if(e.observers!==void 0)for(let t of e.observers)nS(t,aS(e,t.id,t.child))},sS=(e,t,n)=>{let r=e.children.get(t);r!==void 0&&r.token===n&&(e.children.delete(t),typeof t==`string`&&oS(e))},cS=(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`&&oS(e),!0},lS=e=>zn(function*(){let t=yield*Pi(),n=0,r=0,i=0,a=0;return{rootSessionId:e,stream:ki(t).pipe(St(F(()=>{n+=1})),Un(F(()=>{--n}))),isActive:()=>n>0,nextDeliveryId:()=>i++,nextMacrostepId:()=>a++,publishUnsafe:i=>{n!==0&&O(t,{...i,sequence:r++,rootSessionId:e})},close:xe(t)}}),uS=e=>({id:e.id,sessionId:e.sessionId}),dS=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?uS(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?uS(t):{id:String(t.id)}}]:[]}return[]}),fS=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:dS(Array.isArray(e.commands)?e.commands:[]),exitPaths:Array.isArray(e.exitPaths)?e.exitPaths:[],entryPaths:Array.isArray(e.entryPaths)?e.entryPaths:[],changed:e.changed===!0})),pS=Symbol.for(`effect/Machine/activeSnapshotObserver`),mS=Symbol.for(`effect/Machine/snapshotObserver`),hS=e=>typeof e==`object`&&!!e&&mS in e,gS=Symbol.for(`effect/Machine/sendParentOverride`),_S=Symbol.for(`effect/Machine/acknowledgedSend`),vS=Symbol(`effect/Machine/AcknowledgedMessage`),yS=e=>typeof e==`object`&&!!e&&vS in e,bS=e=>yS(e)?e.event:e,xS=(e,t)=>{e!==void 0&&yS(e)&&(e.deferred!==void 0&&lr(e.deferred,M(t)),e.inspection?.complete(t))},SS=(e,t)=>{e!==void 0&&yS(e)&&e.deferred!==void 0&&lr(e.deferred,jr(t))},CS=e=>{e!==void 0&&yS(e)&&e.deferred!==void 0&&lr(e.deferred,z(new u_))},wS=e=>typeof e==`object`&&!!e&&`send`in e&&typeof e.send==`function`,TS=(e,t,n,r)=>`inspectionSubject`in e&&`sendInspected`in e&&typeof e.sendInspected==`function`?e.sendInspected(t,n,r):e.send(t),ES=e=>e?._tag===`Childless`||e?.childless===!0,DS=(e,t)=>{let n=e.items??[];e.items=n,n.push(t)},OS=e=>{if(e.items===void 0)return Mt();let t=e.items[e.index];return e.index+=1,e.index===e.items.length&&(e.items=void 0,e.index=0),Et(t)},kS=e=>{if(e.items!==void 0)for(let t=e.index;t<e.items.length;t+=1)CS(e.items[t]);e.closed=!0,e.items=void 0,e.index=0},AS=()=>({items:void 0,index:0,closed:!1,receivers:new Set}),jS=(e,t,n)=>{if(e.closed)return!1;for(DS(e,t),n?.();e.items!==void 0&&e.receivers.size>0;){let t=e.receivers.values().next().value;e.receivers.delete(t),t(j)}return!0},MS=e=>N(()=>{let t=OS(e);return Fe(t)?M(t.value):e.closed?Ir:nn(t=>(e.receivers.add(t),F(()=>{e.receivers.delete(t)}))).pipe(V(MS(e)))}),NS=e=>{kS(e);let t=Array.from(e.receivers);e.receivers.clear();for(let e of t)e(Ir)},PS=class extends $r()(`effect/Machine/MachineRuntime`){},FS=(e,t)=>x(e,PS,t),IS=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(Zt);if(t!==void 0)return{_tag:`Failure`,error:t.error,cause:e.cause,snapshot:e};let n=e.cause.reasons.find(Te);return n===void 0?e.cause.reasons.find(Gt)===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}}},LS=(e,t)=>N(()=>e(t)).pipe(er,Qt),RS=(e,t)=>{class n{nextSessionId;constructor(){let e=0;this.nextSessionId=F(()=>`machine:${e++}`)}get start(){return e}get startCompiledSync(){return t}}return F(()=>new n)},zS=(e,t,n)=>({id:t,sessionId:n,kind:e.inspection?.kind??`Logic`}),BS=(e,t)=>t?{_tag:`Initialization`}:e!==void 0&&yS(e)&&e.inspection!==void 0?{_tag:`Macrostep`,macrostepId:e.inspection.macrostepId}:void 0,VS=(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=fS(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{[vS]:!0,event:n,...a===void 0?void 0:{deferred:a},inspection:c}},HS=(e,t,n)=>{if(!yS(n)||n.inspection===void 0)return;let r=n.inspection;e.publishUnsafe({_tag:`EventSent`,subject:t,deliveryId:r.deliveryId,source:r.source,target:uS(t),event:r.event,causedBy:r.causedBy})},US=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:j}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 N(()=>{if(this.registry.closed)return Ir;if(this.has(t.key)||this.registry.children.has(t.id))return z(new l_({id:t.duplicateId}));let a=e(),o=this.registry.scope??=xt(`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()?TS(this.self,e,t,n):j,...this.sendAcknowledged===void 0?void 0:{[_S]:e=>i()?this.sendAcknowledged(e):Ir}},c={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,cS(this.registry,t.id,n,e,t.descriptor)),onStopSync:()=>sS(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}}},l=a.execution,u=this.services!==void 0&&t.onSnapshot===void 0&&l?._tag===`Compiled`&&l.childless&&l.drain._tag===`Owned`&&l.initialSync!==void 0,d=(u?H(this.runtime.nextSessionId,e=>this.runtime.startCompiledSync(a,c,this.scopedServices??=Cr(this.services,_t,o),e)):this.runtime.start(a,c)).pipe(_n(e=>Ni(e)?j:(sS(this.registry,t.id,n),r===void 0?j:r.stop)));return(u?d:re(d,o)).pipe(Qt)})}stopAll(){return N(()=>{let e=[];for(let t of this.registry.children.values())t.ownerActive&&e.push(this.stopEntry(t));return e.length===0?j:e.length===1?e[0]:je(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]:je(n,{concurrency:`unbounded`,discard:!0})}},WS=Qe(Mt()).pipe(yr(vi)),GS=e=>j,KS=(e,t)=>{},qS=()=>void 0,JS=Symbol(`effect/Machine/EmissionsClosed`),YS=()=>{let e,t=N(()=>{let t=e;return t===JS?M(void 0):t===void 0?Pi().pipe(H(t=>F(()=>{let n=e;return n===JS?[void 0,!0]:n===void 0?(e=t,[t,!1]):[n,!0]}).pipe(H(([e,n])=>n?xe(t).pipe(Ee(e)):M(e))))):M(t)});return{emit:t=>N(()=>e===void 0||e===JS?j:rt(e,t).pipe(Qt)),close:()=>{let t=e;return e=JS,t===void 0||t===JS?j:xe(t)},stream:ir(t.pipe(R(e=>e===void 0?Jn:ki(e))))}},XS={close:()=>j,spawn:(()=>Er(Error(`Childless machine logic cannot spawn a process`))),get:()=>M(Mt()),changes:()=>WS,sendTo:()=>j,stop:()=>j,owned:{spawn:()=>Er(Error(`Childless machine logic cannot spawn an owned process`)),stopAll:()=>j,stopPaths:()=>void 0}},ZS=(e,t,n,r)=>{let i={closed:!1,children:new Map,observers:void 0,scope:void 0},a=e=>N(()=>{if(i.closed||(i.closed=!0,i.scope===void 0))return j;let t=_i(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?j:Array.isArray(a)?je(a,{concurrency:`unbounded`,discard:!0}):a}),o=(e,t)=>F(()=>sS(i,e,t)),s=(e,t,n,r)=>F(()=>cS(i,e,t,n,r)),c=e=>{let t=typeof e==`string`?e:e.id;return F(()=>{if(i.closed)return Mt();let n=i.children.get(t);return n!==void 0&&iS(n,e)?Et(n.ref):Mt()})},l=e=>{let t=typeof e==`string`?e:e.id;return pi(qe((n,r)=>F(()=>({child:e,id:t,values:void 0,waiter:void 0})).pipe(H(n=>{let a=F(()=>{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 y(r,a).pipe(V(F(()=>{!i.closed&&r.state._tag!==`Closed`&&(i.observers??=new Set,i.observers.add(n)),nS(n,aS(i,t,e))})),Ee(rS(n)))}))))},u=(e,t,n,r)=>{let a=typeof e==`string`?e:e.id;return N(()=>{if(i.closed)return j;let o=i.children.get(a);return o!==void 0&&iS(o,e)?TS(o.ref,t,n,r):j})},d=e=>{let t=typeof e==`string`?e:e.id;return N(()=>{if(i.closed)return j;let n=i.children.get(t);return n!==void 0&&iS(n,e)?n.ref.stop:j})};function f(n,r){let a=typeof n==`object`&&n&&rb in n?n:void 0,c=a===void 0?n:a[rb](r?.input),l=a===void 0?r:{id:a.id,descriptor:a},u=Symbol(),d=l?.id??u,f;return N(()=>i.closed?Ir:typeof d==`string`&&(i.children.has(d)||tS(d))?z(new l_({id:d})):(i.scope??=xt(`parallel`),i.children.set(d,{_tag:`Starting`,token:u}),t.start(c,{detached:!0,...l?.id===void 0?void 0:{id:l.id},...l?.onOutcome===void 0?void 0:{onOutcome:l.onOutcome},...l?.[pS]===void 0?void 0:{onSnapshot:l[pS]},...l?.[gS]===void 0?void 0:{sendParent:l[gS]},onReady:(e,t)=>F(()=>{f=e}).pipe(V(s(d,u,e,l?.descriptor)),H(e=>e?j:t)),onStop:o(d,u),parent:e,runtime:t,origin:{_tag:`Spawn`,address:l?.id}}).pipe(_n(e=>ft(e)?o(d,u).pipe(V(f===void 0?j:f.stop)):j),re(i.scope))))}return{close:a,spawn:f,get:c,changes:l,sendTo:u,stop:d,owned:new US(i,e,t,n,r)}},QS=(e,t,n,r)=>F(()=>ZS(e,t,n,r)),$S=(e,t)=>`${e.length}:${e}${t}`,eC=(e,t)=>`${eS}${$S(e,t)}`,tC=e=>({initial:()=>j,run:()=>e}),nC=(e,t,n)=>({initial:()=>j,run:({parent:r})=>{let i=r?.[_S];return i===void 0?Er(Error(`Stream invocation requires an acknowledged parent machine`)):ee(e,e=>i(wb(t,n,e)).pipe(Qt,st(()=>Ir)))}}),rC=(e,t)=>typeof e==`function`?e(t):e,iC=e=>({spawn:((t,n)=>e.spawn(t,n)),sendTo:((t,n)=>e.sendTo(t,n)),stop:(t=>e.stopChild(t))}),aC=(e,t,n)=>{if(`effect`in e)return{id:String(e.id),sourceName:e.sourceName,src:()=>tC(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:()=>tC(ar(rC(e.after,t))),onDone:e.onDone,activityKind:`Timer`};if(`stream`in e){let r=String(e.id);return{id:r,sourceName:e.sourceName,src:()=>nC(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:()=>rC(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[rb](`input`in e?rC(e.input,t):void 0),onDone:e.onDone,onFailure:e.onFailure,onSnapshot:e.onSnapshot}}throw Error(`Unsupported captured machine invocation: ${String(e)}`)},oC=e=>e.length===0?j:e.length===1?e[0]:je(e,{discard:!0}),sC=(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(Pn(`StoppedError`,()=>j)),cC=e=>e instanceof s_||e instanceof X||e instanceof u_,lC=(e,t,n,r,i,a,o,s,c,l,u,d)=>N(()=>{let f=$S(n,r),p=u===void 0?o:()=>{let t=o();return{...t,run:i=>Vt(N(()=>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):j,onOutcome:(t,i,o)=>V(pe,N(()=>i._tag===`Stopped`||!t()?j:i._tag===`Done`?s===void 0?e.failCause(zt(Error(`Invocation "${r}" completed without the required onDone handler`))):sC(e,Cb(n,r,i.output),u===void 0?void 0:o):i._tag===`Failure`&&c!==void 0&&(a===void 0||!cC(i.error))?sC(e,Tb(n,r,i.error),u===void 0?void 0:o):e.failCause(i.cause))),...l===void 0?void 0:{onSnapshot:(t,i)=>t()?sC(e,Eb(n,r,i)):j}})}),uC=(e,t)=>tS(e)?z(new l_({id:t})):void 0,dC=(e,t,n,r)=>{let i=String(r.id),a=r.address===void 0?void 0:uC(String(r.address),i);return a===void 0?lC(e,t,n,i,r.address===void 0?eC(n,i):String(r.address),r.descriptor,r.src,r.onDone,r.onFailure,r.onSnapshot,r.activityKind,r.sourceName):a},fC=(e,t,n,r)=>{let i=r.child,a=uC(i.id,i.id);return a===void 0?lC(e,t,n,i.id,i.id,i,i[rb],r.onDone,r.onFailure,r.onSnapshot,void 0):a},pC=(e,t,n,r,i,a)=>{let o=iC(t),s=Yb(e,i).filter(e=>r.active.has(e)).flatMap(i=>{let s={...Xv(r)??{self:t.self,parent:t.parent},children:o,state:r.values.get(i),containingState:uy(e,r,i),ancestors:ly(e,r,i),event:a};return mb(Ay(e,i)?.invoke).map(e=>`child`in e&&!(`input`in e)?fC(t,n,i,e):dC(t,n,i,aC(e,s,i)))});return s.length===0?void 0:oC(s)},mC=Symbol(`effect/Machine/CompiledStoppedCompletion`),hC=class{logic;options;services;id;sessionId;inspectionSubject;send;sendInspected(e,t,n){return this.offerEvent(e,t,n)}[_S](e){return this.sendAcknowledgedEffect(e)}[mS](e){let t=this.snapshotObservers??=new Set;return t.add(e),()=>{t.delete(e)}}mailbox={items:void 0,index:0,closed:!1};address;childRuntime=XS;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=zS(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:N(()=>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 BS(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:fS({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:be(e)})}get execution(){return this.logic.execution}initializeCompiledSync(){this.publishCreated(),this.execution.childless||(this.childRuntime=ZS(this.address,this.options.runtime,this.services,e=>this.sendAcknowledgedEffect(e)));let e=this.options.parent,t=this.options.sendParent??(e===void 0?GS:this.inspector===void 0?e.send:t=>TS(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)=>wS(e)?this.inspector===void 0?e.send(t):TS(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?KS:(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(de(e)),z(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 gC(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?M(this):(this.runState=`Draining`,yt(this.drainRuntime(),this.services).pipe(Ee(this)))}initialize(){let e=this;return zn(function*(){e.publishCreated(),e.execution.childless||(e.childRuntime=yield*QS(e.address,e.options.runtime,e.services,t=>e.sendAcknowledgedEffect(t)));let t=e.options.parent,n=e.options.sendParent??(t===void 0?GS:e.inspector===void 0?t.send:n=>TS(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)=>wS(t)?e.inspector===void 0?t.send(n):TS(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?KS:(t,n=[])=>{e.initialEntryPaths=t,e.initialMicrosteps=n}};let r=t=>ft(t)?e.childRuntime.close(t):j,i=e.execution.initial,a=yield*(i===void 0?e.logic.initial(e.processScope).pipe(R(e=>({state:e,done:void 0,output:void 0}))):i(e.processScope)).pipe(_n(t=>(ft(t)&&e.publishStartFailed(t.cause),r(t))),Kr(F(()=>{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:Ai,poll:F(()=>Mi(OS(e.mailbox),bS)),receiveMessage:Ai,pollMessage:F(()=>e.pollCompiledMessage()),completeMessage:t=>e.completeCompiledMessage(t),state:F(()=>e.current.snapshot.state),setState:t=>e.setActiveState(t),updateState:t=>e.updateState(t)}:(e.compiledContext=new gC(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(Qt))),e.options.onSnapshot!==void 0&&(yield*LS(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 F(()=>this.current.snapshot.state)}get snapshot(){return F(()=>this.current.snapshot)}get changes(){return this.changesStream()}get emissions(){return this.externalEmissions?.stream??this.emissionsStream()}get join(){return N(()=>this.lifecycle===`Completed`?this.resolveCompletion(this.completion):(this.waiter??=Ke(),T(this.waiter)))}get stop(){return g(this.stopEffect())}child(e){return this.childRuntime.get(e)}childChanges(e){return this.childRuntime.changes(e)}requestTermination(e){return F(()=>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(Qt);return this.runState===`Initializing`?e:e.pipe(V(Ir))}failCause(e){let t={_tag:`Failure`,cause:e};return this.requestTermination(t).pipe(H(e=>e?On(this.settleRequestedTermination()).pipe(Qt):j))}sendAcknowledgedEffect(e){return Ft(t=>Ve().pipe(H(n=>this.offerEvent(e,void 0,void 0,n).pipe(V(t(T(n)))))))}offerEvent(e,t,n,r){return N(()=>{let i=this.inspector,a=this.inspectionSubject,o=i?.isActive()===!0&&a!==void 0?VS(i,a,e,t,n,r):r===void 0?e:{[vS]:!0,event:e,deferred:r};return this.offerMessage(o)})}offerMessage(e){return g(kt(t=>{if(this.mailbox.closed||this.lifecycle!==`Active`)return z(new u_);let n=this.inspector,r=this.inspectionSubject;n!==void 0&&r!==void 0&&HS(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&&DS(this.mailbox,e),this.runState!==`Idle`)return j;if(this.runState=`Draining`,o!==void 0){let n;try{n=o(a,e)}catch(e){n=Er(e)}return n!==void 0||this.hasTerminationRequest()?this.startWorker(n):(this.runState=`Idle`,this.scheduleChangesFlush(t.currentDispatcher),j)}return this.startWorker(void 0)}))}startWorker(e){let t=yt(this.drainRuntime(e),this.services);return(this.options.detached===!0?On(t,{startImmediately:!0}):li(t,{startImmediately:!0})).pipe(H(e=>F(()=>(e.pollUnsafe()===void 0&&(this.worker=e),this.interruptRequested?(this.interruptRequested=!1,!0):!1)).pipe(H(t=>t?On(this.interruptAndFinish(e)):j))),Qt)}stopEffect(){return N(()=>this.lifecycle===`Completed`||this.finishIdleChildlessStop()?j:this.requestTermination({_tag:`Stopped`}).pipe(H(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!==JS||this.current.terminalizing||this.current.snapshot.status!==`active`)return!1;this.emissionsPubSub=JS;let e={status:`stopped`,state:this.current.snapshot.state};return this.lifecycle=`TerminationRequested`,this.termination={_tag:`Stopped`},this.terminationSnapshot=e,kS(this.mailbox),this.current={revision:this.current.revision+1,terminalizing:!0,changes:void 0,snapshot:e},this.notifySnapshotObservers(),CS(this.inFlightMessage),this.inFlightMessage=void 0,this.interruptRequested=!1,this.compiledContext!==void 0&&(this.compiledContext.executionState=void 0),this.options.onStopSync?.(this),this.completion=mC,this.lifecycle=`Completed`,this.waiter!==void 0&&(lr(this.waiter,this.resolveCompletion(mC)),this.waiter=void 0),!0}settleRequestedTermination(){return N(()=>this.runState===`Draining`?this.worker===void 0?(this.interruptRequested=!0,this.awaitCompletion()):this.interruptAndFinish(this.worker).pipe(V(this.awaitCompletion())):this.finishRequestedTermination())}interruptAndFinish(e){return Bt(e).pipe(V(N(()=>this.lifecycle===`Completed`?j:this.finishRequestedTermination())))}awaitCompletion(){return this.lifecycle===`Completed`?j:this.join.pipe(er,Qt)}resolveCompletion(e){if(e!==mC)return e;let t=z(new u_);return this.completion=t,t}drainRuntime(e){let t=this;return Ft(n=>zn(function*(){let r=t.offerRevision,i=e;for(;;){if(t.hasTerminationRequest())return yield*t.finishRequestedTermination();let e=yield*n(N(()=>{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(er);if(t.flushPendingChanges(),ft(e))return t.lifecycle===`Active`&&(yield*t.requestTermination({_tag:`Failure`,cause:e.cause})),yield*t.finishRequestedTermination();if(Fe(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 N(()=>{if(this.lifecycle!==`TerminationRequested`)return j;let e=this.termination;if(e===void 0)return j;let t=this.terminationSnapshot??this.reserveTermination(e);if(t===void 0)return this.awaitCompletion();let n=e._tag===`Stopped`?Nt:e._tag===`Done`?m(e.output):be(e.cause),r=e._tag===`Stopped`?mC:e._tag===`Done`?M(e.output):jr(e.cause),i=this.options.onOutcome===void 0||e._tag===`Stopped`&&this.options.skipStoppedOutcome===!0?j:N(()=>this.options.onOutcome(IS(t))).pipe(er,Qt),a=this.inspector,o=this.inspectionSubject,s=a===void 0||o===void 0?this.closeEmissions():this.closeEmissions().pipe(V(F(()=>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`?Ie():n}))));return g(F(()=>{kS(this.mailbox)}).pipe(V(this.childRuntime.close(n)),V(this.setAndPublishSnapshot(t)),V(s),V(F(()=>{e._tag===`Failure`?SS(this.inFlightMessage,e.cause):CS(this.inFlightMessage),this.inFlightMessage=void 0})),V(i),V(this.options.onStop??j),V(this.options.inspectionRoot===!0&&this.inspector!==void 0?this.inspector.close:j),V(F(()=>{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&&(lr(this.waiter,this.resolveCompletion(r)),this.waiter=void 0)}))))})}publishSnapshot(e){let t=e.changes===void 0?M(e):rt(e.changes,[e]).pipe(Ee(e)),n=e.snapshot;return this.options.onSnapshot===void 0||n.status!==`active`?t:t.pipe(ce(()=>LS(this.options.onSnapshot,n)))}completeChanges(e){return e.changes===void 0?j:rt(e.changes,m(void 0)).pipe(Qt)}emitEvent(e){let t=this.externalEmissions===void 0?N(()=>this.emissionsPubSub===void 0||this.emissionsPubSub===JS?j:rt(this.emissionsPubSub,e).pipe(Qt)):this.externalEmissions.emit(e),n=this.inspector,r=this.inspectionSubject;return n===void 0||r===void 0?t:t.pipe(ce(()=>F(()=>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=JS,e===void 0||e===JS?j:xe(e)}getOrCreateEmissions(){return N(()=>{let e=this.emissionsPubSub;return e===JS?M(void 0):e===void 0?Pi().pipe(H(e=>F(()=>{let t=this.emissionsPubSub;return t===JS?[void 0,!0]:t===void 0?(this.emissionsPubSub=e,[e,!1]):[t,!0]}).pipe(H(([t,n])=>n?xe(e).pipe(Ee(t)):M(t))))):M(e)})}emissionsStream(){return ir(this.getOrCreateEmissions().pipe(R(e=>e===void 0?Jn:ki(e))))}setAndPublishSnapshot(e){return N(()=>{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(H(e=>this.completeChanges(e)),Qt)})}setActiveState(e){return N(()=>this.commitActiveState(e)??j)}pollCompiledMessage(){let e=OS(this.mailbox);return Fe(e)&&(this.inFlightMessage=yS(e.value)?e.value:void 0),e}beginCompiledMessage(e){this.inFlightMessage=yS(e)?e:void 0}completeCompiledMessage(e){xS(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]:O(a.changes,[a]):(r.push(a),t?a.pendingChanges=r:O(a.changes,r))),this.notifySnapshotObservers(),this.options.onSnapshot===void 0?void 0:LS(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,O(e.changes,t))}updateState(e){return N(()=>{let t=this.current;return t.terminalizing||t.snapshot.status!==`active`?j:e(t.snapshot.state).pipe(H(e=>{let n=this.current;return n.terminalizing||n.revision!==t.revision?j:this.setActiveState(e)}))})}getOrCreateChanges(){return N(()=>{let e=this.current;return e.snapshot.status===`active`?e.changes===void 0?Pi({replay:1}).pipe(H(e=>F(()=>{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(H(([t,n])=>n?xe(e).pipe(Ee(t)):M(t))))):M(e.changes):M(void 0)})}changesStream(){let e=this;return ir(zn(function*(){let t=yield*e.getOrCreateChanges();if(t===void 0)return Qe(e.current.snapshot);let n=yield*Le(t),r=e.current;return r.snapshot.status===`active`?Qe(r.snapshot).pipe(yr(pi(He(pt(n))).pipe(cn(e=>e.revision>r.revision),vt(e=>e.snapshot)))):Qe(r.snapshot)}))}},gC=class{scope;ownedChildren;process;executionState;constructor(e,t,n){this.scope=e,this.ownedChildren=t,this.process=n}poll(){return Mi(this.process.pollCompiledMessage(),bS)}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}},_C=Cn(function*(e,t){let n=t.sessionId??(yield*t.runtime.nextSessionId),r=yield*ri(),i=e.execution,a=new hC(e,t,r,n);return yield*(i.initialSync!==void 0&&t.onReady===void 0&&t.onSnapshot===void 0?a.initializeCompiledSync():a.initialize()).pipe(_n(e=>ft(e)?a.shutdownEmissions().pipe(V(t.inspectionRoot===!0&&t.runtime.inspection!==void 0?t.runtime.inspection.close:j)):j))}),vC=(e,t,n,r)=>new hC(e,t,n,r).initializeCompiledSync(),yC=Cn(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:p}=t,h=t.sessionId??(yield*f.nextSessionId),_=r??h,v=f.inspection,y=v===void 0?void 0:zS(e,_,h),b=v===void 0||t.activity===void 0?void 0:{...t.activity,sessionId:h},x,S,C=AS(),w=t.emissions??YS(),ee=yield*Ve(),te=yield*Ve(),E=T(te).pipe(er,Qt),ne=!0,D,re=se(ee,{_tag:`Stopped`}).pipe(Qt),ie=(e,t)=>N(()=>jS(C,e,t)?j:z(new u_)),ae=v===void 0?void 0:(e,t,n,r)=>N(()=>{let i=v.isActive()?VS(v,y,e,t,n,r):r===void 0?e:{[vS]:!0,event:e,deferred:r};return ie(i,()=>HS(v,y,i))}),oe=e.execution?._tag===`Compiled`?e=>Ft(t=>Ve().pipe(H(n=>(v===void 0?ie({[vS]:!0,event:e,deferred:n}):ae(e,void 0,void 0,n)).pipe(V(t(T(n))))),R(e=>e))):void 0,O={id:_,sessionId:h,stop:N(()=>ne?re:re.pipe(V(Ai))),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:de,owned:fe,sendTo:pe,spawn:k,stop:me}=XS;ES(e.execution)||({changes:le,close:ue,get:de,owned:fe,sendTo:pe,spawn:k,stop:me}=yield*QS(O,f,void 0,oe===void 0?void 0:e=>oe(e)));let A=e=>Ni(e)?j:(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(V(w.close()),V(t.inspectionRoot===!0&&v!==void 0?v.close:j))),he=u===void 0?c??j:F(()=>u(P)),ge=v===void 0?qS:()=>BS(D,ne),_e=p??(d===void 0?GS:v===void 0?d.send:e=>TS(d,e,y,ge())),ve=v===void 0?w.emit:e=>w.emit(e).pipe(ce(()=>F(()=>v.publishUnsafe({_tag:`Emitted`,subject:y,emission:e,causedBy:ge()})))),xe={self:O,parent:d,spawn:k,sendParent:_e,emit:ve,sendTo:v===void 0?((e,t)=>wS(e)?e.send(t):pe(e,t)):((e,t)=>wS(e)?TS(e,t,y,ge()):pe(e,t,y,ge())),stopChild:me,failCause:e=>se(ee,{_tag:`Failure`,cause:e}).pipe(Qt),inspectInitial:v===void 0?KS:(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 Se=yield*e.initial(xe).pipe(_n(A),Kr(F(()=>{ne=!1}))),Ce=yield*Sr({revision:0,terminalizing:!1,changes:void 0,snapshot:{status:`active`,state:Se}});b===void 0&&v?.publishUnsafe({_tag:`Initialized`,subject:y,snapshot:{status:`active`,state:Se},initialEntryPaths:x??[],microsteps:fS({microsteps:S??[]})});let we=s===void 0?e=>e.changes===void 0?M(e):rt(e.changes,[e]).pipe(Ee(e)):e=>{let t=e.changes===void 0?M(e):rt(e.changes,[e]).pipe(Ee(e)),n=e.snapshot;return n.status===`active`?t.pipe(ce(()=>LS(s,n))):t},Te=e=>e.changes===void 0?j:rt(e.changes,m(void 0)).pipe(Qt),De=e=>e.snapshot.status===`active`?M(e):Te(e).pipe(Ee(e)),Oe=e=>Qr(Ce).pipe(H(t=>t.revision===e.revision?we(e).pipe(H(De)):M(void 0))),ke=e=>Zn(Ce,t=>t.terminalizing?M([void 0,t]):R(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(H(e=>e===void 0?M(void 0):Oe(e)),R(e=>e?.snapshot)),Ae=e=>Hr(Ce,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(R(e=>e?.snapshot)),je=e=>un(Ce,t=>({revision:t.revision+1,snapshot:e,terminalizing:!0,changes:t.changes})).pipe(H(we),H(De),Qt),Me=v===void 0?e=>ke(t=>M(t.status===`active`?{status:`active`,state:e}:void 0)).pipe(Qt):t=>Qr(Ce).pipe(H(n=>ke(e=>M(e.status===`active`?{status:`active`,state:t}:void 0)).pipe(ce(r=>F(()=>{e.inspection?.kind!==`Machine`&&r!==void 0&&v.publishUnsafe({_tag:`StateChanged`,subject:y,before:n.snapshot.state,after:t,causedByDeliveryId:D!==void 0&&yS(D)?D.inspection?.deliveryId:void 0})})))),Qt),Ne=(e,n,r)=>{let a=i===void 0||e.status===`stopped`&&t.skipStoppedOutcome===!0?j:N(()=>i(IS(e))).pipe(er,Qt),o=v===void 0?w.close():w.close().pipe(V(F(()=>v.publishUnsafe(b===void 0?{_tag:`Terminated`,subject:y,snapshot:e}:{_tag:`ActivityStopped`,subject:b.owner,activity:b,exit:e.status===`stopped`?Ie():n}))));return g(F(()=>NS(C)).pipe(V(ue(n)),V(je(e)),V(o),V(F(()=>{ft(n)?SS(D,n.cause):CS(D),D=void 0})),V(a),V(he),V(t.inspectionRoot===!0&&v!==void 0?v.close:j),V(r)))},Pe=Ae(e=>({status:`stopped`,state:e.state})),Re=e=>Ae(t=>({status:`error`,state:t.state,cause:e})),ze=e=>Ae(t=>({status:`done`,state:t.state,output:e})),Be=e=>Ne(e,Nt,l(te,new u_)),Ue=(e,t)=>{let n=be(t);return Ne(e,n,rr(te,t))},We=(e,t)=>{let n=m(t);return Ne(e,n,se(te,t))},Ge=g(re.pipe(V(E))),Ke=e.execution?._tag===`Compiled`?{receiveMessage:MS(C).pipe(ce(e=>F(()=>{D=yS(e)?e:void 0}))),pollMessage:F(()=>OS(C)).pipe(ce(e=>F(()=>{Fe(e)&&(D=yS(e.value)?e.value:void 0)}))),completeMessage:e=>{xS(D,e),D=void 0}}:void 0,qe=v===void 0||e.execution?._tag===`Compiled`?MS(C).pipe(R(bS)):MS(C).pipe(ce(e=>F(()=>{D=e})),R(bS)),Je=v===void 0||e.execution?._tag===`Compiled`?F(()=>OS(C)).pipe(R(Mi(bS))):F(()=>OS(C)).pipe(ce(e=>F(()=>{Fe(e)&&(D=e.value)})),R(Mi(bS))),Ye=v===void 0?e=>ke(t=>t.status===`active`?e(t.state).pipe(R(e=>({status:`active`,state:e}))):M(void 0)).pipe(Qt):t=>Qr(Ce).pipe(H(n=>ke(e=>e.status===`active`?t(e.state).pipe(R(e=>({status:`active`,state:e}))):M(void 0)).pipe(ce(t=>F(()=>{e.inspection?.kind!==`Machine`&&t?.status===`active`&&v.publishUnsafe({_tag:`StateChanged`,subject:y,before:n.snapshot.state,after:t.state,causedByDeliveryId:D!==void 0&&yS(D)?D.inspection?.deliveryId:void 0})})))),Qt),Xe={...xe,...e.execution?._tag===`Compiled`&&!e.execution.childless?{ownedChildren:fe}:void 0,...Ke,receive:qe,poll:Je,state:Qr(Ce).pipe(R(e=>e.snapshot.state)),setState:Me,updateState:Ye},Ze=Zn(Ce,e=>e.snapshot.status===`active`?e.changes===void 0?Pi({replay:1}).pipe(R(t=>[t,{...e,changes:t}])):M([e.changes,e]):M([void 0,e])),$e=ir(zn(function*(){let e=yield*Ze;if(e===void 0)return Qe((yield*Qr(Ce)).snapshot);let t=yield*Le(e),n=yield*Qr(Ce);return n.snapshot.status===`active`?Qe(n.snapshot).pipe(yr(pi(He(pt(t))).pipe(cn(e=>e.revision>n.revision),vt(e=>e.snapshot)))):Qe(n.snapshot)})),P={id:_,sessionId:h,...v===void 0?void 0:{inspectionSubject:y,sendInspected:ae},state:Qr(Ce).pipe(R(e=>e.snapshot.state)),snapshot:Qr(Ce).pipe(R(e=>e.snapshot)),changes:$e,emissions:w.stream,join:T(te),stop:Ge,send:O.send,...oe===void 0?void 0:{[_S]:oe},child:de,childChanges:le};o!==void 0&&!o(P)?yield*re:a!==void 0&&(yield*a(P,re)),s!==void 0&&(yield*LS(s,{status:`active`,state:Se}));let et=e=>{switch(e._tag){case`Stopped`:return Pe;case`Done`:return ze(e.output);case`Failure`:return Re(e.cause)}},tt=(e,t)=>{switch(e._tag){case`Stopped`:return Be(t);case`Done`:return We(t,e.output);case`Failure`:return Ue(t,e.cause)}},it=e=>n===!0?On(e,{startImmediately:!0}):li(e,{startImmediately:!0}),at=yield*nt(ee),ot=ye(at)?yield*Ft(t=>t(N(()=>e.run(Xe))).pipe(er,H(e=>se(ee,ft(e)?{_tag:`Failure`,cause:e.cause}:{_tag:`Done`,output:e.value})))).pipe(it):void 0;return yield*it(Ft(e=>zn(function*(){let t=Fe(at)?yield*at.value:yield*e(T(ee)),n=yield*et(t);return ot!==void 0&&(yield*Bt(ot)),n===void 0?yield*E:yield*tt(t,n)}))),P}),bC=((e,t)=>e.execution?._tag===`Compiled`?_C(e,t):yC(e,t)),xC=RS(bC,vC),SC=new WeakMap,CC=e=>N(()=>{e.closed=!0;let t=Array.from(e.live).reverse();return e.live.clear(),hr(t,e=>e.stop,{discard:!0})}),wC=()=>{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},TC=e=>H(dr,t=>{let n=SC.get(t);if(n!==void 0)return e(n.hooks);let r=wC();return SC.set(t,r),V(y(t,CC(r)),e(r.hooks))});Cn(function*(e,t,n){let r=yield*xC,i=n===void 0?{detached:!0,runtime:r}:{...n,detached:!0,runtime:r};return t===`generic`?yield*TC(t=>yC(e,{...i,...t})):t===`compiled`?e.execution?._tag===`Compiled`?yield*TC(t=>_C(e,{...i,...t})):yield*Er(Error(`Machine cannot force the compiled runtime for generic process logic`)):yield*TC(t=>bC(e,{...i,...t}))});var EC=Cn(function*(e,t){let n=yield*xC;return yield*TC(r=>bC(e,t===void 0?{detached:!0,runtime:n,...r}:{...t,detached:!0,runtime:n,...r}))}),DC=Cn(function*(e,t,n){let r=yield*xC,i=yield*r.nextSessionId,a=yield*lS(i);r.inspection=a;let o=YS(),s=yield*Ve(),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*Kt(TC(n=>{let r={...c,...n};return t===`generic`?yC(e,r):t===`compiled`?e.execution?._tag===`Compiled`?_C(e,r):Er(Error(`Machine cannot force the compiled runtime for generic process logic`)):bC(e,r)}).pipe(_n(e=>Ze(s,e))));return{id:n?.id??i,sessionId:i,changes:ir(T(s).pipe(R(e=>e.changes))),emissions:o.stream,inspection:a.stream,start:l}}),OC=((e,t)=>DC(e,`auto`,t));P({_tag:ji(`MachineSnapshot`),version:ji(2),active:Lr(P({path:E,value:k(hi)})),completed:k(Lr(P({path:E,output:k(hi)}))),history:k(wt(E,P({mode:vn([`shallow`,`deep`]),active:Lr(E),values:wt(E,hi)})))});var kC=(e,t,n)=>{let r=Z(e,n);if(r.type===`compound`){let r=jy(e,t,n);if(r===void 0)throw Error(`Machine expected completed state "${n}" to have an active child`);return kC(e,t,r)}return r.output},AC=(e,t)=>zn(function*(){let n=yield*Sy(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)||!Py(e,n,a))throw Error(`Machine snapshot contains invalid completion "${a}"`);i.add(a);let o=kC(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*Ov(e,o,t.output,{boundary:`output`,state:a}))}return py(e,{...n,outputs:r})}).pipe(st(t=>jC(e,t))),jC=(e,t)=>{if(zr(t))return jr(tn(t,t=>t instanceof X?t:new X({machineId:e.id,boundary:`configuration`,cause:de(t)})));let n=Ae(t);return Fe(n)&&n.value instanceof X?z(n.value):z(new X({machineId:e.id,boundary:`configuration`,cause:t}))},MC=e=>e.length===0?j:e.length===1?e[0]:je(e,{discard:!0}),NC=(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}),PC=new WeakMap,FC=e=>{let t=PC.get(e);if(t!==void 0)return t;let n=Object.values(m_(e).handlers).some(e=>e.invoke!==void 0);return PC.set(e,n),n},IC=M(Mt()),LC=(e,t)=>{let n=$x(e),r=new WeakMap,i=t=>{let n=r.get(t.scope);return n===void 0&&(n=wx(e,t.scope),r.set(t.scope,n)),n},a=n=>{if(!t)return;let r=n.state();return _x(e,r)?vx(e,r,gx).pipe(R(Et)):void 0},o=e=>N(()=>c(e)??IC),s=(e,t,r,a,s)=>{let c=a.commands.length===0?void 0:Tx(a.commands,e.scope),l=a.emittedEvents.length===0?void 0:Ex(a.emittedEvents,i(e)),u=()=>{let i=N(()=>(t&&e.completeMessage({before:r,plan:NC(a,n.snapshot),after:s}),a.done?M(Et(a.output)):o(e)));return l===void 0?i:l.pipe(V(i))},d=()=>{let t=e.commit(s),n=u(),r=t===void 0?n:t.pipe(V(n));return t===void 0&&l===void 0?r:e.runAfterChanges(r)};return c===void 0?d():e.runAfterChanges(c.pipe(V(N(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(ye(e))return;r=e.value}let a=yS(r),c=a?r.event:r,l=t.state(),u;try{u=n.plan(t.executionState??n.fromConfiguration(by(e,l)),c,a,t.scope)}catch(e){return f_(e)}if(t.executionState=u.next,u.microsteps.length===0){a&&t.completeMessage({before:l,plan:NC(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(V(N(()=>(a&&t.completeMessage({before:l,plan:NC(u,n.snapshot),after:d}),o(t))))));a&&t.completeMessage({before:l,plan:NC(u,n.snapshot),after:d})}};return{run:e=>FS(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:FS(r,e.scope)}}},RC=class{initialized=!1;initial;constructor(e){this.initial=e}},zC=(e,t)=>{let n=$x(e);return r=>{let i=r.state();if(t&&_x(e,i))return vx(e,i,gx).pipe(R(Et));let a=r.scope,o=r.executionState,s=o instanceof RC?o:new RC;r.executionState=s;let c,l,u;return u=N(()=>{let t=r.pollMessage();if(ye(t))return l=void 0,M(Mt());let o=t.value,s=yS(o),d=s?o.event:o,f=i,p;try{p=n.plan(l??n.fromConfiguration(by(e,i)),d,s,a)}catch(e){return f_(e)}if(l=p.next,p.microsteps.length===0)return s&&r.completeMessage({before:f,plan:NC(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(Tx(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(Ex(p.emittedEvents,c??=wx(e,a))),p.done)b.push(r.ownedChildren.stopAll());else if(m)for(let[t,n]of g){let i=pC(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=N(()=>(s&&r.completeMessage({before:f,plan:NC(p,n.snapshot),after:v}),p.done?M(Et(p.output)):u));return b.length===0?e:MC(b).pipe(V(e))},C=()=>{let e=x(),t=S(),n=e===void 0?t:e.pipe(V(t));return e===void 0&&b.length===0?n:r.runAfterChanges(n)};return y.length===0?C():r.runAfterChanges(MC(y).pipe(V(N(C))))}),FS(N(()=>{if(s.initialized)return u;let t=s.initial,o=t?.activeConfiguration??by(e,i);l=t?.configuration??n.fromConfiguration(o);let c=pC(e,a,r.ownedChildren,o,t?.entryPaths??dy(e,o),gx);return s.initial=void 0,s.initialized=!0,c===void 0?u:c.pipe(V(u))}),a)}},BC=e=>e.done?{state:e.state,done:!0,output:e.output}:{state:e.state,done:!1,output:void 0},VC=(e,t)=>{let n=FC(e),r=$x(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=BC(t);return n?{...r,executionState:new RC({configuration:t.configuration,activeConfiguration:t.activeConfiguration,entryPaths:t.initialEntryPaths})}:r}catch(e){throw p_(e)}},s=t=>a===void 0?FS(Cx(jb(e,t),...i).pipe(H(n=>{t.inspectInitial(n.initialEntryPaths,n.microsteps);let r=n.commands.length===0?void 0:Tx(n.commands,t),i=n.emittedEvents.length===0?void 0:Ex(n.emittedEvents,wx(e,t)),a=M(BC(n));return r===void 0?i===void 0?a:i.pipe(V(a)):i===void 0?r.pipe(V(a)):r.pipe(V(i),V(a))})),t):Fi({try:()=>o(t),catch:p_});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:zC(e,t._tag===`Resume`)}:{_tag:`Owned`,...LC(e,t._tag===`Resume`)}},initial:n=>t._tag===`Resume`?FS(AC(e,t.snapshot),n):s(n).pipe(R(e=>e.state)),run:t=>FS(zn(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*Er(Error(`Machine statechart started without acknowledged mailbox access`));let c,l=yield*o;if(_x(e,l))return yield*vx(e,l,gx);if(!n){let n,o=Mt(),u;for(;c===void 0;){let d=Fe(o)?o.value:yield*a;o=Mt();let f=yS(d),p=f?d.event:d,m=l,h;try{h=Sx(e,Yv(n??by(e,l),t),p)}catch(e){return yield*f_(e)}if(n=h.next,h.microsteps.length>0){let n=py(e,h.next);yield*Tx(h.commands,t),yield*s(n),l=n,h.emittedEvents.length>0&&(yield*Ex(h.emittedEvents,u??=wx(e,t))),h.done&&(c={output:h.output})}f&&r({before:m,plan:NC(h,t=>py(e,t)),after:l}),c===void 0&&(o=yield*i,ye(o)&&(n=void 0))}return c===void 0?yield*Er(Error(`Machine process stopped receiving events before reaching a terminal configuration`)):c.output}let u=t.ownedChildren;if(u===void 0)return yield*Er(Error(`Invoking statechart started without an owned child runtime`));let d=(n,r,i)=>pC(e,t,u,n,r,i)??j,f=e=>u.stopPaths(e)??j;return yield*zn(function*(){let n=yield*Sy(e,l);yield*d(n,dy(e,n),gx),n=void 0;let o=Mt(),p;for(;c===void 0;){let m=Fe(o)?o.value:yield*a;o=Mt();let h=yS(m),g=h?m.event:m,_=l,v;try{v=Sx(e,Yv(n??by(e,l),t),g)}catch(e){return yield*f_(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=py(e,v.next);if(yield*Tx(v.commands,t),n&&(yield*f(r)),yield*s(a),l=a,v.emittedEvents.length>0&&(yield*Ex(v.emittedEvents,p??=wx(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:NC(v,t=>py(e,t)),after:l}),c===void 0&&(o=yield*i,ye(o)&&(n=void 0))}return c===void 0?yield*Er(Error(`Machine process stopped receiving events before reaching a terminal configuration`)):c.output}).pipe(_n(()=>u.stopAll()))}),t)}},HC=new WeakMap,UC=(e,...t)=>{if(t.length>0)return VC(e,{_tag:`Initial`,args:t});let n=HC.get(e);if(n!==void 0)return n;let r=VC(e,{_tag:`Initial`,args:t});return HC.set(e,r),r},WC=(e,t)=>VC(e,{_tag:`Resume`,snapshot:t}),GC=(e,...t)=>OC(UC(e,...t),e.id===void 0?void 0:{id:e.id}),KC=(e,t)=>EC(WC(e,t),e.id===void 0?void 0:{id:e.id}),qC={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`]},JC=[`title`,`description`,`documentation`],YC=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),XC=(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}`)},ZC=e=>Number.isFinite(Number(e)),QC=e=>e.length===0||e.some(e=>e===`untagged`)?`untagged`:e.every(e=>e===`tagged`)?`tagged`:`opaque`,$C=(e,t)=>{if(t.has(e))return`opaque`;if(Tr(e)||o(e)||$n(e)||pn(e)||Zr(e)||an(e))return`tagged`;if(lt(e))return typeof e.literal==`string`||typeof e.literal==`number`?`tagged`:`untagged`;let n=new Set(t).add(e);return Ar(e)?QC(e.types.map(e=>$C(e,n))):Wr(e)?$C(e.thunk(),n):Jt(e)?`opaque`:`untagged`},ew=(e,t=new Set)=>{if(t.has(e))return`opaque`;if(Mn(e)){let n=e.propertySignatures.find(({name:e})=>e===`_tag`)?.type;return n===void 0||ti(n)?`untagged`:$C(n,new Set(t).add(e))}let n=new Set(t).add(e);return Ar(e)?QC(e.types.map(e=>ew(e,n))):Wr(e)?ew(e.thunk(),n):Jt(e)?`opaque`:`untagged`},tw=e=>_(e)&&ew(Sn(e.ast))!==`untagged`,nw=(e,t,n)=>{let r=XC(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 "."`):ZC(n)?Q(e,r,`state keys cannot use numeric forms`):r},rw=(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,XC(t===`<root>`?``:t,`__proto__`),`${r} must not declare an implicit "__proto__" state key`)},iw=(e,t,n,r,i)=>{if(typeof n!=`object`||!n||Array.isArray(n)||!YC(n,r))return;let a=n[r];(typeof a!=`object`||!a||_(a)||a.type!==`history`)&&Q(e,`${t}.${r}`,i)},aw=(e,t,n,r)=>{let i=qC[r];for(let a of Reflect.ownKeys(n))i.includes(a)||Q(e,t,`${r} states cannot declare property "${String(a)}"`)},ow=(e,t,n)=>{rw(e,`${t}.annotations`,n,`schema-less state annotations`);for(let r of Reflect.ownKeys(n))JC.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`)},sw=(e,t,n,r,i=!1)=>{rw(e,n===``?`<root>`:n,t,`state trees`);for(let a of Reflect.ownKeys(t)){let o=i&&a===``?``:nw(e,n,a),s=t[a];if(_(s)){tw(s)||Q(e,o,`state schemas must decode to an object with a required PropertyKey _tag`);continue}rw(e,o,s,`state nodes`);let c=s.type,l=c===`history`?`history`:c===`choice`?`choice`:c===`parallel`?`parallel`:c===`final`?`final`:YC(s,`states`)?`compound`:`atomic`;if(aw(e,o,s,l),l===`history`||l===`choice`){r||Q(e,o,`${l} states must be declared below an active parent state`),YC(s,`annotations`)&&ow(e,o,s.annotations),l===`history`&&YC(s,`history`)&&s.history!==`shallow`&&s.history!==`deep`&&Q(e,`${o}.history`,`history must be "shallow" or "deep"`);continue}let u=YC(s,`schema`);u&&!tw(s.schema)&&Q(e,`${o}.schema`,`state schemas must decode to an object with a required PropertyKey _tag`),u&&YC(s,`annotations`)&&Q(e,`${o}.annotations`,`schema-backed states must declare annotations on their schema`),!u&&YC(s,`annotations`)&&ow(e,o,s.annotations),l===`atomic`&&YC(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`&&YC(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`)&&YC(s,`output`)&&!_(s.output)&&Q(e,`${o}.output`,`state output must be an Effect Schema`),l===`compound`?(iw(e,o,s.states,`initial`,`active and choice child states cannot use the reserved target selector key "initial"`),u&&iw(e,o,s.states,`with`,`schema-backed compound child states cannot use the reserved local target selector key "with"`),sw(e,s.states,o,!0)):l===`parallel`&&(YC(s,`states`)||Q(e,`${o}.states`,`parallel states must declare child regions`),iw(e,o,s.states,`initial`,`active and choice child states cannot use the reserved target selector key "initial"`),sw(e,s.states,o,!0))}},cw=e=>typeof e==`object`&&e?Object.freeze({...e}):e,lw=e=>{let t={};for(let n of Object.keys(e)){let r=e[n];if(_(r)){Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!1,writable:!1});continue}let i=r,a={...i};`states`in i&&(a.states=lw(i.states)),`annotations`in i&&(a.annotations=cw(i.annotations)),Object.defineProperty(t,n,{value:Object.freeze(a),enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(t)},uw=e=>lw(e),dw=(e,t=``)=>{if(_(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(YC(n,`fields`)&&(YC(n,`schema`)&&Q(`Machine.state`,t,`declare fields or schema, not both`),rw(`Machine.state`,t,n.fields,`state fields`),YC(n.fields,`_tag`)&&Q(`Machine.state`,t,`state fields cannot declare _tag`),r.schema=f(t,n.fields),delete r.fields),YC(n,`states`)){rw(`Machine.state`,t,n.states,`child states`);let e=Object.create(null);for(let r of Reflect.ownKeys(n.states))nw(`Machine.state`,t,r),e[r]=dw(n.states[r],r);r.states=e}return t===``?(sw(`Machine.state`,{"":r},``,!1,!0),uw({"":r})[``]):r},fw=`~effect/Machine`,pw=`~effect/Machine/ChildMachine`,mw={...Xt,...Gr,[fw]:fw,toJSON(){return{_id:`Machine`}}},hw=(e,t)=>{let n=Object.create(mw);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,Sv(e,n),n},gw=e=>e.kind===`none`?O_:D_(e.kind,e.path,e.scope,e.updatePath),_w=e=>Object.freeze({path:e.path,kind:e.kind,scope:e.scope}),vw=e=>e.updatePath===void 0?e.kind===`update`&&e.path!==void 0?[e.path]:[]:[e.updatePath],yw=(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(!k_(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`||!$v(r,e.path)||!$v(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}},bw=(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(!j_(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(!N_(e)||e.update.path!==t.updatePath)throw Error(`Machine target updating "${t.updatePath}" must return target construction .update(...)`)}else if(N_(e))throw Error(`Machine combined target requires an updating owner declaration`);if(e===void 0)return;let r=N_(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&&$v(i,t.path)))throw Error(`Machine transition resolver selected "${t.path}" but constructed "${i??`<invalid>`}"`)},xw=(e,t,n,r,i)=>{let a={...t,root:i===``?t.state:t.ancestors[``],decline:B_};delete a.target;let o=e.resolve(a,n);if(V_(o)){if(e.declinable!==!0)throw Error(`Machine transition for state "${i}" returned decline without declaring declinable: true`);return o}return bw(o,e.selection,r),o},Sw=e=>e.kind===`update`?void 0:e.path,Cw=e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<4294967295&&String(t)===e},ww=(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||Cw(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(!k_(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:gw(a)})}))},Tw=(e,t,n,r={},i)=>{let a=Uy(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 M_(K_(i.path,i.parent),Ky(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`?H_(n.path,n.parent):K_(n.path,n.parent)}if(e.kind===`update`)return Ky(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 M_(Gy(t,e.path,r,i),Ky(t,e.updatePath,n))}return Gy(t,e.path,a,i)},Ew=(e,t,n,r,i)=>Object.freeze(Object.fromEntries(e.map((e,a)=>[e.key,o=>P_(t,a,e.key,e.selection.kind===`none`?L_():Tw(e.selection,n,r,o,i))]))),Dw=(e,t,n)=>{if(t.kind===`none`){if(!R_(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`);bw(e,t,n)}},Ow=(e,t)=>({...e,root:t===``?e.state:e.ancestors[``]}),kw=(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:yw({target:()=>$y(t,i)},void 0,r,n,e).selection}]));return{branches:()=>a,reenter:i.reenter,declinable:f,resolve:(e,t)=>d&&!o(e)?B_():s(e,t)}}let p=$y(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 B_();if(s!==void 0)return s(e,a);if(h)return Tw(p,r,t,{input:g(e)});let l=u(e);return Tw(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)}}},Aw=(e,t,n,r,i)=>{let a=kw(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=ww(e.branches(),n,i),u=Object.freeze({}),d=(e,o)=>{let s={...e,root:n===``?e.state:e.ancestors[``],decline:B_};delete s.target,s.select=Ew(l,u,t,r,n);let d=a(s,o);if(V_(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(!F_(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 Dw(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=>Sw(e.selection)===void 0?[]:[e.selection.path]))],branches:l.map(e=>Object.freeze({type:`branch`,key:e.key,title:e.title,target:Sw(e.selection),selection:_w(e.selection),updates:vw(e.selection)})),evaluate:d,transition:(e,t)=>d(e,t).result}}let l=yw(a,void 0,t,n,i),u=(e,r)=>({result:xw(l,e,r,t,n),branchIndex:0,branchKey:void 0});return{reenter:s,declinable:c,targets:Sw(l.selection)===void 0?[]:[l.selection.path],branches:[{type:`direct`,target:Sw(l.selection),selection:_w(l.selection),updates:vw(l.selection)}],evaluate:u,transition:(e,t)=>u(e,t).result}},jw=(e,t,n,r)=>{let i=Object.create(null);for(let a of Reflect.ownKeys(e))i[a]=Aw(e[a],t,n,r,a);return i},Mw=(e,t,n,r)=>{let i=(Array.isArray(e)?e:[e]).map(e=>{let i=eb(r,e,n,e=>Ow(e,n));for(let e of[`onElement`,`onDone`,`onFailure`,`onSnapshot`])i[e]!==void 0&&(i[e]=Aw(i[e],t,n,r,e));return db(i,n)});return pb(i,n),Array.isArray(e)?Object.freeze(i):i[0]},Nw=(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=jw(d,t,s,i)),u.always!==void 0&&(u.always=Aw(u.always,t,s,i,`always`)),u.onDone!==void 0&&(u.onDone=Aw(u.onDone,t,s,i,`done`)),u.choice!==void 0&&(u.choice=Aw(u.choice,t,s,i,`choice`)),u.invoke!==void 0&&(u.invoke=Mw(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=J_(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`);Nw(e,t,r.states,s,i,l)}}},Pw=e=>e===``?Yy:e,Fw=e=>{let t=!1;for(let n of e.stateNodes.byPath.values())if(n.type===`choice`){t=!0;break}if(!t)return;let n=Q_(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(!$v(o,n)){let r=i.type===`branch`?`branch "${i.key}"`:`transition`;throw Error(`Machine transition from "${Pw(e.source)}" updates "${Pw(n)}" before choice "${t}", whose ${r} targets "${Pw(o)}" outside that owner`)}}}}}}},Iw=(e,t)=>(n=>{let r=ub(t.root,n),i=Object.assign(Object.create(mw),e);if(Sv(e,i),i.states=Object.freeze({"":r.node}),i.stateNodes=Y_(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:cb(n.root);i.initial=e=>({...W_(``,a({input:e})),input:{value:e}}),i.initialDefinition=Object.freeze({target:``,selection:Object.freeze({path:``,kind:`initial`,scope:`initial`})});let o=Object.create(null);Nw(o,i.stateNodes,i.states,``,{...t,initialize:e=>i.initial(i.input===void 0?void 0:Bv(i,i.input,e))},{"":r.handlers});let s=hw(i,o);return Fw(s),s}),Lw=e=>{let t=dw(e),n=Rw();return Object.freeze({...n,"~effect/Machine/State":`~effect/Machine/State`,node:t})},Rw=()=>({path:(e=>e),get:((e,t)=>iv(e,t).pipe(Mi(e=>e.value))),getWithParents:((e,t)=>{let n={};return iv(e,t,n).pipe(Mi(e=>({value:e.value,parents:n})))}),getSnapshot:iv,matches:((e,t)=>Fe(iv(e,t)))}),zw=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(Gr);return n.states=t,n.root=e.root,n.events=e.events,n.internalEvents=e.internalEvents??Dv(`internal`,[]),n.emittedEvents=e.emittedEvents??Dv(`emitted`,[]),n.parent=e.parent,n.input=e.input,n.id=e.id,n.handlers=Object.create(null),n.handle=Iw(n,Zy(e.root,e)),xv(n),n},Bw=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?[]:[or(e)]},Vw=e=>Dv(`public`,Bw(e)),Hw=(e,t)=>Uw(e,t,e=>t.input===void 0?UC(t):UC(t,e)),Uw=(e,t,n)=>({[pw]:pw,id:e,machine:t,[rb]:n}),Ww=GC,Gw=KC,Kw=Lw,qw=zw,Jw=Vw,Yw=(e,t)=>{try{let n=yx(e,...t);return{machine:e,snapshot:n.done?{status:`done`,state:n.state,output:n.output}:{status:`active`,state:n.state}}}catch{return}},Xw=(e,t)=>{try{let n=$e(AC(e,t));if(n._tag===`Failure`)return;let r=n.value;if(!_x(e,r))return{machine:e,snapshot:{status:`active`,state:r}};let i=$e(vx(e,r,gx));return i._tag===`Success`?{machine:e,snapshot:{status:`done`,state:r,output:i.value}}:void 0}catch{return}},Zw={spawn:()=>Er(Error(`Child operations are unavailable in a planned snapshot`)),sendTo:()=>z(new u_),stop:()=>j},Qw=(e,t)=>{if(e.snapshot.status!==`active`)return Mt();try{let n=e.machine,r=by(n,e.snapshot.state);for(let e of dy(n,r)){let i=Ay(n,e);for(let a of mb(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({...Xv(r)??Mb(n,r),children:Zw,state:r.values.get(e),containingState:uy(n,r,e),ancestors:ly(n,r,e),event:gx}):a.input);let s=Yw(i,i.input===void 0?[]:[o]);return s===void 0?void 0:Et(s)}}return Mt()}catch{return}},$w=class extends r(`ChildNotActiveError`){},eT=new WeakMap,tT=new WeakMap,nT=e=>typeof e==`object`&&!!e&&tT.has(e),rT=e=>{if(typeof WeakRef>`u`||typeof FinalizationRegistry>`u`)return Kn(e);let t=Me(),n=new FinalizationRegistry(({entry:e,key:n})=>{let r=Br(t,n);Fe(r)&&r.value===e&&De(t,n)});return r=>{let i=Br(t,r);if(Fe(i)){let e=i.value.ref.deref();if(e!==void 0)return e}let a=e(r),o={ref:new WeakRef(a)};return $t(t,r,o),n.register(a,{key:r,entry:o}),a}},iT=(e,t)=>d(fe(t,e=>e.stop).pipe(ce(t=>F(()=>e.setSelf(me(t)))),H(()=>Ai))),aT=(e,t)=>iT(e,e.result(t).pipe(H(e=>e.start))),oT=(e,t,n)=>iT(e,Gw(t,n)),sT=(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[_r](t):t(e),cT=(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}},lT=e=>{let t;return()=>(t===void 0&&(t={value:e()}),t.value)},uT=e=>e.snapshot,dT=xi(e=>e.registry).pipe(di),fT=e=>N(()=>{let t=e.pending.shift();return t===void 0?(e.draining=!1,j):V(t,fT(e))}),pT=(e,t)=>{let n=e.get(t);return n===void 0&&(n={pending:[],draining:!1},e.set(t,n)),n},mT=(e,t,n)=>Ye(n=>{let r=jt(n(e),()=>void 0),i=t.get(n.registry);return i===void 0||!i.draining?r:tt(Mi(n.self(),Tt),()=>ve(!0))},(r,i)=>{let a=r.get(e),o=r.get(dT),s=pT(t,o);ut(a)||s.draining?(r.setSelf(ve(!0)),s.pending.push(sr(o,e).pipe(H(e=>n(e,i)),er,R(e=>{let t=et(e);r.setSelf(s.pending.length===0?t:Tt(t))}))),s.draining||(s.draining=!0,Ct(fT(s)))):Pe(a)?r.setSelf(jt(a,()=>void 0)):yi(n(a.value,i),{onExit:e=>r.setSelf(et(e))})}).pipe(C),hT=e=>xi(t=>{let n=t(e);return ut(n)?ve(n.waiting):Pe(n)?We(n.cause,{previous:t.self(),waiting:n.waiting}):n.value.status===`error`?We(n.value.cause,{previous:t.self(),waiting:n.waiting}):me(n.value.state,{waiting:n.waiting})}).pipe(gi(Wt),ne(cT(t=>[sT(e,t)],e=>jt(e,e=>e.state)))),gT=e=>xi(t=>{let n=t(e);if(ut(n))return ve(n.waiting);if(Pe(n))return We(n.cause,{previous:t.self(),waiting:n.waiting});if(ye(n.value)){let e=t.self();return Fe(e)&&Pe(e.value)?e.value:me(Mt(),{waiting:n.waiting})}return n.value.value.status===`error`?We(n.value.value.cause,{previous:t.self(),waiting:n.waiting}):me(Et(n.value.value.state),{waiting:n.waiting})}).pipe(gi(Wt),ne(cT(t=>[sT(e,t)],e=>jt(e,Mi(e=>e.state))))),_T=(e,t)=>xi(n=>{let r=n(e);if(ut(r))return ve(r.waiting);if(Pe(r))return We(r.cause,{previous:n.self(),waiting:r.waiting});if(ye(r.value))return me(Mt());let i=r.value.value,a=te(i.child(t)),o=yi(pe.pipe(V(i.childChanges(t).pipe(ee(e=>F(()=>n.setSelf(me(e))))))));return n.addFinalizer(o),me(a)}).pipe(C),vT=(e,t)=>hS(e)?e[mS](()=>t(te(e.snapshot))):yi(e.changes.pipe(ee(e=>F(()=>t(e))))),yT=(e,t,n)=>{let r=xi(t=>{let n=t(e);if(ut(n))return ve(n.waiting);if(Pe(n))return We(n.cause,{previous:t.self(),waiting:n.waiting});if(ye(n.value))return me(Mt());let r=n.value.value;return t.addFinalizer(vT(r,e=>t.setSelf(me(Et(e))))),me(Et(te(r.snapshot)))}).pipe(ne(cT(()=>[],()=>{let e=n();return e===void 0?ve(!0):me(Mi(e,uT),{waiting:!0})}))),i=new WeakMap,a=e=>Fe(e)?M(e.value):z(new $w({id:t.id})),o=mT(e,i,(e,t)=>H(a(e),e=>e.send(t))),s=mT(e,i,(e,t)=>H(a(e),e=>e.stop)),c=bT(e,n);return{ref:e,snapshot:r,result:gT(r),send:o,stop:s,child:c}},bT=(e,t)=>{let n=new WeakMap;return r=>{let i=n.get(r.machine);if(i===void 0){let a=r.machine,o=Kn(n=>{let r=Hw(n,a);return yT(_T(e,r),r,lT(()=>{let e=t();return e===void 0||ye(e)?e:Qw(e.value,r)}))});i=e=>o(e),n.set(a,i)}return i(r.id)}},xT=(e,t,n)=>{let r=C(e),i=xi(e=>{let t=e(r);if(ut(t))return ve(t.waiting);if(Pe(t))return We(t.cause,{previous:e.self(),waiting:t.waiting});let n=t.value;e.addFinalizer(vT(n,t=>e.setSelf(me(t,{waiting:t.status===`active`}))));let i=te(n.snapshot);return me(i,{waiting:i.status===`active`})}).pipe(ne(cT(()=>[],()=>{let e=n();return e===void 0?ve(!0):me(uT(e),{waiting:!0})}))),a=new WeakMap,o=mT(r,a,(e,t)=>e.send(t)),s=mT(r,a,(e,t)=>e.stop),c=bT(mn(r,Et),()=>{let e=n();return e===void 0?void 0:Et(e)}),l={ref:r,snapshot:i,result:hT(i),send:o,stop:s,child:c};return tT.set(l,t),l},ST=(e,t)=>iv(e,t).pipe(Mi(e=>e.value)),CT=(e,t)=>iv(e,t),wT=(e,t)=>mn(e,t).pipe(gi(Wt),ne(cT(t=>[sT(e,t)],e=>jt(e,t)))),TT=new WeakMap,ET=(e,t,n,r)=>{let i=TT.get(e);i===void 0&&(i=new Map,TT.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},DT=(e,t)=>ET(e,`select`,t,()=>wT(e.result,e=>ST(e,t))),OT=(e,t)=>ET(e,`selectSnapshot`,t,()=>wT(e.result,e=>CT(e,t))),kT=(e,t)=>ET(e,`selectChild`,t,()=>wT(e.result,nr(e=>ST(e,t)))),AT=(e,t)=>ET(e,`selectSnapshotChild`,t,()=>wT(e.result,nr(e=>CT(e,t)))),jT=(e,t)=>ET(e,`matches`,t,()=>wT(e.result,e=>Fe(iv(e,t)))),MT=(e,t)=>ET(e,`matchesChild`,t,()=>wT(e.result,cr(e=>Fe(iv(e,t))))),NT=(e,t,n)=>{let r=e.atom(()=>Ww(t,...n)),i=xT(e.atom(e=>aT(e,r)),t,lT(()=>Yw(t,n)));return eT.set(i,r),i},PT=(e,t,n)=>xT(e.atom(e=>oT(e,t,n)),t,lT(()=>Xw(t,n))),FT=(e,t,n)=>{let r={owner:e,source:t},i=v(t,e=>e(r.source),{initialValueTarget:t}).pipe(gi((e,t)=>r.source.equals(e,t)),ne(e=>sT(r.source,e)));return n!==void 0&&(i=i.pipe(bt(n))),i},IT=(e,t)=>{let n=rT(t=>({bridge:e(t)})),r={};for(let e of Object.keys(t.atoms)){let i=t.atoms[e];r[e]=rT(r=>{let a=n(r);return FT(a,i(a.bridge),t.label?.(r,e))})}return r},LT=e=>{let t=((t,...n)=>NT(e,t,n));return{make:t,factory:(e=>(...n)=>t(e,...n)),resume:((t,n)=>PT(e,t,n)),family:((t,n)=>IT(n=>NT(e,t,[n]),n))}},RT=nT;ni(2,DT);var zT=ni(2,OT);ni(2,kT);var BT=ni(2,AT);ni(2,jT),ni(2,MT);var VT=LT,HT=`https://auth.mp281x.xyz`,UT=ui(kn(gr(`AUTH_URL`)),ye);zn(function*(){let e=wn(E,`GITHUB_ADMINS`);return(yield*UT)?yield*Bn(e,[`0`]):yield*e}),$r()(`@deslop/runtime/auth/lib/utils/CurrentUser`);var WT=class extends Or()(`@deslop/runtime/auth/lib/utils/RpcAuth`,{error:Y}){},GT=P({name:I,open:I,origin:Gf}),KT=Lr(GT);P({origin:Gf});var qT=P({incarnation:I,user:Hf});$r()(`@deslop/auth/services/tokens/schema/CurrentOwner`);var JT=P({...qT.fields,incarnation:B(I,en(M(`legacy`)))});P({client_name:k(E.check(ht(100))),redirect_uris:Uf.fields.redirects,token_endpoint_auth_method:k(ji(`none`))}),P({client_id:I.check(ht(2048)),redirect_uri:k(E),state:k(E)}),P({code_challenge:k(I),code_challenge_method:k(E),response_type:k(E),scope:k(E)});var YT=P({challenge:I,clientId:I,clientName:E,parent:k(I),redirectUri:I,state:k(I)}),XT=P({clientId:I,clientName:E});P({client_id:I.check(ht(2048)),scope:k(E)}),P({client_id:I,device_code:I,grant_type:ji(`urn:ietf:params:oauth:grant-type:device_code`)}),P({grant_type:E}),Ue([P({client_id:I,code:I,code_verifier:I,grant_type:ji(`authorization_code`),redirect_uri:k(E)}),P({client_id:k(E),grant_type:ji(`refresh_token`),refresh_token:I})]);var ZT=P({access_token:I,expires_in:Gn,refresh_token:I,scope:ji(`deslop`),token_type:ji(`Bearer`)});or({Granted:{tokens:ZT},Replayed:{message:E}});var QT=P({address:k(E),userAgent:k(E)}),$T=vn([`Code`,`GitHub`,`Passkey`]),eE=P({...qT.fields,client:E,createdAt:Gn,credential:or({App:{clientId:I,expiresAt:Gn,generation:ln,hash:E,replaced:Lr(E)},Browser:{expiresAt:Gn,hash:E,via:$T}}),device:E,lastActive:Gn,origin:QT,parent:k(I)});wt(E,eE);var tE=P({address:k(E),client:E,createdAt:Gn,device:E,expiresAt:Gn,family:I,kind:vn([`App`,`Browser`]),lastActive:Gn,parent:k(I)}),nE=P({family:I});P({client_id:I,token:I});var rE=vn([`ble`,`cable`,`hybrid`,`internal`,`nfc`,`smart-card`,`usb`]),iE=ji(`public-key`),aE=vn([`required`,`preferred`,`discouraged`]),oE=P({id:E,transports:k(At(Lr(rE))),type:iE}),sE=P({attestation:k(vn([`direct`,`enterprise`,`indirect`,`none`])),authenticatorSelection:k(P({authenticatorAttachment:k(vn([`cross-platform`,`platform`])),requireResidentKey:k(xr),residentKey:k(vn([`discouraged`,`preferred`,`required`])),userVerification:k(aE)})),challenge:E,excludeCredentials:k(At(Lr(oE))),pubKeyCredParams:At(Lr(P({alg:Gn,type:iE}))),rp:P({id:k(E),name:E}),timeout:k(Gn),user:P({displayName:E,id:E,name:E})}),cE=P({allowCredentials:k(At(Lr(oE))),challenge:E,rpId:k(E),timeout:k(Gn),userVerification:k(aE)}),lE=k(vn([`cross-platform`,`platform`])),uE=P({authenticatorAttachment:lE,clientExtensionResults:P({}),id:E,rawId:E,response:P({attestationObject:E,clientDataJSON:E,transports:k(Lr(E))}),type:iE}),dE=P({authenticatorAttachment:lE,clientExtensionResults:P({}),id:E,rawId:E,response:P({authenticatorData:E,clientDataJSON:E,signature:E,userHandle:k(E)}),type:iE});P({challenge:E});var fE=P({...JT.fields,addedFrom:E,counter:ln,createdAt:Gn,id:I,lastUsed:Gn,publicKey:I,synced:xr,transports:Lr(rE)});Lr(fE);var pE=P({addedFrom:E,createdAt:Gn,id:I,lastUsed:Gn,synced:xr}),mE=P({id:I}),hE=P({response:uE}),gE=P({next:k(I.check(ht(2048))),response:dE}),_E=vn([`Admin`,`Member`,`Waiting`]),vE=P({...Hf.fields,fullName:k(E),role:_E}),yE=P({...vE.fields,via:$T}),bE=P({...vE.fields,since:Gn}),xE=vn([`Waiting`,`Allowed`]),SE=P({fullName:E,id:I,incarnation:JT.fields.incarnation,name:I,since:Gn,status:xE});Lr(SE),P({id:ln,login:I,name:k(S(E))});var CE=P({allow:xr,id:I}),wE=P({id:I}),TE=vn([`App`,`Browser`]),EE=P({address:k(E),clientName:E,createdAt:Gn,device:E,expiresAt:Gn,id:I,kind:TE}),DE=or({Decided:{},Expired:{},Waiting:{request:EE}}),OE=or({Browser:{next:k(E)},Client:{request:YT},Device:{request:XT}});or({Denied:{},Granted:{tokens:ZT},Redirect:{url:I},Session:{next:k(E),seconds:ln,token:I}}),P({delivery:OE,origin:QT}),P({next:k(I.check(ht(2048)))});var kE=P({request:I.check(ht(20))}),AE=P({code:I.check(ht(20))}),jE=P({...kE.fields,accept:xr}),ME=class extends Or()(`@deslop/auth/rpcs/RpcOwner`,{error:Y}){},NE=class extends Jr(Tn(`auth.lookup`,{error:Y,payload:AE,stream:!0,success:bi(EE)}),Tn(`auth.answer`,{error:Y,payload:jE}),Tn(`auth.people`,{error:Y,stream:!0,success:Lr(bE)}),Tn(`auth.admit`,{error:Y,payload:CE,success:bE}),Tn(`auth.remove`,{error:Y,payload:wE,success:bE}),Tn(`auth.apps`,{error:Y,stream:!0,success:Lr(tE)}),Tn(`auth.catalog`,{error:Y,stream:!0,success:KT}),Tn(`auth.disconnect`,{error:Y,payload:nE}),Tn(`auth.passkeys`,{error:Y,stream:!0,success:Lr(pE)}),Tn(`auth.passkeyOptions`,{error:Y,success:sE}),Tn(`auth.addPasskey`,{error:Y,payload:hE}),Tn(`auth.removePasskey`,{error:Y,payload:mE})).middleware(WT).middleware(ME).merge(Jr(Tn(`auth.account`,{error:Y,stream:!0,success:yE}),Tn(`auth.wait`,{error:Y,payload:kE,stream:!0,success:DE}))){};function PE(e){return si(kr(/[^a-z]/giu,``)(e))}function FE(e){return c(Ge(e),jn)}Cn(function*(e,t,n){return ye(FE(n.response_type))?yield*Y.make({message:`Send response_type=code`}):n.response_type===`code`?n.code_challenge===void 0||n.code_challenge_method!==`S256`?yield*Y.make({message:`Send a PKCE code_challenge with code_challenge_method=S256`}):Yr(bn(xn(n.scope??``,` `),jn),e=>e===`deslop`||e===`offline_access`)?YT.make({challenge:n.code_challenge,clientId:e.client_id,clientName:t.clientName,redirectUri:t.redirectUri,...p(FE(e.state),{onNone:()=>({}),onSome:e=>({state:e})})}):yield*Y.make({error:`invalid_scope`,message:`Only the deslop scope is supported`}):yield*Y.make({error:`unsupported_response_type`,message:`Only response_type=code is supported`})});function IE(e,t){let n=`mp281x.xyz`;return Xe(Dr(e),{onFailure:()=>!1,onSuccess:e=>(e.origin===new URL(t).origin||e.protocol===`https:`&&(e.hostname===n||ct(`.${n}`)(e.hostname)))&&a(e.username)&&a(e.password)})}var LE=gt(we),RE=P({code:k(E),error:k(E),next:k(E),request:k(E),"sign-out":k(E)}),$=class extends yn()(`@deslop/auth/lib/utils/RpcClient`,{group:NE,protocol:op(`@deslop/auth`)}){},zE=di($.runtime.atom(B($,R(e=>e(`auth.account`,void 0)),ir,ip,vt(Et),Fr(`AuthError`,()=>wi(Mt()))))),BE={accept:xr,request:EE},VE=VT($.runtime).make(qw({branches:{looked:{found:{target:`Code.Found`},missing:{target:`Code.Missing`}}},events:Jw({Answered:BE,Typed:{typed:E}}),root:Kw({states:{Code:{fields:{code:E},states:{Failed:{fields:{message:E}},Found:{fields:{request:EE}},Looking:{},Missing:{}}},Typing:{fields:{answered:k(P(BE)),typed:E}}}}),streams:{lookup:e=>ip(ir(R($,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=>p(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=>wr(e.state.typed)>=8,target:`Code`}}}})),HE=Kn(e=>Di(t=>{t.set(VE.send,{_tag:`Typed`,typed:PE(e)})})),UE=di($.runtime.atom(B($,R(e=>e(`auth.people`,void 0)),ir,ip))),WE=di($.runtime.atom(B($,R(e=>e(`auth.apps`,void 0)),ir,ip)));function GE(e){return t=>Se(t,t=>F(()=>Ag.add({description:t.message,title:e,type:`error`})))}var KE=Kn(e=>$.runtime.fn(e=>H($,t=>hr(e,e=>t(`auth.disconnect`,{family:e}),{concurrency:`unbounded`,discard:!0})))),qE=Kn(e=>$.runtime.fn(t=>H($,n=>n(`auth.admit`,{allow:t,id:e})))),JE=Kn(e=>$.runtime.fn(()=>H($,t=>t(`auth.remove`,{id:e})))),YE=Kn(e=>$.runtime.atom(B($,R(t=>t(`auth.wait`,{request:e})),ir,ip,ur(t=>B(Mr(t),tr(`Decided`,()=>F(()=>location.assign(`/auth/continue?${new URLSearchParams({request:e})}`))),qr(()=>j))))));function XE(e){return`${Xr(0,4)(e)}-${Xr(4)(e)}`}function ZE(e){return`${location.origin}/?code=${e}`}var QE=di($.runtime.atom(B($,R(e=>e(`auth.catalog`,void 0)),ir,ip))),$E=Di(B(u(`1 minute`),b(()=>he))),eD=Di(B(u(`1 second`),b(()=>he)));function tD(e,t){let n=En(0,Math.ceil((e-t)/1e3));return`${Math.floor(n/60)}:${Qn(2,`0`)(`${n%60}`)}`}var nD=Vn(e=>B(mt({catch:e=>Y.make({cause:e,message:`Cannot copy the code; type it in instead`}),try:()=>navigator.clipboard.writeText(e)}),V(ar(`1200 millis`))));function rD(e,t){return Math.floor(An(ci(Rn(e),Rn(t))))}function iD(e){return e<1?`now`:e<60?`${e}m`:e<1440?`${Math.floor(e/60)}h`:`${Math.floor(e/1440)}d`}function aD(e,t){return`${e} · ${t}`}function oD(e){return Si(e,0,(e,t)=>En(e,t.lastActive))}function sD(e){return B(Rn(e),Dn({day:`numeric`,month:`short`}))}function cD(e){return`https://avatars.githubusercontent.com/u/${fn(`github:`,``)(e)}?s=96`}var lD=$.runtime.fn((e,t)=>B($,H(t=>t(`auth.answer`,{accept:e.accept,request:e.request.id})),V(F(()=>t.set(VE.send,{_tag:`Answered`,...e})))));function uD(e){return L(e.cause,`name`)&&e.cause.name===`NotAllowedError`}var dD=Cn(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(P({error_description:E}))(e)).error_description})}),fD=LE.fn(e=>B(zn(function*(){let t=yield*Yt,r=yield*t.get(`/auth/passkey`);if(r.status!==200)return yield*dD(r);let a=yield*n(cE)(r),o=yield*i(mt({catch:e=>Y.make({cause:e,message:`No passkey was used`}),try:()=>o_({optionsJSON:a})}),uD,()=>Ir),s=yield*B(Fn(`/auth/passkey`),ii(gE)({...p(Ge(e),{onNone:()=>({}),onSome:e=>({next:e})}),response:o}),H(e=>t.execute(e)),H(Cn(function*(e){return e.status===200?yield*n(P({next:k(E)}))(e):yield*dD(e)})));yield*F(()=>p(Ge(s.next),{onNone:()=>location.reload(),onSome:e=>location.assign(e)}))}),mi(e=>ze(Y)(e)?e:Y.make({cause:e,message:`Cannot sign in with a passkey`})))),pD=di($.runtime.atom(B($,R(e=>e(`auth.passkeys`,void 0)),ir,ip))),mD=di($.runtime.fn(Cn(function*(){let e=yield*$,t=yield*e(`auth.passkeyOptions`,void 0);yield*e(`auth.addPasskey`,{response:yield*B(mt({catch:e=>Y.make({cause:e,message:`No passkey was added`}),try:()=>t_({optionsJSON:t})}),i(uD,()=>Ir),H(le(uE)))}),Ag.add({title:`Passkey added`})},GE(`Cannot add a passkey`)))),hD=`adding-passkey`,gD=Vn(()=>Fi({catch:e=>Y.make({cause:e,message:`Cannot start GitHub sign-in`}),try:()=>{sessionStorage.setItem(hD,`true`),location.assign(`/auth/github`)}})),_D=di($.runtime.fn(e=>B(H($,t=>t(`auth.removePasskey`,{id:e})),GE(`Cannot remove the passkey`)))),vD=Vn(()=>Fi({catch:e=>Y.make({cause:e,message:`Cannot start GitHub sign-in`}),try:()=>location.assign(`/auth/github${location.search}`)})),yD=Vn(e=>Fi({catch:e=>Y.make({cause:e,message:`Cannot start the sign-in`}),try:()=>location.assign(p(Ge(e),{onNone:()=>`/auth/code`,onSome:e=>`/auth/code?${new URLSearchParams({next:e})}`}))}));function bD(e){return B(Yt.use(e=>Ut(e).post(`/auth/sign-out`)),V(F(()=>location.replace(B(Ge(e),c(e=>IE(e,HT)),tt(()=>location.pathname))))),mi(e=>Y.make({cause:e,message:`Cannot sign out: ${e.message}`})))}var xD=LE.fn(bD),SD=LE.fn(e=>GE(`Cannot sign out`)(bD(e)));export{gg as $,ld as $n,Kp as $t,XE as A,sf as An,ua as Ar,ym as At,Tg as B,bd as Bn,dm as Bt,oD as C,If as Cn,ya as Cr,Hm as Ct,JE as D,_f as Dn,pa as Dr,zm as Dt,UE as E,Sf as En,na as Er,Lm as Et,PE as F,Zd as Fn,Gi as Fr,lm as Ft,pg as G,xd as Gn,tm as Gt,bg as H,id as Hn,am as Ht,RT as I,Ld as In,Hi as Ir,fm as It,ug as J,rd as Jn,Xp as Jt,fg as K,wd as Kn,em as Kt,zT as L,Pd as Ln,um as Lt,vD as M,nf as Mn,ea as Mr,gm as Mt,aD as N,tf as Nn,qi as Nr,xm as Nt,_D as O,vf as On,Yi as Or,vm as Ot,xD as P,$d as Pn,Ki as Pr,hm as Pt,lg as Q,yd as Qn,Wp as Qt,BT as R,jd as Rn,cm as Rt,rD as S,Ff as Sn,Sa as Sr,Vm as St,pD as T,Ef as Tn,_a as Tr,Wm as Tt,_g as U,Td as Un,om as Ut,Sg as V,_d as Vn,mm as Vt,dg as W,nd as Wn,im as Wt,mg as X,od as Xn,Qp as Xt,hg as Y,gd as Yn,Zp as Yt,ag as Z,sd as Zn,Jp as Zt,KE as _,zf as _n,cs as _r,oh as _t,qE as a,Rp as an,Sl as ar,ig as at,SD as b,Lf as bn,Oa as br,$m as bt,WE as c,Dp as cn,Zc as cr,bh as ct,VE as d,mp as dn,Oc as dr,Eh as dt,Gp as en,cd as er,vg as et,yD as f,hp as fn,ic as fr,vh as ft,sD as g,np as gn,Zs as gr,fh as gt,nD as h,rp as hn,Qs as hr,dh as ht,mD as i,Vp as in,Ju as ir,rg as it,eD as j,rf as jn,ra as jr,Cm as jt,YE as k,gf as kn,ca as kr,_m as kt,cD as l,Op as ln,Wc as lr,yh as lt,lD as m,tp as mn,Xs as mr,ph as mt,RE as n,Up as nn,dd as nr,sg as nt,iD as o,Ip as on,pl as or,Jh as ot,gD as p,sp as pn,ec as pr,_h as pt,yg as q,Sd as qn,$p as qt,zE as r,Hp as rn,vd as rr,og as rt,ZE as s,zp as sn,sl as sr,Wh as st,hD as t,qp as tn,ud as tr,cg as tt,QE as u,Cp as un,zc as ur,Th as ut,tD as v,Mf as vn,ja as vr,rh as vt,fD as w,jf as wn,ba as wr,Um as wt,$E as x,Nf as xn,va as xr,Rm as xt,HE as y,Rf as yn,Aa as yr,eh as yt,Ug as z,Od as zn,pm as zt};