PageSourceSearch

https://www.chatinium.ai/_next/static/chunks/463-61675dabf9ebadf9.js?dpl=dpl_AmQYKNyh2Sn9xa8CvbfrCRwPSUUC

js chatinium.ai collected 2026-10-05 14:27:02 UTC 121,332 bytes, 10 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[463],{414:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useRouter",{enumerable:!0,get:function(){return i}});let n=r(1355),s=r(3909);function i(){return(0,n.useContext)(s.RouterContext)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},704:(e,t,r)=>{"use strict";r.d(t,{DT:()=>i,mj:()=>p}),r(4786);var n=r(4924),s=r(1589);function i(e,t){let r=(0,n.t)(t);if(!r.includes(e.type)){let t=1===r.length?`type "${r[0]}"`:`one of types "${r.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}let o=new WeakMap;function a(e,t,r){let n=o.get(e);return n?t in n||(n[t]=r()):(n={[t]:r()},o.set(e,n)),n[t]}let l={},c=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class u{constructor(e,t){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=t._parent,this.key=t._key,this.machine=t._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(n.S),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?(0,n.m)(this.config.states,(e,t)=>new u(e,{_parent:this,_key:t,_machine:this.machine})):l,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=!0===this.config.history?"shallow":this.config.history||!1,this.entry=(0,n.t)(this.config.entry).slice(),this.exit=(0,n.t)(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=(0,n.t)(e.tags).slice()}_initialize(){this.transitions=(0,n.f)(this),this.config.always&&(this.always=(0,n.a)(this.config.always).map(e=>(0,n.b)(this,n.N,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.t
1ype,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(c),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(c),eventType:null})}:void 0,history:this.history,states:(0,n.m)(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(c)})),entry:this.entry.map(c),exit:this.exit.map(c),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return a(this,"invoke",()=>(0,n.t)(this.config.invoke).map((e,t)=>{let{src:r,systemId:s}=e,i=e.id??(0,n.c)(this.id,t),o="string"==typeof r?r:`xstate.invoke.${(0,n.c)(this.id,t)}`;return{...e,src:o,id:i,systemId:s,toJSON(){let{onDone:t,onError:r,...n}=e;return{...n,type:"xstate.invoke",src:o,id:i}}}}))}get on(){return a(this,"on",()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,r])=>(e[t]=e[t]||[],e[t].push(r),e),{}))}get after(){return a(this,"delayedTransitions",()=>(0,n.g)(this))}get initial(){return a(this,"initial",()=>(0,n.d)(this,this.config.initial))}next(e,t){let r,s=t.type,i=[];for(let o of a(this,`candidates-${s}`,()=>(0,n.h)(this,s))){let{guard:a}=o,l=e.context,c=!1;try{c=!a||(0,n.e)(a,l,t,e)}catch(t){let e="string"==typeof a?a:"object"==typeof a?a.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${s}' in state node '${this.id}':
2${t.message}`)}if(c){i.push(...o.actions),r=o;break}}return r?[r]:void 0}get events(){return a(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let r of Object.keys(e)){let n=e[r];if(n.states)for(let e of n.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){return Array.from(new Set([...this.transitions.keys()].filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter)))))}}class d{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new u(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:r,actors:n,delays:s}=this.implementations;return new d(this.config,{actions:{...t,...e.actions},guards:{...r,...e.guards},actors:{...n,...e.actors},delays:{...s,...e.delays}})}resolveState(e){let t=(0,n.r)(this.root,e.value),r=(0,n.i)((0,n.j)(this.root,t));return(0,n.k)({_nodes:[...r],context:e.context||{},children:{},status:(0,n.l)(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,r){return(0,n.n)(e,t,r,[]).snapshot}microstep(e,t,r){return(0,n.n)(e,t,r,[]).microstates}getTransitionData(e,t){return(0,n.o)(this.root,e.value,e,t)||[]}getPreInitialState(e,t,r){let{context:i}=this.config,o=(0,n.k)({context:"function"!=typeof i&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof i?(0,n.p)(o,t,e,[(0,s.a)(({spawn:e,event:t,self:r})=>i({spawn:e,input:t.input,self:r}))],r,void 0):o}getInitialSnapshot(e,t){let r=(0,n.q)(t),s=[],i=this.getPreInitialState(e,r,s),o=(0,n.s)([{target:[...(0,n.u)(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,e,r,!0,s),{snapshot:a}=(0,n.n)(o,r,e,s);return a}start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=(0,n.v)(e),r=t.slice(1),s=(0,n.w)(t[0])?t[0].slice(1):t[0],i=this.idMap.get(s);if(!i)throw Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);return(0,n.x)(i,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return(0,n.y)(e,t)}restoreSnapshot(e,t){let r={},s=e.children;
2Object.keys(s).forEach(e=>{let i=s[e],o=i.snapshot,a=i.src,l="string"==typeof a?(0,n.z)(this,a):a;if(!l)return;let c=(0,n.A)(l,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:o,src:a,systemId:i.systemId});r[e]=c});let i=(0,n.k)({...e,children:r,_nodes:Array.from((0,n.i)((0,n.j)(this.root,e.value)))},this),o=new Set;return!function e(t,r){if(!o.has(t))for(let s in o.add(t),t){let i=t[s];if(i&&"object"==typeof i){if("xstate$$type"in i&&i.xstate$$type===n.$){t[s]=r[i.id];continue}e(i,r)}}}(i.context,r),i}}function p({schemas:e,actors:t,actions:r,guards:n,delays:s}){return{createMachine:i=>new d({...i,schemas:e},{actors:t,actions:r,guards:n,delays:s})}}},943:(e,t,r)=>{"use strict";r.d(t,{N:()=>s});var n=r(1355),s=globalThis?.document?n.useLayoutEffect:()=>{}},1412:(e,t,r)=>{"use strict";r.d(t,{oq:()=>n.oq});var n=r(9909);r(2913)},1589:(e,t,r)=>{"use strict";r.d(t,{a:()=>i,b:()=>g,c:()=>p,l:()=>y,s:()=>f});var n=r(4924);function s(e,t,r,s,{assignment:i}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},a={context:t.context,event:r.event,spawn:function(e,{machine:t,context:r},s,i){let o=(o,a)=>{if("string"!=typeof o)return(0,n.A)(o,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:o,systemId:a?.systemId});{let l=(0,n.z)(t,o);if(!l)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let c=(0,n.A)(l,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:r,event:s,self:e.self}):a?.input,src:o,systemId:a?.systemId});return i[c.id]=c,c}};return(t,r)=>{let s=o(t,r);return i[s.id]=s,e.defer(()=>{s._processingStatus!==n.T.Stopped&&s.start()}),s}}(e,t,r.event,o),self:e.self,system:e.system},l={};if("function"==typeof i)l=i(a,s);else for(let e of Object.keys(i)){let t=i[e];l[e]="function"==typeof t?t(a,s):t}let c=Object.assign({},t.context,l);return[(0,n.U)(t,{context:c,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function i(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=s,t}function o(e,t,r,n,{event:s}){return[t,{event:"function"==typeof s?s(r,n):s},void 0]}function a(e,{event:t}){e.defer(()=>e.emit(t))}let l=function(e){return e.Parent="#_parent",e.Internal="#_internal",e}({});function c(e,t,r,n,{to:s,event:i,id:o,delay:a},c){let u,d,p=t.machine.implementations.delays;if("string"==typeof i)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);let f="function"==typeof i?i(r,n):i;if("string"==typeof a){let e=p&&p[a];u="function"==typeof e?e(r,n):e}else u="function"==typeof a?a(r,n):a;let h="function"==typeof s?s(r,n):s;if("string"==typeof h){if(!(d=h===l.Parent?e.self._parent:h===l.Internal?e.self:h.startsWith("#_")?t.children[h.slice(2)]:c.deferredActorIds?.includes(h)?h:t.children[h]))throw Error(`Unable to send event to actor '${h}' from machine '${t.machine.id}'.`)}else d=h||e.self;return[t,{to:d,targetId:"string"==typeof h?h:void 0,event:f,id:o,delay:u},void 0]}function u(e,t,r){"string"==typeof r.to&&(r.to=t.children[r.to])}function d(e,t){e.defer(()=>{let{to:r,event:s,delay:i,id:o}=t;if("number"==typeof i){e.system.scheduler.schedule(e.self,r,s,i,o);return}e.system._relay(e.self,r,s.type===n.V?(0,n.W)(e.self.id,s.data):s)})}function p(e,t,r){function n(e,t){}return n.type="xstate.sendTo",n.to=e,n.event=t,n.id=r?.id,n.delay=r?.delay,n.resolve=c,n.retryResolve=u,n.execute=d,n}function f(e,t){return p(l.Parent,e,t)}function h(e,t,r,s,{collect:l}){let c=[],u=function(e){c.push(e)};return u.assign=(...e)=>{c.push(i(...e))},u.cancel=(...e)=>{c.push((0,n.M)(...e))},u.raise=(...e)=>{c.push((0,n.O)(...e))},u.sendTo=(...e)=>{c.push(p(...e))},u.sendParent=(...e)=>{c.push(f(...e))},u.spawnChild=(...e)=>{c.push((0,n.P)(...e))},u.stopChild=(...e)=>{c.push((0,n.R)(...e))},u.emit=(...e)=>{c.push(function(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=o,t.execute=a,t}(...e))},l({context:r.context,event:r.event,enqueue:u,check:e=>(0,n.e)(e,t.context,r.event,t),self:e.self,system:e.system},s),[t,void 0,c]}function g(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=h,t}function m(e,t,r,n,{value:s,label:i}){return[t,{value:"function"==typeof s?s(r,n):s,label:i},void 0]}function v({logger:e},{value:t,label:r}){r?e(r,t):e(t)}function y(e=({context:e,event:t})=>({context:e,event:t}),t){function r(e,t){}return r.type="xstate.log",r.value=e,r.label=t,r.resolve=m,r.execute=v,r}},1649:(e,t,r)=>{"use strict";r.d(t,{DX:()=>a,TL:()=>o});var n=r(1355),s=r(8124),i=r(1579);function o(e){let t=function(e){let t=n.forwardRef((e,t)=>
2{var r,i,o;let a,l,{children:c,...u}=e,d=n.isValidElement(c)?(l=(a=null===(i=Object.getOwnPropertyDescriptor((r=c).props,"ref"))||void 0===i?void 0:i.get)&&"isReactWarning"in a&&a.isReactWarning)?r.ref:(l=(a=null===(o=Object.getOwnPropertyDescriptor(r,"ref"))||void 0===o?void 0:o.get)&&"isReactWarning"in a&&a.isReactWarning)?r.props.ref:r.props.ref||r.ref:void 0,p=(0,s.s)(d,t);if(n.isValidElement(c)){let e=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=i(...t);return s(...t),n}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(u,c.props);return c.type!==n.Fragment&&(e.ref=p),n.cloneElement(c,e)}return n.Children.count(c)>1?n.Children.only(null):null});return t.displayName="".concat(e,".SlotClone"),t}(e),r=n.forwardRef((e,r)=>{let{children:s,...o}=e,a=n.Children.toArray(s),l=a.find(c);if(l){let e=l.props.children,s=a.map(t=>t!==l?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,i.jsx)(t,{...o,ref:r,children:n.isValidElement(e)?n.cloneElement(e,void 0,s):null})}return(0,i.jsx)(t,{...o,ref:r,children:s})});return r.displayName="".concat(e,".Slot"),r}var a=o("Slot"),l=Symbol("radix.slottable");function c(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===l}},1807:(e,t,r)=>{"use strict";var n=r(6519);r.o(n,"useParams")&&r.d(t,{useParams:function(){return n.useParams}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}}),r.o(n,"useSelectedLayoutSegments")&&r.d(t,{useSelectedLayoutSegments:function(){return n.useSelectedLayoutSegments}})},2826:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(1355),s=r(1579);function i(e,t=[]){let r=[],o=()=>{let t=r.map(e=>n.createContext(e));return function(r){let s=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:s}}),[r,s])}};return o.scopeName=e,[function(t,i){let o=n.createContext(i),a=r.length;r=[...r,i];let l=t=>{let{scope:r,children:i,...l}=t,c=r?.[e]?.[a]||o,u=n.useMemo(()=>l,Object.values(l));return(0,s.jsx)(c.Provider,{value:u,children:i})};return l.displayName=t+"Provider",[l,function(r,s){let l=s?.[e]?.[a]||o,c=n.useContext(l);if(c)return c;if(void 0!==i)return i;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let s=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}(o,...t)]}},3117:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return l},getImageProps:function(){return a}});let n=r(1491),s=r(1779),i=r(6679),o=n._(r(7689));function a(e){let{props:t}=(0,s.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let l=i.Image},4288:(e,t,r)=>{"use strict";r.d(t,{Wl:()=>tB,jq:()=>ex,X$:()=>ek,Ng:()=>tR,OQ:()=>tK,lV:()=>e5,nF:()=>eC,MR:()=>e6,N_:()=>rq,Vu:()=>tL,rX:()=>tW,k3:()=>tH,ew:()=>tq,kj:()=>tG,q3:()=>t$,ii:()=>tV,P6:()=>tM,aB:()=>tj,zD:()=>rw,VF:()=>tt,ND:()=>ru,DD:()=>rx,pQ:()=>rP,xm:()=>tb,qk:()=>rD,h7:()=>rG,pz:()=>rM,XT:()=>td,tX:()=>rn,AG:()=>rr,VK:()=>eE,S7:()=>eS,OV:()=>eb,Ye:()=>t9,Nn:()=>n,mn:()=>tX,Y6:()=>rs,BR:()=>tf,xt:()=>eP,hD:()=>tO});var n,s=r(1355),i=r.t(s,2),o=r(7418),a=r(8124),l=r(2826),c=r(943),u=i[" useId ".trim().toString()]||(()=>void 0),d=0;function p(e){let[t,r]=s.useState(u());return(0,c.N)(()=>{e||r(e=>e??String(d++))},[e]),e||(t?`radix-${t}`:"")}r(9610);var f=r(1579),h=Symbol("radix.slottable");function g(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===h}var m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>
2{let r=function(e){let t=function(e){let t=s.forwardRef((e,t)=>{let{children:r,...n}=e;if(s.isValidElement(r)){var i;let e,o,l=(i=r,(o=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(o=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),c=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{i(...e),s(...e)}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==s.Fragment&&(c.ref=t?(0,a.t)(t,l):l),s.cloneElement(r,c)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),r=s.forwardRef((e,r)=>{let{children:n,...i}=e,o=s.Children.toArray(n),a=o.find(g);if(a){let e=a.props.children,n=o.map(t=>t!==a?t:s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null);return(0,f.jsx)(t,{...i,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,n):null})}return(0,f.jsx)(t,{...i,ref:r,children:n})});return r.displayName=`${e}.Slot`,r}(`Primitive.${t}`),n=s.forwardRef((e,n)=>{let{asChild:s,...i}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,f.jsx)(s?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),v=s.forwardRef((e,t)=>(0,f.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{var r;t.target.closest("button, input, select, textarea")||(null===(r=e.onMouseDown)||void 0===r||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));v.displayName="Label";var[y,_]=(0,l.A)("Form"),S="Form",[E,b]=y(S),[w,x]=y(S),k=s.forwardRef((e,t)=>{let{__scopeForm:r,onClearServerErrors:n=()=>{},...i}=e,l=s.useRef(null),c=(0,a.s)(t,l),[u,d]=s.useState({}),p=s.useCallback(e=>u[e],[u]),h=s.useCallback((e,t)=>d(r=>{var n;return{...r,[e]:{...null!==(n=r[e])&&void 0!==n?n:{},...t}}}),[]),g=s.useCallback(e=>{d(t=>({...t,[e]:void 0})),k(t=>({...t,[e]:{}}))},[]),[v,y]=s.useState({}),_=s.useCallback(e=>{var t;return null!==(t=v[e])&&void 0!==t?t:[]},[v]),S=s.useCallback((e,t)=>{y(r=>{var n;return{...r,[e]:[...null!==(n=r[e])&&void 0!==n?n:[],t]}})},[]),b=s.useCallback((e,t)=>{y(r=>{var n;return{...r,[e]:(null!==(n=r[e])&&void 0!==n?n:[]).filter(e=>e.id!==t)}})},[]),[x,k]=s.useState({}),I=s.useCallback(e=>{var t;return null!==(t=x[e])&&void 0!==t?t:{}},[x]),A=s.useCallback((e,t)=>{k(r=>{var n;return{...r,[e]:{...null!==(n=r[e])&&void 0!==n?n:{},...t}}})},[]),[R,T]=s.useState({}),C=s.useCallback((e,t)=>{T(r=>{let n=new Set(r[e]).add(t);return{...r,[e]:n}})},[]),P=s.useCallback((e,t)=>{T(r=>{let n=new Set(r[e]);return n.delete(t),{...r,[e]:n}})},[]),N=s.useCallback(e=>{var t;return Array.from(null!==(t=R[e])&&void 0!==t?t:[]).join(" ")||void 0},[R]);return(0,f.jsx)(E,{scope:r,getFieldValidity:p,onFieldValidityChange:h,getFieldCustomMatcherEntries:_,onFieldCustomMatcherEntryAdd:S,onFieldCustomMatcherEntryRemove:b,getFieldCustomErrors:I,onFieldCustomErrorsChange:A,onFieldValiditionClear:g,children:(0,f.jsx)(w,{scope:r,onFieldMessageIdAdd:C,onFieldMessageIdRemove:P,getFieldDescription:N,children:(0,f.jsx)(m.form,{...i,ref:c,onInvalid:(0,o.m)(e.onInvalid,e=>{let t=q(e.currentTarget);t===e.target&&t.focus(),e.preventDefault()}),onSubmit:(0,o.m)(e.onSubmit,n,{checkForDefaultPrevented:!1}),onReset:(0,o.m)(e.onReset,n)})})})});k.displayName=S;var I="FormField",[A,R]=y(I),T=s.forwardRef((e,t)=>{let{__scopeForm:r,name:n,serverInvalid:s=!1,...i}=e,o=b(I,r).getFieldValidity(n),a=p();return(0,f.jsx)(A,{scope:r,id:a,name:n,serverInvalid:s,children:(0,f.jsx)(m.div,{"data-valid":Y(o,s),"data-invalid":z(o,s),...i,ref:t})})});T.displayName=I;var C="FormLabel",P=s.forwardRef((e,t)=>{let{__scopeForm:r,...n}=e,s=b(C,r),i=R(C,r),o=n.htmlFor||i.id,a=s.getFieldValidity(i.name);return(0,f.jsx)(v,{"data-valid":Y(a,i.serverInvalid),"data-invalid":z(a,i.serverInvalid),...n,ref:t,htmlFor:o})});P.displayName=C;var N="FormControl",F=s.forwardRef((e,t)=>{let{__scopeForm:r,...n}=e,i=b(N,r),l=R(N,r),c=x(N,r),u=s.useRef(null),d=(0,a.s)(t,u),p=n.name||l.name,h=n.id||l.id,g=i.getFieldCustomMatcherEntries(p),{onFieldValidityChange:v,onFieldCustomErrorsChange:y,onFieldValiditionClear:_}=i,S=s.useCallback(async e=>{if(X(e.validity)){v(p,H(e.validity));return}let t=e.form?new FormData(e.form):new FormData,r=[e.value,t],n=[],s=[];
2g.forEach(e=>{!function(e,t){var r;return"AsyncFunction"===e.match.constructor.name||(r=e.match,r(...t)instanceof Promise)}(e,r)?"Function"===e.match.constructor.name&&n.push(e):s.push(e)});let i=Object.fromEntries(n.map(e=>{let{id:t,match:n}=e;return[t,n(...r)]})),o=Object.values(i).some(Boolean);if(e.setCustomValidity(o?O:""),v(p,H(e.validity)),y(p,i),!o&&s.length>0){let t=s.map(e=>{let{id:t,match:n}=e;return n(...r).then(e=>[t,e])}),n=Object.fromEntries(await Promise.all(t)),i=Object.values(n).some(Boolean);e.setCustomValidity(i?O:""),v(p,H(e.validity)),y(p,n)}},[g,p,y,v]);s.useEffect(()=>{let e=u.current;if(e){let t=()=>S(e);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}},[S]);let E=s.useCallback(()=>{let e=u.current;e&&(e.setCustomValidity(""),_(p))},[p,_]);s.useEffect(()=>{var e;let t=null===(e=u.current)||void 0===e?void 0:e.form;if(t)return t.addEventListener("reset",E),()=>t.removeEventListener("reset",E)},[E]),s.useEffect(()=>{let e=u.current,t=null==e?void 0:e.closest("form");if(t&&l.serverInvalid){let r=q(t);r===e&&r.focus()}},[l.serverInvalid]);let w=i.getFieldValidity(p);return(0,f.jsx)(m.input,{"data-valid":Y(w,l.serverInvalid),"data-invalid":z(w,l.serverInvalid),"aria-invalid":!!l.serverInvalid||void 0,"aria-describedby":c.getFieldDescription(p),title:"",...n,ref:d,id:h,name:p,onInvalid:(0,o.m)(e.onInvalid,e=>{S(e.currentTarget)}),onChange:(0,o.m)(e.onChange,e=>{E()})})});F.displayName=N;var O="This value is not valid",U={badInput:O,patternMismatch:"This value does not match the required pattern",rangeOverflow:"This value is too large",rangeUnderflow:"This value is too small",stepMismatch:"This value does not match the required step",tooLong:"This value is too long",tooShort:"This value is too short",typeMismatch:"This value does not match the required type",valid:void 0,valueMissing:"This value is missing"},D="FormMessage",j=s.forwardRef((e,t)=>{let{match:r,name:n,...s}=e,i=R(D,e.__scopeForm),o=null!=n?n:i.name;return void 0===r?(0,f.jsx)($,{...s,ref:t,name:o,children:e.children||O}):"function"==typeof r?(0,f.jsx)(M,{match:r,...s,ref:t,name:o}):(0,f.jsx)(L,{match:r,...s,ref:t,name:o})});j.displayName=D;var L=s.forwardRef((e,t)=>{let{match:r,forceMatch:n=!1,name:s,children:i,...o}=e,a=b(D,o.__scopeForm).getFieldValidity(s);return n||(null==a?void 0:a[r])?(0,f.jsx)($,{ref:t,...o,name:s,children:null!=i?i:U[r]}):null}),M=s.forwardRef((e,t)=>{let{match:r,forceMatch:n=!1,name:i,id:o,children:l,...c}=e,u=b(D,c.__scopeForm),d=s.useRef(null),h=(0,a.s)(t,d),g=p(),m=null!=o?o:g,v=s.useMemo(()=>({id:m,match:r}),[m,r]),{onFieldCustomMatcherEntryAdd:y,onFieldCustomMatcherEntryRemove:_}=u;s.useEffect(()=>(y(i,v),()=>_(i,v.id)),[v,i,y,_]);let S=u.getFieldValidity(i),E=u.getFieldCustomErrors(i)[m];return n||S&&!X(S)&&E?(0,f.jsx)($,{id:m,ref:h,...c,name:i,children:null!=l?l:O}):null}),$=s.forwardRef((e,t)=>{let{__scopeForm:r,id:n,name:i,...o}=e,a=x(D,r),l=p(),c=null!=n?n:l,{onFieldMessageIdAdd:u,onFieldMessageIdRemove:d}=a;return s.useEffect(()=>(u(i,c),()=>d(i,c)),[i,c,u,d]),(0,f.jsx)(m.span,{id:c,...o,ref:t})}),V="FormValidityState",W=e=>{let{__scopeForm:t,name:r,children:n}=e,s=b(V,t),i=R(V,t),o=null!=r?r:i.name,a=s.getFieldValidity(o);return(0,f.jsx)(f.Fragment,{children:n(a)})};W.displayName=V;var G=s.forwardRef((e,t)=>{let{__scopeForm:r,...n}=e;return(0,f.jsx)(m.button,{type:"submit",...n,ref:t})});function H(e){let t={};for(let r in e)t[r]=e[r];return t}function B(e){return e instanceof HTMLElement}function K(e){return"validity"in e&&(!1===e.validity.valid||"true"===e.getAttribute("aria-invalid"))}function q(e){let[t]=Array.from(e.elements).filter(B).filter(K);return t}function X(e){let t=!1;for(let r in e)if("valid"!==r&&"customError"!==r&&e[r]){t=!0;break}return t}function Y(e,t){if((null==e?void 0:e.valid)===!0&&!t)return!0}function z(e,t){if((null==e?void 0:e.valid)===!1||t)return!0}G.displayName="FormSubmit";var J=r(4860),Q=r(2397),Z=r(8019),ee=r(704),et=r(1589),er=r(7144),en=r(1787),es=r(1649),ei=r(5606),eo=r(9602),ea=r(8851);r(2913);var el=[{provider:"google",strategy:"oauth_google",name:"Google",docsUrl:"https://clerk.c
2om/docs/authentication/social-connections/google"},{provider:"discord",strategy:"oauth_discord",name:"Discord",docsUrl:"https://clerk.com/docs/authentication/social-connections/discord"},{provider:"facebook",strategy:"oauth_facebook",name:"Facebook",docsUrl:"https://clerk.com/docs/authentication/social-connections/facebook"},{provider:"twitch",strategy:"oauth_twitch",name:"Twitch",docsUrl:"https://clerk.com/docs/authentication/social-connections/twitch"},{provider:"twitter",strategy:"oauth_twitter",name:"Twitter",docsUrl:"https://clerk.com/docs/authentication/social-connections/twitter"},{provider:"microsoft",strategy:"oauth_microsoft",name:"Microsoft",docsUrl:"https://clerk.com/docs/authentication/social-connections/microsoft"},{provider:"tiktok",strategy:"oauth_tiktok",name:"TikTok",docsUrl:"https://clerk.com/docs/authentication/social-connections/tiktok"},{provider:"linkedin",strategy:"oauth_linkedin",name:"LinkedIn",docsUrl:"https://clerk.com/docs/authentication/social-connections/linkedin"},{provider:"linkedin_oidc",strategy:"oauth_linkedin_oidc",name:"LinkedIn",docsUrl:"https://clerk.com/docs/authentication/social-connections/linkedin-oidc"},{provider:"github",strategy:"oauth_github",name:"GitHub",docsUrl:"https://clerk.com/docs/authentication/social-connections/github"},{provider:"gitlab",strategy:"oauth_gitlab",name:"GitLab",docsUrl:"https://clerk.com/docs/authentication/social-connections/gitlab"},{provider:"dropbox",strategy:"oauth_dropbox",name:"Dropbox",docsUrl:"https://clerk.com/docs/authentication/social-connections/dropbox"},{provider:"atlassian",strategy:"oauth_atlassian",name:"Atlassian",docsUrl:"https://clerk.com/docs/authentication/social-connections/atlassian"},{provider:"bitbucket",strategy:"oauth_bitbucket",name:"Bitbucket",docsUrl:"https://clerk.com/docs/authentication/social-connections/bitbucket"},{provider:"hubspot",strategy:"oauth_hubspot",name:"HubSpot",docsUrl:"https://clerk.com/docs/authentication/social-connections/hubspot"},{provider:"notion",strategy:"oauth_notion",name:"Notion",docsUrl:"https://clerk.com/docs/authentication/social-connections/notion"},{provider:"apple",strategy:"oauth_apple",name:"Apple",docsUrl:"https://clerk.com/docs/authentication/social-connections/apple"},{provider:"line",strategy:"oauth_line",name:"LINE",docsUrl:"https://clerk.com/docs/authentication/social-connections/line"},{provider:"instagram",strategy:"oauth_instagram",name:"Instagram",docsUrl:"https://clerk.com/docs/authentication/social-connections/instagram"},{provider:"coinbase",strategy:"oauth_coinbase",name:"Coinbase",docsUrl:"https://clerk.com/docs/authentication/social-connections/coinbase"},{provider:"spotify",strategy:"oauth_spotify",name:"Spotify",docsUrl:"https://clerk.com/docs/authentication/social-connections/spotify"},{provider:"xero",strategy:"oauth_xero",name:"Xero",docsUrl:"https://clerk.com/docs/authentication/social-connections/xero"},{provider:"box",strategy:"oauth_box",name:"Box",docsUrl:"https://clerk.com/docs/authentication/social-connections/box"},{provider:"slack",strategy:"oauth_slack",name:"Slack",docsUrl:"https://clerk.com/docs/authentication/social-connections/slack"},{provider:"linear",strategy:"oauth_linear",name:"Linear",docsUrl:"https://clerk.com/docs/authentication/social-connections/linear"},{provider:"x",strategy:"oauth_x",name:"X / Twitter",docsUrl:"https://clerk.com/docs/authentication/social-connections/x-twitter-v2"},{provider:"enstall",strategy:"oauth_enstall",name:"Enstall",docsUrl:"https://clerk.com/docs/authentication/social-connections/enstall"},{provider:"huggingface",strategy:"oauth_huggingface",name:"Hugging Face",docsUrl:"https://clerk.com/docs/authentication/social-connections/huggingface"}],ec=[{provider:"metamask",strategy:"web3_metamask_signature",name:"MetaMask"},{provider:"coinbase_wallet",strategy:"web3_coinbase_wallet_signature",name:"Coinbase Wallet"},{provider:"okx_wallet",strategy:"web3_okx_wallet_signature",name:"OKX Wallet"}],eu=r(4786),ed=r(9879);function ep(){return(0,ed.F7)()&&"function"==typeof window.PublicKeyCredential}async function ef(){try{return ep()&&await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}var eh=r(1412),eg=r(4924),em=r(9168),ev=r(9141),ey=e=>{throw TypeError(e)},e_=(e,t,r)=>t.has(e)||ey("Cannot "+r),eS=(e,t,r)=>(e_(e,t,"read from private field"),r?r.call(e):t.get(e)),eE=(e,t,r)=>t.has(e)?ey("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),eb=(e,t,r,n)=>(e_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ew=class extends 
2Error{constructor(e,t){super(t),this.code=e,this.clerkError=!0,this.clerkElementsError=!0,this.name="ClerkElementsError",this.rawMessage=t}toString(){return`[${this.name}]
3Code: ${this.code}
4Message: ${this.message}`}},ex=class e extends ew{static fromAPIError(t){return new e(t.code.toString(),t.longMessage||t.message)}constructor(e,t){super(e,t),this.name="ClerkElementsError"}},ek=class extends ew{constructor(e){super("elements_runtime_error",e),this.name="ClerkElementsRuntimeError"}},eI=class e extends ew{constructor(e,t){super(e,t),this.matchFn=()=>!0,this.name="ClerkElementsFieldError"}static fromAPIError(t){return new e(t.code,t.longMessage||t.message)}get validityState(){return this.code}get forceMatch(){return!0}},eA=(0,ee.mj)({actions:{setGlobalErrors:(0,et.a)({errors:(e,t)=>[...t.errors]}),setFieldFeedback:(0,et.a)({fields:({context:e},t)=>{if(!t.name)throw Error("Field name is required");let r=t.name;return e.fields.has(r)&&(e.fields.get(r).feedback=t.feedback),e.fields}})},types:{}}).createMachine({id:"Form",context:()=>({defaultValues:new Map,errors:[],fields:new Map,progressive:!1}),on:{"ERRORS.SET":{actions:(0,et.b)(({enqueue:e,event:t})=>{var r,n,s;let i=e=>"meta"in e;if((0,Q.ux)(t.error)){let o={},a=[];for(let e of(0,Q.$R)(t.error)?null==(r=t.error)?void 0:r.errors:[t.error]){let t=i(e)?(0,Z.sF)(null==(n=e.meta)?void 0:n.paramName):null;if(!t||(0,Q.si)(e)){a.push(ex.fromAPIError(e));continue}o[t]||(o[t]=[]),null==(s=o[t])||s.push(eI.fromAPIError(e))}for(let t in e({type:"setGlobalErrors",params:{errors:a}}),o)e({type:"setFieldFeedback",params:{name:t,feedback:{type:"error",message:o[t][0]}}})}})},"ERRORS.CLEAR":{actions:(0,et.a)({errors:()=>[]})},"FIELD.ADD":{actions:(0,et.a)({fields:({context:e,event:t})=>{if(!t.field.name)throw Error("Field name is required");return t.field.value=t.field.value||e.defaultValues.get(t.field.name)||void 0,e.fields.set(t.field.name,t.field),e.fields}})},"FIELD.UPDATE":{actions:(0,et.a)({fields:({context:e,event:t})=>{var r;if(!t.field.name)throw Error("Field name is required");let n=e.fields.get(t.field.name);return n&&(n.checked=t.field.checked,n.disabled=null!=(r=t.field.disabled)?r:n.disabled,n.value=t.field.value,e.fields.set(t.field.name,n)),e.fields}})},"FIELD.DISABLE":{actions:(0,et.a)({fields:({context:e,event:t})=>{if(!t.field.name)throw Error("Field name is required");let r=e.fields.get(t.field.name);return r&&(r.disabled=!0,e.fields.set(t.field.name,r)),e.fields}})},"FIELD.ENABLE":{actions:(0,et.a)({fields:({context:e,event:t})=>{if(!t.field.name)throw Error("Field name is required");let r=e.fields.get(t.field.name);return r&&(r.disabled=!1,e.fields.set(t.field.name,r)),e.fields}})},"FIELD.REMOVE":{actions:(0,et.a)({fields:({context:e,event:t})=>{if(!t.field.name)throw Error("Field name is required");return e.fields.delete(t.field.name),e.fields}})},"FIELD.FEEDBACK.SET":{actions:[{type:"setFieldFeedback",params:({event:e})=>e.field}]},"FIELD.FEEDBACK.CLEAR":{actions:(0,et.a)({fields:({context:e,event:t})=>{if(!t.field.name)throw Error("Field name is required");return e.fields.has(t.field.name)&&(e.fields.get(t.field.name).feedback=void 0),e.fields}})},"FIELD.FEEDBACK.CLEAR.ALL":{actions:(0,et.a)({fields:({context:e})=>(e.fields.forEach(e=>{e.feedback=void 0}),e.fields)})},MARK_AS_PROGRESSIVE:{actions:(0,et.a)(({event:e})=>{let t=new Set(e.missing);return{defaultValues:e.defaultValues,hidden:new Set([...e.required.filter(e=>!t.has(e)),...e.optional]),missing:t,optional:new Set(e.optional),progressive:!0,required:new Set(e.required)}})},UNMARK_AS_PROGRESSIVE:{actions:(0,et.a)({defaultValues:new Map,hidden:void 0,missing:void 0,optional:void 0,progressive:!1,required:void 0})},PREFILL_DEFAULT_VALUES:{actions:(0,et.a)(({event:e})=>({defaultValues:e.defaultValues}))}}});function eR(e,t){try{return e()}catch{return t}}var eT=(0,J.jv)(eA,{inspect:n}),eC=eT.Provider,eP=eT.useActorRef,eN=eT.useSelector,eF=e=>e.context.errors,eO=e=>t=>{var r;return e?null==(r=t.context.fields.get(e))?void 0:r.value:""},eU=e=>t=>!!eO(e)(t),eD=e=>t=>{var r;return e?null==(r=t.context.fields.get(e))?void 0:r.feedback:void 0};function ej({name:e}){return{feedback:eN(eD(e))}}var eL=s.createContext(null),eM=()=>s.useContext(eL),e$={success:"success",error:"error",idle:"idle",warning:"warning",info:"info"};function eV({name:e}){let{feedback:t}=ej({name:e}),r=eN(eU(e)),n=e$.idle;switch(r||(n=e$.idle),null==t?void 0:t.type){case"error":n=e$.error;break;case"warning":n=e$.warning;break;case"info":n=e$.info;break;case"success":n=e$.success}return{state:n}}function eW(){return{errors:eN(eF)}}var eG={max_length:["less than %length% characters","length"],min_length:["%length% or more characters","length"],require_numbers:"a number",require_lowercase:"a lowercase letter",require_uppercase:"an uppercase letter",require_special_char:"a special character"},eH=e=>{let t;return"ListFormat"in Intl?new Intl.ListFormat("en",{style:"long",type:"conjunction"}).format(e):e.join(", ")},eB=({config:e,failedValidations:t})=>{let r=[];if(!t||0===Object.keys(t).length)return{codes:r,message:""};let n=(null==t?void 0:t.min_length)||!1,s=eH(Object.entries(t).filter(e=>!n||"min_length"===e[0]).filter(([,e])=>!!e).map(([t])=>{let n=function(e,t){switch(e){case"max_length":return[e,{max_length:t.max_length}];case"min_length":return[e,{min_length:t.min_length}];case"require_special_char":return[e,{allowed_special_characters:t.allowed_special_characters}];default:return e}}(t,e);r.push(n);let s=eG[t];if(Array.isArray(s)){let[r,n]=s;return r.replace(`%${n}%`,e[t])}return s}));return{codes:r,message:`Your password must contain ${s}.`}},eK=e=>{var t;let r=(0,er.ho)(),{disable_hibp:n,min_zxcvbn_strength:i,show_zxcvbn:o,...a}=(null==(t=r.__unstable__environment)?void 0:t.userSettings.passwordSettings)||{},{onValidationError:l=en.lQ,onValidationSuccess:c=en.lQ,onValidationWarning:u=en.lQ,onValidationInfo:d=en.lQ,onValidationComplexity:p}=e||{},f=s.useCallback(e=>{var t,r,n;if(e.complexity&&Object.values(null==e?void 0:e.complexity).length>0){let{message:r,codes:n}=eB({config:a,failedValidations:e.complexity});return(null==(t=e.complexity)?void 0:t.min_length)?d(r,n):l(r,n)}if((null==(r=null==e?void 0:e.strength)?void 0:r.state)==="fail"){let t=e.strength.keys;return l(JSON.stringify(t),t)}if((null==(n=null==e?void 0:e.strength)?void 0:n.state)==="pass"){let t=e.strength.keys;return u(JSON.stringify(t),t)}return c()},[e,a]);return{validatePassword:s.useMemo(()=>e=>r.client.signUp.validatePassword(e,{onValidation:f,onValidationComplexity:p}),[f])}},eq=[0,0],eX=[-1,-1],eY=s.forwardRef(function(e,t){let{render:r,length:n,autoSubmit:s,...i}=e;return void 0!==r?(0,f.jsx)(eJ,{...i,ref:t,render:r,length:n,autoSubmit:s}):(0,f.jsx)(ez,{...i,ref:t,length:n,autoSubmit:s})}),ez=s.forwardRef(function(e,t){let{length:r=6,autoSubmit:n=!1,...i}=e,o=s.useRef(null);return s.useImperativeHandle(t,()=>o.current,[]),s.useEffect(()=>{var t,s;String(e.value).length===r&&n&&(null==(s=null==(t=o.current)?void 0:t.form)||s.requestSubmit())},[e.value,r,n]),(0,f.jsx)(F,{ref:o,...i,"data-otp-input-standard":!0})}),eJ=s.forwardRef(function(e,t){let{className:r,render:n,length:i=6,autoSubmit:o=!1,passwordManagerOffset:a=40,...l}=e,c=s.useRef(null),[u,d]=s.useState(e.autoFocus?eq:eX),[p,h]=s.useState(!1),g=()=>document.activeElement===c.current;return s.useImperativeHandle(t,()=>c.current,[]),s.useLayoutEffect(()=>{document.activeElement===c.current&&d(e=>eQ(e,c))},[e.value]),s.useEffect(()=>{function e(){g()&&d(e=>eQ(e,c))}return document.addEventListener("selectionchange",e,{capture:!0}),()=>document.removeEventListener("selectionchange",e)},[]),s.useEffect(()=>{var t,r;
4String(e.value).length===i&&o&&(null==(r=null==(t=c.current)?void 0:t.form)||r.requestSubmit())},[e.value,i,o]),(0,f.jsxs)("div",{"data-otp-input-wrapper":!0,style:eZ,children:[(0,f.jsx)("style",{children:`
5      input[data-otp-input-segmented]::selection {
6        color: transparent;
7        background-color: transparent;
8      }
9      `}),(0,f.jsx)(F,{"data-otp-input-segmented":!0,ref:c,...l,onFocus:e=>{var t;if(c.current){let e=Math.min(c.current.value.length,i-1),t=c.current.value.length;c.current.setSelectionRange(e,t),d([e,t])}null==(t=null==l?void 0:l.onFocus)||t.call(l,e)},onBlur:e=>{var t;d([-1,-1]),null==(t=null==l?void 0:l.onBlur)||t.call(l,e)},onMouseOver:t=>{var r;g()||h(!0),null==(r=e.onMouseOver)||r.call(e,t)},onMouseLeave:t=>{var r;h(!1),null==(r=e.onMouseLeave)||r.call(e,t)},style:{...e0,clipPath:`inset(0 calc(1ch + ${a}px) 0 0)`,width:`calc(100% + 1ch + ${a}px)`}}),(0,f.jsx)("div",{className:r,"aria-hidden":!0,style:e1,children:Array.from({length:i}).map((t,r)=>{var i,o;let a=p&&!g(),l=u[0]===u[1]&&u[0]===r,c=(null!=(i=u[0])?i:-1)<=r&&(null!=(o=u[1])?o:-1)>r;return(0,f.jsx)(s.Fragment,{children:n({value:String(e.value)[r]||"",status:a?"hovered":l?"cursor":c?"selected":"none",index:r})},`otp-segment-${r}`)})})]})});function eQ(e,t){var r,n,s,i,o,a,l,c,u;let d=[null!=(n=null==(r=t.current)?void 0:r.selectionStart)?n:0,null!=(i=null==(s=t.current)?void 0:s.selectionEnd)?i:0,null!=(a=null==(o=t.current)?void 0:o.selectionDirection)?a:null];return e[0]===d[0]&&e[1]===d[1]?e:(0===d[0]&&1===d[1]&&(d[2]="forward"),d[0]===d[1]&&(d[0]>0&&e[0]===d[0]&&e[1]===d[0]+1?d=[d[0]-1,d[1],"backward"]:void 0!==(null==(l=t.current)?void 0:l.value[d[0]])?d=[d[0],d[1]+1,"backward"]:d[0]>=6&&(d=[d[0]-1,d[1],"backward"])),null==(u=t.current)||u.setSelectionRange(d[
90],d[1],null!=(c=d[2])?c:void 0),[d[0],d[1]])}var eZ={position:"relative",userSelect:"none"},e0={display:"block",background:"transparent",opacity:0,outline:"transparent solid 0px",appearance:"none",color:"transparent",position:"absolute",inset:0,caretColor:"transparent",border:"0px solid transparent",height:"100%",letterSpacing:"-1rem"},e1={zIndex:1,pointerEvents:"none"};function e3(e,t){return(null==e?void 0:e.valid)===!1?e$.error:t}var e4=s.createContext(void 0),e9=()=>s.useContext(e4);function e2({name:e,value:t,checked:r,onChange:n,onBlur:i,onFocus:o,type:a,...l}){let c=eM(),u=e||(null==c?void 0:c.name),d="backup_code"===u?"code":u,{state:p}=eV({name:d}),f=e9();if(!u||!d)throw Error("Clerk: <Input /> must be wrapped in a <Field> component or have a name prop.");let h=eP(),[g,m]=s.useState(!1),{validatePassword:v}=eK({onValidationComplexity:e=>m(e),onValidationSuccess:()=>{h.send({type:"FIELD.FEEDBACK.SET",field:{name:d,feedback:{type:"success",message:"Your password meets all the necessary requirements."}}})},onValidationError:(e,t)=>{e&&h.send({type:"FIELD.FEEDBACK.SET",field:{name:d,feedback:{type:"error",message:new eI("password-validation-error",e),codes:t}}})},onValidationWarning:(e,t)=>h.send({type:"FIELD.FEEDBACK.SET",field:{name:d,feedback:{type:"warning",message:e,codes:t}}}),onValidationInfo:(e,t)=>{h.send({type:"FIELD.FEEDBACK.SET",field:{name:d,feedback:{type:"info",message:e,codes:t}}})}}),y=eN(eO(d)),_=function(e){let t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}(y),S=!!y,E=null!=a?a:"password"===u||"confirmPassword"===u||"currentPassword"===u||"newPassword"===u?"password":"emailAddress"===u?"email":"phoneNumber"===u?"tel":"code"===u?"otp":"backup_code"===u?"backup_code":"text",b=E,w=!1;("password"===E||"text"===E)&&(w=!!l.validatePassword),("otp"===b||"backup_code"===b)&&(b="text"),s.useEffect(()=>{if(d)return h.send({type:"FIELD.ADD",field:{name:d,type:b,value:t,checked:r}}),()=>h.send({type:"FIELD.REMOVE",field:{name:d}})},[h]),s.useEffect(()=>{d&&("checkbox"===E&&void 0!==r||"checkbox"!==E&&void 0!==t)&&h.send({type:"FIELD.UPDATE",field:{name:d,value:t,checked:r}})},[d,E,h,t,r]);let x=s.useCallback(e=>{null==n||n(e),d&&(h.send({type:"FIELD.UPDATE",field:{name:d,value:e.target.value,checked:e.target.checked}}),w&&v(e.target.value))},[h,d,n,w,v]),k=s.useCallback(e=>{null==i||i(e),w&&e.target.value!==_&&v(e.target.value)},[i,w,v,_]),I=s.useCallback(e=>{null==o||o(e),w&&e.target.value!==_&&v(e.target.value)},[o,w,v,_]),A="otp"===E?eY:F,R={};if("otp"===E){let e=l.length||6;R={"data-otp-input":!0,autoComplete:"one-time-code",inputMode:"numeric",pattern:`[0-9]{${e}}`,minLength:e,maxLength:e,onChange:e=>{e.currentTarget.value=e.currentTarget.value.replace(/\D+/g,""),x(e)},type:"text",spellCheck:!1}}else"backup_code"===E?R={autoComplete:"off",type:"text",spellCheck:!1}:"password"===E&&w&&(R={"data-has-passed-validation":!!g||void 0});let{validatePassword:T,...C}=l;return{Element:A,props:{type:E,value:null!=y?y:"",onChange:x,onBlur:k,onFocus:I,"data-hidden":void 0,"data-has-value":!!S||void 0,"data-state":e3(f,p),...R,...C}}}s.forwardRef(({alwaysShow:e,...t},r)=>{var n;let s=eP().getSnapshot().context,i=s.progressive&&!!(null==(n=s.hidden)?void 0:n.has(t.name));return!e&&i?null:(0,f.jsx)(eL.Provider,{value:{name:t.name},children:(0,f.jsx)(e7,{...t,ref:r})})}).displayName="ClerkElementsField";var e7=s.forwardRef((e,t)=>{let{children:r,...n}=e,s=function({name:e}){let t=eN(eU(e)),{feedback:r}=ej({name:e});return{hasValue:t,props:{"data-hidden":void 0,serverInvalid:!!r&&"error"===r.type}}}({name:n.name}),{state:i}=eV({name:n.name});return(0,f.jsx)(T,{...s.props,...n,ref:t,children:(0,f.jsx)(W,{children:e=>{let t=e3(e,i);return(0,f.jsx)(e4.Provider,{value:e,children:"function"==typeof r?r(t):r})}})})});function e8(e){return s.isValidElement(e)&&e.type===s.Fragment}e7.displayName="ClerkElementsFieldInner",s.forwardRef(({asChild:e=!1,children:t,code:r,name:n,...s},i)=>{let o=eM(),a=(null==o?void 0:o.name)||n,{feedback:l}=ej({name:"backup_code"===a?"code":a});if((null==l?void 0:l.type)!=="error")return null;
9let c=l.message;if(!c)return null;let u=e?es.DX:"span",d="function"==typeof t?t(c):t;if(e8(d))throw new ek("<FieldError /> cannot render a Fragment as a child.");return(0,f.jsx)(j,{"data-error-code":c.code,...s,ref:i,asChild:!0,children:(0,f.jsx)(u,{children:d||c.message})})}).displayName="ClerkElementsFieldError";var e5=s.forwardRef(({flowActor:e,onSubmit:t,...r},n)=>{let{onSubmit:i,...a}=function({flowActor:e}){let{errors:t}=eW(),r=(0,s.useCallback)(t=>{t.preventDefault(),e&&e.send({type:"SUBMIT",action:"submit"})},[e]);return{props:{...t.length>0?{"data-global-error":!0}:{},onSubmit:r}}}({flowActor:e}).props;return(0,f.jsx)(k,{...a,...r,onSubmit:(0,o.m)(i,t),ref:n})});e5.displayName="ClerkElementsForm";var e6=s.forwardRef(({asChild:e=!1,children:t,code:r,...n},s)=>{let{errors:i}=eW(),o=null==i?void 0:i[0];if(!o||r&&o.code!==r)return null;let a=e?es.DX:"div",l="function"==typeof t?t(o):t;if(e8(l))throw new ek("<GlobalError /> cannot render a Fragment as a child.");return(0,f.jsx)(a,{role:"alert",...n,ref:s,children:l||o.message})});function te(e){let t=s.createContext(null),r=t.Provider;function n({children:e,actorRef:t}){return s.createElement(r,{value:t},e)}function i(e=!1){let r=s.useContext(t);if(!e&&!r)throw Error(`You used a hook from "${n.displayName}" but it's not inside a <${n.displayName}.Provider> component.`);return r}return n.displayName=e,{Provider:n,useActorRef:i,useSelector:function(e,t){let r=i();return(0,J.d4)(r,e,t)}}}e6.displayName="ClerkElementsGlobalError";var tt=te("SignInRouterCtx");function tr(e){return tt.useSelector(t=>t.children[e])}var tn=()=>tr("start"),ts=()=>tr("firstFactor"),ti=()=>tr("secondFactor"),to=()=>tr("resetPassword"),ta=()=>tt.useSelector(e=>e.context.webAuthnAutofillSupport),tl=(0,s.createContext)({strategy:void 0}),tc=(0,s.createContext)({current:void 0,isActive:e=>!1,preferred:void 0});s.forwardRef((e,t)=>{var r,n,s;let i=(0,er.ho)(),o=e2(e),a=!!(null==(r=o.props.autoComplete)?void 0:r.includes("webauthn")),l=["text","email","tel"].includes(o.props.type),c=tt.useActorRef(!0);return(null==(s=i.telemetry)||s.record((0,eo.we)("Elements_Input",{type:null!=(n=e.type)&&n,render:!!(null==e?void 0:e.render),asChild:!!(null==e?void 0:e.asChild),validatePassword:!!(null==e?void 0:e.validatePassword)})),c&&a&&l)?(0,f.jsx)(tu,{ref:t,...e}):(a&&!l?ei.v.warnOnce('<Input autoComplete="webauthn"> can only be used with <Input type="text"> or <Input type="email">'):a&&ei.v.warnOnce('<Input autoComplete="webauthn"> can only be used inside <SignIn> in order to trigger a sign-in attempt, otherwise it will be ignored.'),(0,f.jsx)(o.Element,{ref:t,...o.props}))}).displayName="ClerkElementsInput";var tu=s.forwardRef((e,t)=>{let r=tt.useActorRef(!0),n=ta();s.useEffect(()=>{n&&(null==r||r.send({type:"AUTHENTICATE.PASSKEY.AUTOFILL"}))},[n,r]);let i=e2(e);return(0,f.jsx)(i.Element,{ref:t,...i.props})});tu.displayName="ClerkElementsInputWithPasskeyAutofill",P.displayName="ClerkElementsLabel";var td=G;td.displayName="ClerkElementsSubmit";var tp={any:"any",all:"all"};function tf(e,t,r=tp.any){let n=(0,J.d4)(e,e=>e,(e,t)=>e.tags===t.tags);if(!n)return!1;if("string"==typeof t)return n.hasTag(t);if(!Array.isArray(t))throw Error("Invalid tags parameter provided to useActiveTags");switch(r){case tp.any:{let e=new Set(t.filter(e=>n.hasTag(e)));return{active:e.size>0,activeTags:e}}case tp.all:return t.length===n.tags.size&&t.every(e=>n.hasTag(e));default:return!1}}var th=e=>[...e].reduce((e,[t,r])=>(e[t]=r,e),{}),tg=el.map(e=>e.strategy),tm=th([...el,...ec].map(e=>[e.provider,{iconUrl:(0,ea.at)(e.provider),name:e.name,strategy:e.strategy}])),tv=th([...el,...ec].map(e=>[e.strategy,{iconUrl:(0,ea.at)(e.provider),id:e.provider,name:e.name}])),ty={authenticatableOauthStrategies:[],providerToDisplayData:{},strategies:[],strategyToDisplayData:{},web3Strategies:[]},t_=e=>{if(!(null==e?void 0:e.userSettings))return ty;let{socialProviderStrategies:t,web3FirstFactors:r,authenticatableSocialStrategies:n}=e.userSettings,s=t.filter(e=>tg.includes(e));return{authenticatableOauthStrategies:[...n.filter(e=>tg.includes(e))],providerToDisplayData:tm,strategies:[...s,...r],strategyToDisplayData:tv,web3Strategies:r}},tS=e=>{var t,r,n,s;let i=(0,er.ho)();if(!i.loaded)return null;if("saml"===e||"enterprise_sso"===e)return null!=(s=null!=(n=null==(t=i.__unstable__environment)?void 0:t.userSettings.saml.enabled)?n:null==(r=i.__unstable__environment)?void 0:r.userSettings.enterpriseSSO.enabled)&&s;let o=t_(i.__unstable__environment);return function(e,t){return t.includes(e.startsWith("oauth_")?e:`oauth_${e}`)}(e,o.authenticatableOauthStrategies)||function(e,t){return t.includes(e.startsWith("web3_")?e:`web3_${e}_signature`)}(e,o.web3Strategies)},tE=(e,t)=>{let r=tS(t),n="saml"===t,i="enterprise_sso"===t,o=i||n?{name:"SSO",strategy:t}:tm[t],a=(0,s.useCallback)(s=>
9{if(r)return(s.preventDefault(),n)?e.send({type:"AUTHENTICATE.SAML"}):i?e.send({type:"AUTHENTICATE.ENTERPRISE_SSO"}):"metamask"===t?e.send({type:"AUTHENTICATE.WEB3",strategy:"web3_metamask_signature"}):"coinbase_wallet"===t?e.send({type:"AUTHENTICATE.WEB3",strategy:"web3_coinbase_wallet_signature"}):"okx_wallet"===t?e.send({type:"AUTHENTICATE.WEB3",strategy:"web3_okx_wallet_signature"}):e.send({type:"AUTHENTICATE.OAUTH",strategy:`oauth_${t}`})},[t,r,n,i,e]);if(!1===r){let e=`https://dashboard.clerk.com/last-active?path=/user-authentication/${"metamask"===t?"web3":"social-connections"}`;throw new ek(`You have used <Connection name="${t}"> which isn't enabled for your project. Enable ${o.name} in your Clerk dashboard: ${e}`)}return{events:{authenticate:a},...o}},tb=te("SignUpRouterCtx");function tw(e){return tb.useSelector(t=>t.children[e])}var tx=()=>tw("start"),tk=()=>tw("continue"),tI=()=>tw("verification"),tA=(0,s.createContext)(null);function tR({asChild:e,name:t,...r}){let n=tt.useActorRef(!0),s=tb.useActorRef(!0),i=tE(n||s,t);if(!i)return null;let o=e?es.DX:"button";return(0,f.jsx)(tA.Provider,{value:i,children:(0,f.jsx)(o,{onClick:i.events.authenticate,...e?{}:{type:"button"},...r})})}var tT=e=>{var t;return null==(t=null==e?void 0:e.context)?void 0:t.loading},tC=(e,t)=>(null==e?void 0:e.isLoading)===(null==t?void 0:t.isLoading);function tP(e){let t=useSelector2(e,tT,tC);return t?[t.isLoading,{step:t.step,strategy:t.strategy,action:t.action}]:[!1,{step:void 0,strategy:void 0,action:void 0}]}function tN(e){let t=s.createContext(!1),r=t.Provider;function n({children:e}){return s.createElement(r,{value:!0},e)}return n.displayName=e,{Provider:n,useDomValidation:function(e=!1){let r=s.useContext(t);if(!e&&!r)throw Error(`You used a hook from "${n.displayName}" but it's not inside a <${n.displayName}.Provider> component.`);return r}}}var tF=s.createContext(null);function tO(){let e=s.useContext(tF);if(!e)throw Error("SignInActiveSessionContext must be used within a SessionList/SignInSessionListItem");return e}var tU=tN("SignInChooseSessionCtx");function tD({asChild:e,children:t,...r}){let n=tf(tt.useActorRef(),"step:choose-session"),s=e?es.DX:"div";return n?(0,f.jsx)(tU.Provider,{children:(0,f.jsx)(s,{...r,children:t})}):null}var tj="/sso-callback",tL="/verify",tM={PUBLIC:"public",RESTRICTED:"restricted"},t$=eR(()=>{var e;return null!=(e=ev.env.CLERK_SIGN_IN_URL)?e:"/sign-in"},"/sign-in"),tV=eR(()=>{var e;return null!=(e=ev.env.CLERK_SIGN_UP_URL)?e:"/sign-up"},"/sign-up"),tW="14.1.0",tG={createdSession:"__clerk_created_session",handshake:"__clerk_handshake",help:"__clerk_help",invitationToken:"__clerk_invitation_token",modalState:"__clerk_modal_state",satelliteUrl:"__clerk_satellite_url",status:"__clerk_status",synced:"__clerk_synced",ticket:"__clerk_ticket",transfer:"__clerk_transfer"},tH=60,tB="clerk-captcha",tK={FORM_IDENTIFIER_NOT_FOUND:"form_identifier_not_found",FORM_PASSWORD_INCORRECT:"form_password_incorrect",INVALID_STRATEGY_FOR_USER:"strategy_for_user_invalid",NOT_ALLOWED_TO_SIGN_UP:"not_allowed_to_sign_up",OAUTH_ACCESS_DENIED:"oauth_access_denied",OAUTH_EMAIL_DOMAIN_RESERVED_BY_SAML:"oauth_email_domain_reserved_by_saml",NOT_ALLOWED_ACCESS:"not_allowed_access",SAML_USER_ATTRIBUTE_MISSING:"saml_user_attribute_missing",USER_LOCKED:"user_locked",ENTERPRISE_SSO_USER_ATTRIBUTE_MISSING:"enterprise_sso_user_attribute_missing",ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:"enterprise_sso_email_address_domain_mismatch",ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:"enterprise_sso_hosted_domain_mismatch",SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:"saml_email_address_domain_mismatch",ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:"organization_membership_quota_exceeded_for_sso"},tq={path:"path",virtual:"virtual",hash:"hash"};function tX({context:e,event:t}){let r,n,s;return t.type.startsWith("xstate.done.")||t.type.startsWith("xstate.error.")?e.parent.send({type:"LOADING",isLoading:!1,step:void 0,strategy:void 0}):"strategy"===e.loadingStep?(r=void 0,"REDIRECT"===t.type&&(n=t.params.strategy),e.parent.send({type:"LOADING",isLoading:!0,step:r,strategy:n})):"continue"===e.loadingStep?(r="continue",n=void 0,s="action"in t?t.action:void 0,e.parent.send({type:"LOADING",isLoading:!0,step:r,strategy:n,action:s})):"reset-password"===e.loadingStep?(r="reset-password",n=void 0,s="action"in t?t.action:void 0,e.parent.send({type:"LOADING",isLoading:!0,step:r,strategy:n,action:s})):"start"===e.loadingStep?(r="start",n=void 0,s="action"in t?t.action:void 0,e.parent.send({type:"LOADING",isLoading:!0,step:r,strategy:n,action:s})):(r=e.loadingStep,n=void 0,s="action"in t?t.action:void 0,e.parent.send({type:"LOADING",isLoading:!0,step:r,strategy:n,action:s}))}var tY=e=>e.reduce((e,t,r)=>(e[t]=r,e),{}),tz=tY(["passkey","password","email_link","email_code","phone_code"]),tJ=tY(["email_code","email_link","phone_code","passkey","password"]),tQ=e=>(t,r)=>{let n=e[t.strategy],s=e[r.strategy];return void 0===n||void 0===s?0:n-s},tZ=tQ(tz),t0=tQ(tJ),t1=e=>t=>"safeIdentifier"in t&&t.safeIdentifier===e;function t3(e){if(ep()){let t=e.find(({strategy:e})=>"passkey"===e);if(t)return t}return null}function t4(e,t){if(null==e)throw Error(`${t||e} is not defined`)}function t9(e){if("error"in e==!1)throw Error(`Expected an error event, got "${e.type}"`)}var t2=e=>!!e&&["passkey","password"].includes(e),t7=(0,ee.mj)({actors:{determineStartingFactor:(0,eu.Sx)(()=>Promise.reject(new ek("Actor `determineStartingFactor` must be overridden"))),prepare:(0,eu.Sx)(()=>Promise.reject(new ek("Actor `prepare` must be overridden"))),attempt:(0,eu.Sx)(()=>Promise.reject(new ek("Actor `attempt` must be overridden"))),attemptPasskey:(0,eu.Sx)(({input:{parent:e,flow:t}})=>e.getSnapshot().context.clerk.client.signIn.authenticateWithPasskey({flow:t}))},actions:{resendableTick:(0,et.a)(({context:e})=>({resendable:0===e.resendableAfter,resendableAfter:e.resendableAfter>0?e.resendableAfter-1:e.resendableAfter})),resendableReset:(0,et.a)({resendable:!1,resendableAfter:tH}
9),validateRegisteredStrategies:({context:e})=>{var t;null!=(t=e.parent.getSnapshot().context.clerk.__unstable__environment)&&t.isProduction()},sendToNext:({context:e,event:t})=>e.parent.send({type:"NEXT",resource:t.output}),sendToLoading:tX,setFormErrors:(0,et.c)(({context:e})=>e.formRef,({event:e})=>(t9(e),{type:"ERRORS.SET",error:e.error})),setConsoleError:({event:e})=>{}},guards:{isResendable:({context:e})=>e.resendable||0===e.resendableAfter,isNeverResendable:({context:e})=>{var t;return t2(null==(t=e.currentFactor)?void 0:t.strategy)}},delays:{resendableTimeout:1e3},types:{}}).createMachine({id:"SignInVerification",context:({input:e})=>({currentFactor:null,basePath:e.basePath||t$,formRef:e.formRef,loadingStep:"verifications",parent:e.parent,registeredStrategies:new Set,resendable:!1,resendableAfter:tH}),initial:"Init",on:{"NAVIGATE.PREVIOUS":".Hist","STRATEGY.REGISTER":{actions:(0,et.a)({registeredStrategies:({context:e,event:t})=>e.registeredStrategies.add(t.factor)})},"STRATEGY.UNREGISTER":{actions:(0,et.a)({registeredStrategies:({context:e,event:t})=>(e.registeredStrategies.delete(t.factor),e.registeredStrategies)})}},states:{Init:{tags:["state:preparing","state:loading"],invoke:{id:"determineStartingFactor",src:"determineStartingFactor",input:({context:e})=>({parent:e.parent}),onDone:{target:"Preparing",actions:(0,et.a)({currentFactor:({event:e})=>e.output})},onError:{target:"Preparing",actions:[(0,et.l)("Clerk [Sign In Verification]: Error determining starting factor"),(0,et.a)({currentFactor:{strategy:"password"}})]}}},Preparing:{tags:["state:preparing","state:loading"],invoke:{id:"prepare",src:"prepare",input:({context:e})=>({parent:e.parent,resendable:e.resendable,params:{...e.currentFactor,redirectUrl:`${window.location.origin}${e.basePath}${tL}`}}),onDone:{actions:"resendableReset",target:"Pending"},onError:{actions:["setFormErrors","setConsoleError"],target:"Pending"}}},Pending:{tags:["state:pending"],description:"Waiting for user input",on:{"AUTHENTICATE.PASSKEY":{target:"AttemptingPasskey",reenter:!0},"NAVIGATE.CHOOSE_STRATEGY":"ChooseStrategy","NAVIGATE.FORGOT_PASSWORD":"ChooseStrategy",RETRY:"Preparing",SUBMIT:{target:"Attempting",reenter:!0}},initial:"Init",states:{Init:{description:"Marks appropriate factors as never resendable.",always:[{guard:"isNeverResendable",target:"NeverResendable"},{target:"NotResendable"}]},Resendable:{description:"Waiting for user to retry"},NeverResendable:{description:"Handles never resendable",on:{RETRY:{actions:(0,et.l)("Never retriable")}}},NotResendable:{description:"Handle countdowns",on:{RETRY:{actions:(0,et.l)(({context:e})=>`Not retriable; Try again in ${e.resendableAfter}s`)}},after:{resendableTimeout:[{description:"Set as retriable if countdown is 0",guard:"isResendable",actions:"resendableTick",target:"Resendable"},{description:"Continue countdown if not retriable",actions:"resendableTick",target:"NotResendable",reenter:!0}]}}},after:{3e3:{actions:"validateRegisteredStrategies"}}},ChooseStrategy:{description:"Handles both choose strategy and forgot password as the latter is similar in functionality",tags:["state:choose-strategy","state:forgot-password"],on:{"STRATEGY.UPDATE":{actions:(0,et.a)({currentFactor:({event:e})=>e.factor||null}),target:"Preparing"}}},Attempting:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attempt",src:"attempt",input:({context:e})=>({parent:e.parent,currentFactor:e.currentFactor,fields:e.formRef.getSnapshot().context.fields}),onDone:{actions:["sendToNext","sendToLoading"]},onError:{actions:["setFormErrors","setConsoleError","sendToLoading"],target:"Pending"}}},AttemptingPasskey:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attemptPasskey",src:"attemptPasskey",input:({context:e})=>({parent:e.parent,flow:"discoverable"}),onDone:{actions:["sendToNext","sendToLoading"]},onError:{actions:["setFormErrors","sendToLoading"],target:"Pending"}}},Hist:{type:"history"}}}),t8=t7.provide({actors:{determineStartingFactor:(0,eu.Sx)(async({input:e})=>{var t;let r=e.parent.getSnapshot().context.clerk;return Promise.resolve(function(e,t,r){return e&&0!==e.length?"password"===r?function(e,t){let r=t3(e);if(r)return r;let n=e.sort(tZ)[0];
9return"password"===n.strategy?n:e.find(t1(t))||n||null}(e,t):function(e,t){let r=t3(e);if(r)return r;let n=e.sort(t0),s=n.find(t1(t));if(s)return s;let i=n[0];return"email_link"===i.strategy?i:e.find(t1(t))||i||null}(e,t):null}(r.client.signIn.supportedFirstFactors,r.client.signIn.identifier,null==(t=r.__unstable__environment)?void 0:t.displayConfig.preferredSignInStrategy))}),prepare:(0,eu.Sx)(async({input:e})=>{let{params:t,parent:r,resendable:n}=e,s=r.getSnapshot().context.clerk,i=s.client.signIn.firstFactorVerification.expireAt,o=n||!i||i<new Date;return t2(null==t?void 0:t.strategy)||!o?Promise.resolve(s.client.signIn):(t4(t,"First factor params"),await s.client.signIn.prepareFirstFactor(t))}),attempt:(0,eu.Sx)(async({input:e})=>{var t,r,n,s,i;let o,{currentFactor:a,fields:l,parent:c}=e;t4(a,"Current factor");let u=a.strategy,d=null==(t=l.get("code"))?void 0:t.value,p=null==(r=l.get("password"))?void 0:r.value;switch(u){case"passkey":return await c.getSnapshot().context.clerk.client.signIn.authenticateWithPasskey();case"password":t4(p,"Password"),o={strategy:u,password:p};break;case"reset_password_phone_code":case"reset_password_email_code":t4(d,"Code for resetting phone/email"),o={strategy:u,code:d,password:p};break;case"phone_code":case"email_code":t4(d,"Code for phone/email"),o={strategy:u,code:d};break;case"web3_metamask_signature":{let e=null==(n=l.get("signature"))?void 0:n.value;t4(e,"Web3 Metamask signature"),o={strategy:u,signature:e};break}case"web3_coinbase_wallet_signature":{let e=null==(s=l.get("signature"))?void 0:s.value;t4(e,"Web3 Coinbase Wallet signature"),o={strategy:u,signature:e};break}case"web3_okx_wallet_signature":{let e=null==(i=l.get("signature"))?void 0:i.value;t4(e,"Web3 OKX Wallet signature"),o={strategy:u,signature:e};break}default:throw new ek(`Invalid strategy: ${u}`)}return await c.getSnapshot().context.clerk.client.signIn.attemptFirstFactor(o)})}}),t5=t7.provide({actors:{determineStartingFactor:(0,eu.Sx)(async({input:e})=>Promise.resolve(function(e){if(!e||0===e.length)return null;let t=e.find(e=>"totp"===e.strategy);if(t)return t;let r=e.find(e=>"phone_code"===e.strategy);return r||e[0]}(e.parent.getSnapshot().context.clerk.client.signIn.supportedSecondFactors))),prepare:(0,eu.Sx)(async({input:e})=>{let{params:t,parent:r,resendable:n}=e,s=r.getSnapshot().context.clerk,i=s.client.signIn.secondFactorVerification.expireAt,o=n||!i||i<new Date;return(t4(t,"Second factor params"),"phone_code"===t.strategy&&o)?await s.client.signIn.prepareSecondFactor({strategy:t.strategy,phoneNumberId:t.phoneNumberId}):Promise.resolve(s.client.signIn)}),attempt:(0,eu.Sx)(async({input:e})=>{var t;let{fields:r,parent:n,currentFactor:s}=e,i=null==(t=r.get("code"))?void 0:t.value;return t4(s,"Current factor"),t4(i,"Code"),await n.getSnapshot().context.clerk.client.signIn.attemptSecondFactor({strategy:s.strategy,code:i})})}}),t6={complete:"CLERKJS.NAVIGATE.COMPLETE",signUp:"CLERKJS.NAVIGATE.SIGN_UP",continue:"CLERKJS.NAVIGATE.CONTINUE",generic:"CLERKJS.NAVIGATE.GENERIC",resetPassword:"CLERKJS.NAVIGATE.RESET_PASSWORD",signIn:"CLERKJS.NAVIGATE.SIGN_IN",verification:"CLERKJS.NAVIGATE.VERIFICATION"},re=(0,eu.Sx)(async({input:{flow:e,params:t,parent:r}})=>{let n=r.getSnapshot().context.clerk;return n.client[e].authenticateWithRedirect({redirectUrl:n.buildUrlWithAuth(t.redirectUrl||"/"),redirectUrlComplete:n.buildUrlWithAuth(t.redirectUrlComplete||"/"),...t})}),rt=(0,eu.SP)(({sendBack:e,input:t})=>{var r,n;let s=t.getSnapshot().context.clerk,i=null==(r=s.__unstable__environment)?void 0:r.displayConfig;return(null!=(n=s.clerkjs)?n:s).handleRedirectCallback({continueSignUpUrl:t6.continue,firstFactorUrl:t6.signIn,resetPasswordUrl:t6.resetPassword,secondFactorUrl:t6.signIn,verifyEmailAddressUrl:t6.verification,verifyPhoneNumberUrl:t6.verification,signUpUrl:t6.signUp,signInUrl:t6.signIn},t=>{let r=t.split("/").slice(-1)[0];return function(e){return Object.values(t6).includes(e)}(r)?e({type:r}):r===(null==i?void 0:i.signInUrl)?e({type:t6.signIn}):r===(null==i?void 0:i.signUpUrl)?e({type:t6.signUp}):e({type:"FAILURE",error:new ek(`Unknown navigation event: ${r}`)}),Promise.resolve()}),()=>void 0}),rr="ThirdParty",rn=(0,ee.mj)({actors:{handleRedirectCallback:rt,redirect:re},actions:{logError:(0,et.l)(({event:e})=>`Error: ${e.type}`),assignActiveStrategy:(0,et.a)({activeStrategy:({event:e})=>((0,ee.DT)(e,"REDIRECT"),e.params.strategy)}),unassignActiveStrategy:(0,et.a)({activeStrategy:null}),sendToNext:({context:e})=>e.parent.send({type:"NEXT"}),sendToLoading:tX,setFormErrors:(0,et.c)(({context:e})=>e.formRef,({event:e})=>(t9(e),{type:"ERRORS.SET",error:e.error}))},guards:{isExampleMode:({context:e})=>!!e.parent.getSnapshot().context.exampleMode},types:{}}).createMachine({id:rr,context:({input:e})=>({activeStrategy:null,basePath:e.basePath,formRef:e.formRef,flow:e.flow,parent:e.parent,loadingStep:"strategy"}),initial:"Idle",states:{Idle:{description:"Sets third-party providers if not already set, and waits for a redirect or callback event",on:{CALLBACK:"HandlingCallback",REDIRECT:{guard:(0,eg.E)("isExampleMode"),target:"Redirecting",reenter
9:!0}}},Redirecting:{description:"Redirects to the third-party provider for authentication",tags:["state:redirect","state:loading"],entry:["assignActiveStrategy","sendToLoading"],exit:["unassignActiveStrategy","sendToLoading"],invoke:{id:"redirect",src:"redirect",input:({context:e,event:t})=>{var r;(0,ee.DT)(t,"REDIRECT");let n=null==(r=e.formRef.getSnapshot().context.fields.get("legalAccepted"))?void 0:r.checked;return{basePath:e.basePath,flow:e.flow,params:{...t.params,legalAccepted:n||void 0},parent:e.parent}},onError:{actions:"setFormErrors",target:"Idle"}}},HandlingCallback:{description:"Handles the callback from the third-party provider",tags:["state:callback","state:loading"],invoke:{id:"handleRedirectCallback",src:"handleRedirectCallback",input:({context:e})=>e.parent,onError:{actions:["logError","setFormErrors"],target:"Idle"}},on:{"CLERKJS.NAVIGATE.*":{actions:"sendToNext",target:"Idle"}}}}});function rs(){return"undefined"!=typeof window&&!!window.next&&window.next.version<tW}var ri=(0,ee.mj)({actors:{attempt:(0,eu.Sx)(({input:{fields:e,parent:t}})=>{var r,n;let s=(null==(r=e.get("password"))?void 0:r.value)||"",i=(null==(n=e.get("signOutOfOtherSessions"))?void 0:n.checked)||!1;return t.getSnapshot().context.clerk.client.signIn.resetPassword({password:s,signOutOfOtherSessions:i})})},actions:{sendToLoading:tX,sendToNext:({context:e,event:t})=>e.parent.send({type:"NEXT",resource:t.output}),setFormErrors:(0,et.c)(({context:e})=>e.formRef,({event:e})=>(t9(e),{type:"ERRORS.SET",error:e.error}))},types:{}}).createMachine({id:"SignInResetPasswordMachine",context:({input:e})=>({loadingStep:"reset-password",parent:e.parent,formRef:e.formRef}),initial:"Pending",states:{Pending:{tags:["state:pending"],description:"Waiting for user input",on:{SUBMIT:{target:"Attempting",reenter:!0}}},Attempting:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attempt",src:"attempt",input:({context:e})=>({parent:e.parent,fields:e.formRef.getSnapshot().context.fields}),onDone:{actions:["sendToNext","sendToLoading"]},onError:{actions:["setFormErrors","sendToLoading"],target:"Pending"}}}}}),ro=["emailAddress","phoneNumber"],ra=(0,ee.mj)({actors:{attemptPasskey:(0,eu.Sx)(({input:{parent:e,flow:t}})=>e.getSnapshot().context.clerk.client.signIn.authenticateWithPasskey({flow:t})),attemptWeb3:(0,eu.Sx)(({input:{parent:e,strategy:t}})=>{if("web3_metamask_signature"===t)return e.getSnapshot().context.clerk.client.signIn.authenticateWithMetamask();if("web3_coinbase_wallet_signature"===t)return e.getSnapshot().context.clerk.client.signIn.authenticateWithCoinbaseWallet();if("web3_okx_wallet_signature"===t)return e.getSnapshot().context.clerk.client.signIn.authenticateWithOKXWallet();throw new ek(`Unsupported Web3 strategy: ${t}`)}),attempt:(0,eu.Sx)(({input:{fields:e,parent:t,params:r}})=>{var n;let s=t.getSnapshot().context.clerk,i=e.get("password"),o=e.get("identifier"),a=(null==i?void 0:i.value)?{password:i.value,strategy:"password"}:{};return s.client.signIn.create({...a,...(null==r?void 0:r.ticket)?r:{identifier:null!=(n=null==o?void 0:o.value)?n:""}})})},actions:{sendToNext:({context:e,event:t})=>e.parent.send({type:"NEXT",resource:null==t?void 0:t.output}),sendToLoading:tX,setFormDisabledTicketFields:(0,et.b)(({context:e,enqueue:t})=>{if(!e.ticket)return;let r=e.formRef.getSnapshot().context.fields;for(let n of ro)r.has(n)&&t.sendTo(e.formRef,{type:"FIELD.DISABLE",field:{name:n}})}),setFormErrors:(0,et.c)(({context:e})=>e.formRef,({event:e})=>(t9(e),{type:"ERRORS.SET",error:e.error}))},guards:{hasTicket:({context:e})=>!!e.ticket,isExampleMode:({context:e})=>!!e.parent.getSnapshot().context.exampleMode},types:{}}).createMachine({id:"SignInStart",context:({input:e})=>({basePath:e.basePath||t$,parent:e.parent,formRef:e.formRef,loadingStep:"start",ticket:e.ticket}),initial:"Init",states:{Init:{description:"Handle ticket, if present; Else, default to Pending state.",always:[{guard:"hasTicket",target:"Attempting"},{target:"Pending"}]},Pending:{tags:["state:pending"],description:"Waiting for user input",on:{SUBMIT:{guard:(0,eg.E)("isExampleMode"),target:"Attempting",reenter
9:!0},"AUTHENTICATE.PASSKEY":{guard:(0,eg.E)("isExampleMode"),target:"AttemptingPasskey",reenter:!0},"AUTHENTICATE.PASSKEY.AUTOFILL":{guard:(0,eg.E)("isExampleMode"),target:"AttemptingPasskeyAutoFill",reenter:!1},"AUTHENTICATE.WEB3":{guard:(0,eg.E)("isExampleMode"),target:"AttemptingWeb3",reenter:!0}}},Attempting:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attempt",src:"attempt",input:({context:e})=>{let t={fields:e.formRef.getSnapshot().context.fields,parent:e.parent},r=e.ticket?{strategy:"ticket",ticket:e.ticket}:{};return{...t,params:r}},onDone:{actions:["setFormDisabledTicketFields","sendToNext","sendToLoading"]},onError:{actions:["setFormDisabledTicketFields","setFormErrors","sendToLoading"],target:"Pending"}}},AttemptingPasskey:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attemptPasskey",src:"attemptPasskey",input:({context:e})=>({parent:e.parent,flow:"discoverable"}),onDone:{actions:["sendToNext","sendToLoading"]},onError:{actions:["setFormErrors","sendToLoading"],target:"Pending"}}},AttemptingPasskeyAutoFill:{on:{"AUTHENTICATE.PASSKEY":{guard:(0,eg.E)("isExampleMode"),target:"AttemptingPasskey",reenter:!0},SUBMIT:{guard:(0,eg.E)("isExampleMode"),target:"Attempting",reenter:!0}},invoke:{id:"attemptPasskeyAutofill",src:"attemptPasskey",input:({context:e})=>({parent:e.parent,flow:"autofill"}),onDone:{actions:["sendToNext"]},onError:{actions:["setFormErrors"],target:"Pending"}}},AttemptingWeb3:{tags:["state:attempting","state:loading"],entry:"sendToLoading",invoke:{id:"attemptWeb3",src:"attemptWeb3",input:({context:e,event:t})=>((0,ee.DT)(t,"AUTHENTICATE.WEB3"),{parent:e.parent,strategy:t.strategy}),onDone:{actions:["sendToNext","sendToLoading"]},onError:{actions:["setFormErrors","sendToLoading"],target:"Pending"}}}}}),rl=e=>({context:t},r)=>{var n,s;return null!=(s=null==(n=t.router)?void 0:n.match(e))&&s},rc=e=>({context:t,event:r},n)=>{var s,i;return(null==(s=null==r?void 0:r.resource)?void 0:s.status)===e||(null==(i=t.clerk)?void 0:i.client.signIn.status)===e},ru=(0,ee.mj)({actors:{firstFactorMachine:t8,formMachine:eA,resetPasswordMachine:ri,startMachine:ra,secondFactorMachine:t5,thirdPartyMachine:rn,webAuthnAutofillSupport:(0,eu.Sx)(()=>ef())},actions:{clearFormErrors:(0,et.c)(({context:e})=>e.formRef,{type:"ERRORS.CLEAR"}),navigateInternal:({context:e},{path:t,force:r=!1})=>{if(!e.router||!r&&rs()||e.exampleMode)return;let n=(0,eh.oq)(e.router.basePath,t);n!==e.router.pathname()&&e.router.shallowPush(n)},navigateExternal:({context:e},{path:t})=>{var r;return null==(r=e.router)?void 0:r.push(t)},raiseNext:(0,eg.O)({type:"NEXT"}),setActive:(0,et.b)(({enqueue:e,check:t,context:r,event:n})=>{var s;if(t("isExampleMode"))return;let i=null==n?void 0:n.id,o=r.clerk.client.lastActiveSessionId,a=((null==n?void 0:n.resource)||r.clerk.client.signIn).createdSessionId;r.clerk.setActive({session:i||a||o||null,redirectUrl:r.clerk.buildAfterSignInUrl({params:null==(s=r.router)?void 0:s.searchParams()})}),e.raise({type:"RESET"},{delay:2e3})}),setError:(0,et.a)({error:(e,{error:t})=>t||new ek("Unknown error")}),setFormErrors:({context:e},t)=>(0,et.c)(e.formRef,{type:"ERRORS.SET",error:t.error}),setFormOAuthErrors:({context:e})=>{let t,r=e.clerk.client.signIn.firstFactorVerification.error;if(r){switch(r.code){case tK.NOT_ALLOWED_TO_SIGN_UP:case tK.OAUTH_ACCESS_DENIED:case tK.NOT_ALLOWED_ACCESS:case tK.SAML_USER_ATTRIBUTE_MISSING:case tK.OAUTH_EMAIL_DOMAIN_RESERVED_BY_SAML:case tK.USER_LOCKED:case tK.ENTERPRISE_SSO_USER_ATTRIBUTE_MISSING:case tK.ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:case tK.ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:case tK.SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:case tK.ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:t=new ex(r.code,r.longMessage||"");break;default:t=new ex("unable_to_complete","Unable to complete action at this time. If the problem persists please contact support.")}e.formRef.send({type:"ERRORS.SET",error:t})}},transfer:({context:e})=>{var t;let r=new URLSearchParams({__clerk_transfer:"1"});null==(t=e.router)||t.push(`${e.signUpPath}?${r}`)}},guards:{hasAuthenticatedViaClerkJS:({context:e})=>!!(null===e.clerk.client.signIn.status&&e.clerk.client.lastActiveSessionId),hasOAuthError:({context:e})=>{var t,r,n,s;return!!(null==(s=null==(n=null==(r=null==(t=e.clerk)?void 0:t.client)?void 0:r.signIn)?void 0:n.firstFactorVerification)?void 0:s.error)},hasResource:({context:e})=>{var t,r,n;return!!(null==(n=null==(r=null==(t=e.clerk)?void 0:t.client)?void 0:r.signIn)?void 0:n.status)},hasTicket:({context:e})=>!!e.ticket,isLoggedInAndSingleSession:(0,eg.D)(["isLoggedIn","isSingleSessionMode",(0,eg.E)("isExampleMode")]),isActivePathRoot:rl("/"),isComplete:({context:e,event:t})=>{let r=null==t?void 0:t.resource,n=e.clerk.client.signIn;return(null==r?void 0:r.status)==="complete"&&!!(null==r?void 0:r.createdSe
9ssionId)||"complete"===n.status&&!!n.createdSessionId},isLoggedIn:({context:e})=>{var t;return!!(null==(t=e.clerk)?void 0:t.user)},isSingleSessionMode:({context:e})=>{var t,r;return!!(null==(r=null==(t=e.clerk)?void 0:t.__unstable__environment)?void 0:r.authConfig.singleSessionMode)},isExampleMode:({context:e})=>!!e.exampleMode,needsStart:(0,eg.F)([(0,eg.E)("hasResource"),"statusNeedsIdentifier",rl("/")]),needsFirstFactor:(0,eg.D)(["statusNeedsFirstFactor",rl("/continue")]),needsSecondFactor:(0,eg.D)(["statusNeedsSecondFactor",rl("/continue")]),needsCallback:rl(tj),needsChooseSession:rl("/choose"),needsNewPassword:(0,eg.D)(["statusNeedsNewPassword",rl("/new-password")]),statusNeedsIdentifier:rc("needs_identifier"),statusNeedsFirstFactor:rc("needs_first_factor"),statusNeedsSecondFactor:rc("needs_second_factor"),statusNeedsNewPassword:rc("needs_new_password")},types:{}}).createMachine({id:"SignInRouter",context:{},initial:"Idle",on:{"AUTHENTICATE.OAUTH":{actions:(0,et.c)(rr,({context:e,event:t})=>{var r,n,s,i;return{type:"REDIRECT",params:{strategy:t.strategy,redirectUrl:`${(null==(r=e.router)?void 0:r.mode)===tq.virtual?null==(n=e.clerk.__unstable__environment)?void 0:n.displayConfig.signInUrl:null==(s=e.router)?void 0:s.basePath}${tj}`,redirectUrlComplete:e.clerk.buildAfterSignInUrl({params:null==(i=e.router)?void 0:i.searchParams()})}}})},"AUTHENTICATE.SAML":{actions:(0,et.c)(rr,({context:e})=>{var t,r,n,s,i;return{type:"REDIRECT",params:{strategy:"saml",identifier:null==(t=e.formRef.getSnapshot().context.fields.get("identifier"))?void 0:t.value,redirectUrl:`${(null==(r=e.router)?void 0:r.mode)===tq.virtual?null==(n=e.clerk.__unstable__environment)?void 0:n.displayConfig.signInUrl:null==(s=e.router)?void 0:s.basePath}${tj}`,redirectUrlComplete:e.clerk.buildAfterSignInUrl({params:null==(i=e.router)?void 0:i.searchParams()})}}})},"AUTHENTICATE.ENTERPRISE_SSO":{actions:(0,et.c)(rr,({context:e})=>{var t,r,n,s,i;return{type:"REDIRECT",params:{strategy:"enterprise_sso",identifier:null==(t=e.formRef.getSnapshot().context.fields.get("identifier"))?void 0:t.value,redirectUrl:`${(null==(r=e.router)?void 0:r.mode)===tq.virtual?null==(n=e.clerk.__unstable__environment)?void 0:n.displayConfig.signInUrl:null==(s=e.router)?void 0:s.basePath}${tj}`,redirectUrlComplete:e.clerk.buildAfterSignInUrl({params:null==(i=e.router)?void 0:i.searchParams()})}}})},"FORM.ATTACH":{description:"Attach/re-attach the form to the router.",actions:(0,et.b)(({enqueue:e,event:t})=>{e.assign({formRef:t.formRef}),e.raise({type:"RESET.STEP"})})},"NAVIGATE.PREVIOUS":".Hist","NAVIGATE.START":".Start",LOADING:{actions:(0,et.a)(({event:e})=>({loading:{isLoading:e.isLoading,step:e.step,strategy:e.strategy,action:e.action}}))},RESET:".Idle"},states:{Idle:{invoke:{id:"webAuthnAutofill",src:"webAuthnAutofillSupport",onDone:{actions:(0,et.a)({webAuthnAutofillSupport:({event:e})=>e.output})}},on:{INIT:{actions:(0,et.a)(({event:e})=>{var t;let r=null==(t=e.router)?void 0:t.searchParams();return{clerk:e.clerk,exampleMode:e.exampleMode||!1,formRef:e.formRef,loading:{isLoading:!1},router:e.router,signUpPath:e.signUpPath||tV,ticket:(null==r?void 0:r.get(tG.ticket))||void 0}}),target:"Init"}}},Init:{entry:(0,et.b)(({context:e,enqueue:t,self:r})=>{var n,s;r.getSnapshot().children[rr]||t.spawnChild("thirdPartyMachine",{id:rr,systemId:rr,input:{basePath:null!=(s=null==(n=e.router)?void 0:n.basePath)?s:t$,flow:"signIn",formRef:e.formRef,parent:r}})}),always:[{guard:"needsCallback",target:"Callback"},{guard:"needsChooseSession",target:"ChooseSession"},{guard:"isComplete",actions:"setActive"},{guard:"isLoggedInAndSingleSession",actions:[(0,et.l)("Already logged in"),{type:"navigateExternal",params:({context:e})=>{var t;return{path:e.clerk.buildAfterSignInUrl({params:null==(t=e.router)?void 0:t.searchParams()})}}}]},{guard:"needsStart",actions:{type:"navigateInternal",params:{force:!0,path:"/"}},target:"Start"},{guard:"needsFirstFactor",actions:{type:"navigateInternal",params:{force:!0,path:"/continue"}},target:"FirstFactor"},{guard:"needsSecondFactor",actions:{type:"navigateInternal",params:{force:!0,path:"/continue"}},target:"SecondFactor"},{guard:"needsNewPassword",actions:{type:"navigateInternal",params:{force:!0,path:"/reset-password"}},target:"ResetPassword"},{actions:{type:"navigateInternal",params:{force:!0,path:"/"}},target:"Start"},{guard:"hasTicket",actions:{type:"navigateInternal",params:{force:!0,path:"/"}},target:"Start"}]},Start:{tags:["step:start"],exit:"clearFormErrors",invoke:{id:"start",src:"startMachine",input:({context:e,self:t})=>{var r;return{basePath:null==(r=e.router)?void 0:r.basePath,formRef:e.formRef,parent:t,ticket:e.ticket}},onDone:{actions:"raiseNext"}}
9,on:{"RESET.STEP":{target:"Start",reenter:!0},"AUTHENTICATE.PASSKEY":{actions:(0,et.c)("start",({event:e})=>e)},"AUTHENTICATE.PASSKEY.AUTOFILL":{actions:(0,et.c)("start",({event:e})=>e)},"AUTHENTICATE.WEB3":{actions:(0,et.c)("start",({event:e})=>e)},NEXT:[{guard:"isComplete",actions:"setActive"},{guard:"statusNeedsFirstFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"FirstFactor"},{guard:"statusNeedsSecondFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"SecondFactor"},{guard:"statusNeedsNewPassword",actions:{type:"navigateInternal",params:{path:"/reset-password"}},target:"ResetPassword"}]}},FirstFactor:{tags:["step:first-factor","step:verifications"],invoke:{id:"firstFactor",src:"firstFactorMachine",input:({context:e,self:t})=>{var r;return{formRef:e.formRef,parent:t,basePath:null==(r=e.router)?void 0:r.basePath}},onDone:{actions:"raiseNext"}},on:{"AUTHENTICATE.PASSKEY":{actions:(0,et.c)("firstFactor",({event:e})=>e)},"RESET.STEP":{target:"FirstFactor",reenter:!0},NEXT:[{guard:"isComplete",actions:"setActive"},{guard:"statusNeedsSecondFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"SecondFactor"},{guard:"statusNeedsNewPassword",actions:{type:"navigateInternal",params:{path:"/reset-password"}},target:"ResetPassword"}],"STRATEGY.UPDATE":{description:"Send event to verification machine to update the current strategy.",actions:(0,et.c)("firstFactor",({event:e})=>e),target:".Idle"}},initial:"Idle",states:{Idle:{on:{"NAVIGATE.FORGOT_PASSWORD":{description:"Navigate to forgot password screen.",actions:(0,et.c)("firstFactor",({event:e})=>e),target:"ForgotPassword"},"NAVIGATE.CHOOSE_STRATEGY":{description:"Navigate to choose strategy screen.",actions:(0,et.c)("firstFactor",({event:e})=>e),target:"ChoosingStrategy"}}},ChoosingStrategy:{tags:["step:choose-strategy"],on:{"NAVIGATE.PREVIOUS":{description:"Go to Idle, and also tell firstFactor to go to Pending",target:"Idle",actions:(0,et.c)("firstFactor",{type:"NAVIGATE.PREVIOUS"})}}},ForgotPassword:{tags:["step:forgot-password"],on:{"NAVIGATE.PREVIOUS":"Idle"}}}},SecondFactor:{tags:["step:second-factor","step:verifications"],invoke:{id:"secondFactor",src:"secondFactorMachine",input:({context:e,self:t})=>({formRef:e.formRef,parent:t}),onDone:{actions:"raiseNext"}}
9,on:{"RESET.STEP":{target:"SecondFactor",reenter:!0},NEXT:[{guard:"isComplete",actions:"setActive"},{guard:"statusNeedsNewPassword",actions:{type:"navigateInternal",params:{path:"/reset-password"}},target:"ResetPassword"}],"STRATEGY.UPDATE":{description:"Send event to verification machine to update the current strategy.",actions:(0,et.c)("secondFactor",({event:e})=>e),target:".Idle"}},initial:"Idle",states:{Idle:{on:{"NAVIGATE.CHOOSE_STRATEGY":{description:"Navigate to choose strategy screen.",actions:(0,et.c)("secondFactor",({event:e})=>e),target:"ChoosingStrategy"}}},ChoosingStrategy:{tags:["step:choose-strategy"],on:{"NAVIGATE.PREVIOUS":{description:"Go to Idle, and also tell firstFactor to go to Pending",target:"Idle",actions:(0,et.c)("secondFactor",{type:"NAVIGATE.PREVIOUS"})}}}}},ResetPassword:{tags:["step:reset-password"],invoke:{id:"resetPassword",src:"resetPasswordMachine",input:({context:e,self:t})=>({formRef:e.formRef,parent:t}),onDone:{actions:"raiseNext"}},on:{"RESET.STEP":{target:"ResetPassword",reenter:!0},NEXT:[{guard:"isComplete",actions:"setActive"},{guard:"statusNeedsFirstFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"FirstFactor"},{guard:"statusNeedsSecondFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"SecondFactor"}]}},Callback:{tags:["step:callback"],entry:(0,et.c)(rr,{type:"CALLBACK"}),on:{NEXT:[{guard:"hasOAuthError",actions:["setFormOAuthErrors",{type:"navigateInternal",params:{force:!0,path:"/"}}],target:"Start"},{guard:(0,eg.F)(["isLoggedIn","isComplete","hasAuthenticatedViaClerkJS"]),actions:"setActive"},{guard:"statusNeedsIdentifier",actions:"transfer"},{guard:"statusNeedsFirstFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"FirstFactor"},{guard:"statusNeedsSecondFactor",actions:{type:"navigateInternal",params:{path:"/continue"}},target:"SecondFactor"},{guard:"statusNeedsNewPassword",actions:{type:"navigateInternal",params:{path:"/reset-password"}},target:"ResetPassword"}]}},ChooseSession:{tags:["step:choose-session"],on:{"SESSION.SET_ACTIVE":{actions:{type:"setActive",params:({event:e})=>({id:e.id})}}}},Error:{tags:["step:error"],on:{NEXT:{target:"Start",actions:"clearFormErrors"}}},Hist:{type:"history",exit:"clearFormErrors"}}}),rd={firstFactor:"firstFactor",secondFactor:"secondFactor"},rp=tN("SignInChooseStrategyCtx");function rf({asChild:e,children:t,...r}){let n=tt.useActorRef(),s=tf(n,["step:verifications","step:first-factor","step:choose-strategy"],tp.all),i=tf(n,["step:verifications","step:second-factor","step:choose-strategy"],tp.all),o=e?es.DX:"div";return s||i?(0,f.jsx)(rp.Provider,{children:(0,f.jsx)(o,{...r,children:t})}):null}function rh({asChild:e,children:t,...r}){let n=tf(tt.useActorRef(),["step:verifications","step:first-factor","step:forgot-password"],tp.all),s=e?es.DX:"div";return n?(0,f.jsx)(rp.Provider,{children:(0,f.jsx)(s,{...r,children:t})}):null}s.forwardRef(({asChild:e,children:t,name:r,...n},i)=>{let o=tt.useActorRef(),a=o.getSnapshot(),l=a.context.clerk.client.signIn.status,c=[..."needs_first_factor"===l&&a.context.clerk.client.signIn.supportedFirstFactors||[],..."needs_second_factor"===l&&a.context.clerk.client.signIn.supportedSecondFactors||[]].find(e=>r===e.strategy),u=(0,J.d4)(a.children[rd.firstFactor]||a.children[rd.secondFactor],e=>{var t;return null==(t=null==e?void 0:e.context.currentFactor)?void 0:t.strategy}),d=s.useCallback(()=>o.send({type:"STRATEGY.UPDATE",factor:c}),[o,c]);if(u===r)return null;let p=e?es.DX:"button";return c?(0,f.jsx)(tl.Provider,{value:{strategy:r},children:(0,f.jsx)(p,{...e?{}:{type:"button"},...n,ref:i,onClick:d,children:t||c.strategy})}):null}).displayName="SignInSupportedStrategy";var rg=te("SignInResetPasswordCtx");function rm(e){return tf(tt.useActorRef(),"step:reset-password")?(0,f.jsx)(rv,{...e}):null}function rv(e){let t=to();return t?(0,f.jsx)(rg.Provider,{actorRef:t,children:(0,f.jsx)(e5,{flowActor:t,...e})}):null}function ry({children:e}){return tf(tt.useActorRef(),"step:callback")?e:null}var r_=te("SignInStartCtx");function rS(e){return tf(tt.useActorRef(),"step:start")?(0,f.jsx)(rE,{...e}):null}function rE(e){let t=tn();return t?(0,f.jsx)(r_.Provider,{actorRef:t,children:(0,f.jsx)(e5,{flowActor:t,...e})}):null}var rb=(e,t)=>!!e&&!!t&&(e===t||e.startsWith(`${t}_`)),rw=te("SignInFirstFactorCtx"),rx=te("SignInSecondFactorCtx"),rk=e=>{var t;return null==(t=e.context.currentFactor)?void 0:t.strategy};function rI({children:e,preferred:t,actorRef:r,...n}){let i=tt.useActorRef(),o=(0,J.d4)(r,rk),a=tf(i,["step:choose-strategy","step:forgot-password"]),l=(0,s.useCallback)(e=>!!o&&rb(o,e),[o]);return(0,f.jsx)(tc.Provider,{value:{current:o,preferred:t,isActive:l},children:a.active?null:(0,f.jsx)(e5,{flowActor:r,...n,children:e})})}function rA(e){let{activeTags:t}=tf(tt.useActorRef(),["step:first-factor","step:second-factor"]);return t.has("step:first-factor")?(0,f.jsx)(rR,{...e}):t.has("step:second-factor")?(0,f.jsx)(rT,{...e}):null}function rR(e){let t=ts();return t&&t?(0,f.jsx)(rw.Provider,{actorRef:t,children:(0,f.jsx)(rI,{actorRef:t,...e})}):null}function rT(e){let t=ti();return t&&t?(0,f.jsx)(rx.Provider,{actorRef:t,children:(0,f.jsx)(rI,{actorRef:t,...e})}):null}var rC={start:"start",verifications:"verifications","choose-strategy":"choose-strategy","choose-session":"choose-session","forgot-password":"forgot-password","reset-password":"reset-password","sso-callback":"sso-callback"};function rP(e){var t;switch(null==(t=(0,er.ho)().telemetry)||t.record((0,eo.we)("Elements_SignInStep",{name:e.name})),e.name){case rC.start:return(0,f.jsx)(rS,{...e});case rC.verifications:return(0,f.jsx)(rA,{...e});case rC["choose-strategy"]:return(0,f.jsx)(rf,{...e});case rC["forgot-password"]:return(0,f.jsx)(rh,{...e});case rC["reset-password"]:return(0,f.jsx)(rm,{...e});case rC["choose-session"]:return(0,f.jsx)(tD,{...e});case rC["sso-callback"]:return(0,f.jsx)(ry,{...e});default:throw new ek(`Invalid step name. Use: ${Object.keys(rC).join(",")}.`)}}var rN=te("SignUpContinueCtx");function rF(e){return tf(tb.useActorRef(),"step:continue")?(0,f.jsx)(rO,{...e}):null}function rO(e){let t=tk();return t?(0,f.jsx)(rN.Provider,{actorRef:t,children:(0,f.jsx)(e5,{flowActor:t,...e})}):null}function rU(e){let t=tb.useActorRef();return tf(t,"step:restricted")?(0,f.jsx)(e5,{flowActor:t,...e}):null}var rD=te("SignUpStartCtx");function rj(e){return tf(tb.useActorRef(),"step:start")?(0,f.jsx)(rL,{...e}):null}function rL(e){let t=tx();return t?(0,f.jsx)(rD.Provider,{actorRef:t,children:(0,f.jsx)(e5,{flowActor:t,...e})}):null}var rM=te("SignUpVerificationCtx");function r$(e){return tf(tb.useActorRef(),"step:verification")?(0,f.jsx)(rV,{...e}):null}function rV(e){let t=tI();return t?(0,f.jsx)(rM.Provider,{actorRef:t,children:(0,f.jsx)(e5,{flowActor:t,...e})}):null}var rW={start:"start",continue:"continue",verifications:"verifications",restricted:"restricted"};function rG(e){var t;switch(null==(t=(0,er.ho)().telemetry)||t.record((0,eo.we)("Elements_SignUpStep",{name:e.name})),e.name){case rW.start:return(0,f.jsx)(rj,{...e});case rW.continue:return(0,f.jsx)(rF,{...e});case rW.verifications:return(0,f.jsx)(r$,{...e});case rW.restricted:return(0,f.jsx)(rU,{...e});default:throw new ek("Invalid step name. Use 'start', 'continue', 'verifications', or 'restricted'.")}}function rH(e){return e.startsWith("provider:")}function rB(e){if("provider:metamask"===e)return"web3_metamask_signature";if("provider:coinbase_wallet"===e)return"web3_coinbase_wallet_signature";if("provider:okx_wallet"===e)return"web3_okx_wallet_signature";if("provider:saml"===e)return"saml";if("provider:enterprise_sso"===e)return"enterprise_sso";let t=e.replace("provider:","");return`oauth_${t}`}var rK={"sign-in":"signInUrl","sign-up":"signUpUrl"};function rq({navigate:e,children:t,...r}){let n=(0,em.cb)(),s=(0,er.ho)(),i=n.makeDestinationUrlWithPreservedQueryParameters(s.__internal_getOption(rK[e]));return"function"==typeof t?t({url:i}):(0,f.jsx)("a",{onClick:e=>{n&&(e.preventDefault(),n.push(i))},href:i,...r,children:t})}},4751:(e,t,r)=>{e.exports=r(414)},4786:(e,t,r)=>{"use strict";r.d(t,{SP:()=>i,Sx:()=>c});var n=r(4924);let s=new WeakMap;function i(e){return{config:e,start:(t,r)=>{let{self:n,system:i,emit:o}=r,a={receivers:void 0,dispose:void 0};s.set(n,a),a.dispose=e({input:t.input,system:i,self:n,sendBack:e=>
9{"stopped"!==n.getSnapshot().status&&n._parent&&i._relay(n,n._parent,e)},receive:e=>{a.receivers??=new Set,a.receivers.add(e)},emit:o})},transition:(e,t,r)=>{let i=s.get(r.self);return t.type===n.X?(e={...e,status:"stopped",error:void 0},i.dispose?.()):i.receivers?.forEach(e=>e(t)),e},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let o="xstate.promise.resolve",a="xstate.promise.reject",l=new WeakMap;function c(e){return{config:e,transition:(e,t,r)=>{if("active"!==e.status)return e;switch(t.type){case o:{let r=t.data;return{...e,status:"done",output:r,input:void 0}}case a:return{...e,status:"error",error:t.data,input:void 0};case n.X:return l.get(r.self)?.abort(),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:r,system:n,emit:s})=>{if("active"!==t.status)return;let i=new AbortController;l.set(r,i),Promise.resolve(e({input:t.input,system:n,self:r,signal:i.signal,emit:s})).then(e=>{"active"===r.getSnapshot().status&&(l.delete(r),n._relay(r,r,{type:o,data:e}))},e=>{"active"===r.getSnapshot().status&&(l.delete(r),n._relay(r,r,{type:a,data:e}))})},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}(function(e,t){;})(e=>void 0,void 0)},4860:(e,t,r)=>{"use strict";r.d(t,{jv:()=>u,d4:()=>c});var n=r(1355),s=n.useLayoutEffect,i=r(4924),o=r(5795);r(6830);let a=(e,t)=>{t(e);let r=e.getSnapshot().children;r&&Object.values(r).forEach(e=>{a(e,t)})};function l(e,t){return e===t}function c(e,t,r=l){let s=(0,n.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:r}=e.subscribe(t);return r},[e]),i=(0,n.useCallback)(()=>e?.getSnapshot(),[e]);return(0,o.useSyncExternalStoreWithSelector)(s,i,i,t,r)}function u(e,t){let r=n.createContext(null),o=r.Provider;function l({children:r,logic:l=e,machine:c,options:u}){if(c)throw Error('The "machine" prop has been deprecated. Please use "logic" instead.');let d=function(e,...[t,r]){let o=function(e,...[t]){let[[r,o],a]=(0,n.useState)(()=>{let r=(0,i.A)(e,t);return[e.config,r]});if(e.config!==r){let r=(0,i.A)(e,{...t,snapshot:o.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});a([e.config,r]),o=r}return s(()=>{o.logic.implementations=e.implementations}),o}(e,t);return(0,n.useEffect)(()=>{if(!r)return;let e=o.subscribe((0,i.L)(r));return()=>{e.unsubscribe()}},[r]),(0,n.useEffect)(()=>(o.start(),()=>{var e=o;let t=[];a(e,e=>{t.push([e,e.getSnapshot()]),e.observers=new Set});let r=e.system.getSnapshot?.();e.stop(),e.system._snapshot=r,t.forEach(([e,t])=>{e._processingStatus=0,e._snapshot=t})}),[o]),o}(l,{...t,...u});return n.createElement(o,{value:d,children:r})}function u(){let e=n.useContext(r);if(!e)throw Error(`You used a hook from "${l.displayName}" but it's not inside a <${l.displayName}> component.`);return e}return l.displayName="ActorProvider",{Provider:l,useActorRef:u,useSelector:function(e,t){return c(u(),e,t)}}}},4924:(e,t,r)=>{"use strict";r.d(t,{$:()=>C,A:()=>O,D:()=>q,E:()=>B,F:()=>Y,L:()=>x,M:()=>j,N:()=>o,O:()=>e$,P:()=>$,R:()=>G,S:()=>i,T:()=>P,U:()=>eD,V:()=>l,W:()=>d,X:()=>c,a:()=>b,b:()=>ea,c:()=>k,d:()=>ec,e:()=>z,f:()=>el,g:()=>eo,h:()=>ei,i:()=>ee,j:()=>em,k:()=>eU,l:()=>en,m:()=>v,n:()=>eI,o:()=>function e(t,r,n,s){if("string"==typeof r){let e=eh(t,r).next(n,s);return e&&e.length?e:t.next(n,s)}if(1===Object.keys(r).length){let i=Object.keys(r),o=e(eh(t,i[0]),r[i[0]],n,s);return o&&o.length?o:t.next(n,s)}let i=[];for(let o of Object.keys(r)){let a=r[o];if(!a)continue;let l=e(eh(t,o),a,n,s);l&&i.push(...l)}return i.length?i:t.next(n,s)},p:()=>ek,q:()=>p,r:()=>eT,s:()=>eb,t:()=>_,u:()=>ef,v:()=>g,w:()=>es,x:()=>eg,y:()=>ej,z:()=>I});let n=e=>{if("undefined"==typeof window)return;let t=function(){let e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r.g?r.g:void 0;if(e.__xstate__)return e.__xstate__}();t&&t.register(e)};class s{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}}let i=".",o="",a="xstate.init",l="xstate.error",c="xstate.stop";function u(e,t){return{type:`xstate.done.state.${e}`,output:t}}function d(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}
9function p(e){return{type:a,input:e}}function f(e){setTimeout(()=>{throw e})}let h="function"==typeof Symbol&&Symbol.observable||"@@observable";function g(e){if(E(e))return e;let t=[],r="";for(let n=0;n<e.length;n++){switch(e.charCodeAt(n)){case 92:r+=e[n+1],n++;continue;case 46:t.push(r),r="";continue}r+=e[n]}return t.push(r),t}function m(e){var t;return(t=e)&&"object"==typeof t&&"machine"in t&&"value"in t?e.value:"string"!=typeof e?e:function(e){if(1===e.length)return e[0];let t={},r=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)r[e[t]]=e[t+1];else{let n=r;r={},n[e[t]]=r}return t}(g(e))}function v(e,t){let r={},n=Object.keys(e);for(let s=0;s<n.length;s++){let i=n[s];r[i]=t(e[i],i,e,s)}return r}function y(e){return E(e)?e:[e]}function _(e){var t;return void 0===e?[]:E(t=e)?t:[t]}function S(e,t,r,n){return"function"==typeof e?e({context:t,event:r,self:n}):e}function E(e){return Array.isArray(e)}function b(e){var t;return(E(t=e)?t:[t]).map(e=>void 0===e||"string"==typeof e?{target:e}:e)}function w(e){if(void 0!==e&&""!==e)return _(e)}function x(e,t,r){let n="object"==typeof e,s=n?e:void 0;return{next:(n?e.next:e)?.bind(s),error:(n?e.error:t)?.bind(s),complete:(n?e.complete:r)?.bind(s)}}function k(e,t){return`${t}.${e}`}function I(e,t){let r=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!r)return e.implementations.actors[t];let[,n,s]=r,i=e.getStateNodeById(s).config.invoke;return(Array.isArray(i)?i[n]:i).src}function A(e,t){return`${e.sessionId}.${t}`}let R=0,T=!1,C=1,P=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),N={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class F{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new s(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=P.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this._systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let r={...N,...t},{clock:n,logger:i,parent:o,syncSnapshot:a,id:l,systemId:c,inspect:u}=r;this.system=o?o.system:function(e,t){let r=new Map,n=new Map,s=new WeakMap,i=new Set,o={},{clock:a,logger:l}=t,c={schedule:(e,t,r,n,s=Math.random().toString(36).slice(2))=>{let i={source:e,target:t,event:r,delay:n,id:s,startedAt:Date.now()},l=A(e,s);u._snapshot._scheduledEvents[l]=i;let c=a.setTimeout(()=>{delete o[l],delete u._snapshot._scheduledEvents[l],u._relay(e,t,r)},n);o[l]=c},cancel:(e,t)=>{let r=A(e,t),n=o[r];delete o[r],delete u._snapshot._scheduledEvents[r],void 0!==n&&a.clearTimeout(n)},cancelAll:e=>{for(let t in u._snapshot._scheduledEvents){let r=u._snapshot._scheduledEvents[t];r.source===e&&c.cancel(e,r.id)}}},u={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${R++}`,_register:(e,t)=>(r.set(e,t),e),_unregister:e=>{r.delete(e.sessionId);let t=s.get(e);void 0!==t&&(n.delete(t),s.delete(e))},get:e=>n.get(e),_set:(e,t)=>{let r=n.get(e);if(r&&r!==t)throw Error(`Actor with system ID '${e}' already exists.`);n.set(e,t),s.set(t,e)},inspect:e=>{let t=x(e);return i.add(t),{unsubscribe(){i.delete(t)}}},_sendInspectionEvent:t=>{if(!i.size)return;let r={...t,rootId:e.sessionId};i.forEach(e=>e.next?.(r))},_relay:(e,t,r)=>{u._sendInspectionEvent({type:"@xstate.event",sourceRef:e,actorRef:t,event:r}),t._send(r)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...u._snapshot._scheduledEvents}}),start:()=>{let e=u._snapshot._scheduledEvents;for(let t in u._snapshot._scheduledEvents={},e){let{source:r,target:n,event:s,delay:i,id:o}=e[t];c.schedule(r,n,s,i,o)}},_clock:a,_logger:l};return u}(this,{clock:n,logger:i}),u&&!o&&this.system.inspect(x(u)),this.sessionId=this.system._bookId(),this.id=l??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=r,this.src=r.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:e=>{this._deferred.push(e)},system:this.system,stopChild:e=>
9{if(e._parent!==this)throw Error(`Cannot stop child actor ${e.id} of ${this.id} because it is not a child`);e._stop()},emit:e=>{let t=this.eventListeners.get(e.type),r=this.eventListeners.get("*");if(t||r)for(let n of[...t?t.values():[],...r?r.values():[]])n(e)},actionExecutor:e=>{let t=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:e.type,params:e.params}}),!e.exec)return;let t=T;try{T=!0,e.exec(e.info,e.params)}finally{T=t}};this._processingStatus===P.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this._systemId=c,this.system._set(c,this)),this._initState(t?.snapshot??t?.state),c&&"active"!==this._snapshot.status&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:"error",output:void 0,error:e}}}update(e,t){let r;for(this._snapshot=e;r=this._deferred.shift();)try{r()}catch(t){this._deferred.length=0,this._snapshot={...e,status:"error",error:t}}switch(this._snapshot.status){case"active":for(let t of this.observers)try{t.next?.(e)}catch(e){f(e)}break;case"done":var n;for(let t of this.observers)try{t.next?.(e)}catch(e){f(e)}this._stopProcedure(),this._complete(),this._doneEvent=(n=this.id,{type:`xstate.done.actor.${n}`,output:this._snapshot.output,actorId:n}),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error)}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:t,snapshot:e})}subscribe(e,t,r){let n=x(e,t,r);if(this._processingStatus!==P.Stopped)this.observers.add(n);else switch(this._snapshot.status){case"done":try{n.complete?.()}catch(e){f(e)}break;case"error":{let e=this._snapshot.error;if(n.error)try{n.error(e)}catch(e){f(e)}else f(e)}}return{unsubscribe:()=>{this.observers.delete(n)}}}on(e,t){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));let n=t.bind(void 0);return r.add(n),{unsubscribe:()=>{r.delete(n)}}}start(){if(this._processingStatus===P.Running)return this;this._syncSnapshot&&this.subscribe({next:e=>{"active"===e.status&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:e})},error:()=>{}}),this.system._register(this.sessionId,this),this._systemId&&this.system._set(this._systemId,this),this._processingStatus=P.Running;let e=p(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(e){return this._snapshot={...this._snapshot,status:"error",error:e},this._error(e),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,r;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){r={err:e}}if(r){let{err:e}=r;this._snapshot={...this._snapshot,status:"error",error:e},this._error(e);return}this.update(t,e),e.type===c&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===P.Stopped||((this.mailbox.clear(),this._processingStatus===P.NotStarted)?this._processingStatus=P.Stopped:this.mailbox.enqueue({type:c})),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(e){f(e)}this.observers.clear()}_reportError(e){if(!this.observers.size){this._parent||f(e);return}let t=!1;for(let r of this.observers){let n=r.error;t||=!n;try{n?.(e)}catch(e){f(e)}}this.observers.clear(),t&&f(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,d(this.id,e))}_stopProcedure(){return this._processingStatus!==P.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new s(this._process.bind(this)),this._processingStatus=P.Stopped,this.system._unregister(this)),this}_send(e){this._processingStatus!==P.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&("function"==typeof e?e:n)(this)}toJSON(){return{xstate$$type:C,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[h](){return this}getSnapshot(){return this._snapshot}}function O(e,...[t]){return new F(e,t)}function U(e,t,r,n,{sendId:s}){return[t,{sendId:"function"==typeof s?s(r,n):s},void 0]}function D(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function j(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=U,t.execute=D,t}function L(e,t,r,n,{id:s,systemId:i,src:o,input:a,syncSnapshot:l}){let c,u,d="string"==typeof o?I(t.machine,o):o,p="function"==typeof s?s(r):s;return d&&(u="function"==typeof a?a({context:t.context,event:r.event,self:e.self}):a,c=O(d,{id:p,src:o,parent:e.self,syncSnapshot:l,systemId:i,input:u})),[eD(t,{children:{...t.children,[p]:c}}),{id:s,systemId:i,actorRef:c,src:o,input:u},void 0]}function M(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==P.Stopped&&t.start()})}function $(...[e,{id:t,systemId:r,input:n,syncSnapshot:s=!1}={}]){function i(e,t){}return i.type="xstate.spawnChild",i.id=t,i.systemId=r,i.src=e,i.input=n,i.syncSnapshot=s,i.resolve=L,i.execute=M,i}function V(e,t,r,n,{actorRef:s}){let i="function"==typeof s?s(r,n):s,o="string"==typeof i?t.children[i]:i,a=t.children;return o&&(a={...a},delete a[o.id]),[eD(t,{children:a}),o,void 0]}function W(e,t){if(t){if(e.system._unregister(t),t._processingStatus!==P.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function G(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=V,t.execute=W,t}function H(e,{context:t,event:r},{guards:n}){return!z(n[0],t,r,e)}function B(e){function t(e,t){return!1}return t.check=H,t.guards=[e],t}function K(e,{context:t,event:r},{guards:n}){return n.every(n=>z(n,t,r,e))}function q(e){function t(e,t){return!1}return t.check=K,t.guards=e,t}function X(e,{context:t,event:r},{guards:n}){return n.some(n=>z(n,t,r,e))}function Y(e){function t(e,t){return!1}return t.check=X,t.guards=e,t}function z(e,t,r,n){let{machine:s}=n,i="function"==typeof e,o=i?e:s.implementations.guards["string"==typeof e?e:e.type];if(!i&&!o)throw Error(`Guard '${"string"==typeof e?e:e.type}' is not implemented.'.`);if("function"!=typeof o)return z(o,t,r,n);let a={context:t,event:r},l=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:t,event:r}):e.params:void 0;return"check"in o?o.check(n,a,o):o(a,l)}let J=e=>"atomic"===e.type||"final"===e.type;function Q(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function Z(e,t){let r=[];if(t===e)return r;let n=e.parent;for(;n&&n!==t;)r.push(n),n=n.parent;return r}function ee(e){let t=new Set(e),r=et(t);for(let e of t)if("compound"!==e.type||r.get(e)&&r.get(e).length){if("parallel"===e.type){for(let r of Q(e))if("history"!==r.type&&!t.has(r))for(let e of ep(r))t.add(e)}}
9else ep(e).forEach(e=>t.add(e));for(let e of t){let r=e.parent;for(;r;)t.add(r),r=r.parent}return t}function et(e){let t=new Map;for(let r of e)t.has(r)||t.set(r,[]),r.parent&&(t.has(r.parent)||t.set(r.parent,[]),t.get(r.parent).push(r));return t}function er(e,t){return function e(t,r){let n=r.get(t);if(!n)return{};if("compound"===t.type){let e=n[0];if(!e)return{};if(J(e))return e.key}let s={};for(let t of n)s[t.key]=e(t,r);return s}(e,et(ee(t)))}function en(e,t){return"compound"===t.type?Q(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?Q(t).every(t=>en(e,t)):"final"===t.type}let es=e=>"#"===e[0];function ei(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>{if("*"===e)return!0;if(!e.endsWith(".*"))return!1;let r=e.split("."),n=t.split(".");for(let e=0;e<r.length;e++){let t=r[e],s=n[e];if("*"===t)return e===r.length-1;if(t!==s)return!1}return!0}).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function eo(e){let t=e.config.after;if(!t)return[];let r=t=>{var r;let n=(r=e.id,{type:`xstate.after.${t}.${r}`}),s=n.type;return e.entry.push(e$(n,{id:s,delay:t})),e.exit.push(j(s)),s};return Object.keys(t).flatMap(e=>{let n=t[e],s=Number.isNaN(+e)?e:+e,i=r(s);return _("string"==typeof n?{target:n}:n).map(e=>({...e,event:i,delay:s}))}).map(t=>{let{delay:r}=t;return{...ea(e,t.event,t),delay:r}})}function ea(e,t,r){let n=w(r.target),s=r.reenter??!1,o=function(e,t){if(void 0!==t)return t.map(t=>{if("string"!=typeof t)return t;if(es(t))return e.machine.getStateNodeById(t);let r=t[0]===i;if(r&&!e.parent)return eg(e,t.slice(1));let n=r?e.key+t:t;if(e.parent)try{return eg(e.parent,n)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':
10${t.message}`)}else throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}(e,n),a={...r,actions:_(r.actions),guard:r.guard,target:o,source:e,reenter
10:s,eventType:t,toJSON:()=>({...a,source:`#${e.id}`,target:o?o.map(e=>`#${e.id}`):void 0})};return a}function el(e){let t=new Map;if(e.config.on)for(let r of Object.keys(e.config.on)){if(r===o)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let n=e.config.on[r];t.set(r,b(n).map(t=>ea(e,r,t)))}if(e.config.onDone){let r=`xstate.done.state.${e.id}`;t.set(r,b(e.config.onDone).map(t=>ea(e,r,t)))}for(let r of e.invoke){if(r.onDone){let n=`xstate.done.actor.${r.id}`;t.set(n,b(r.onDone).map(t=>ea(e,n,t)))}if(r.onError){let n=`xstate.error.actor.${r.id}`;t.set(n,b(r.onError).map(t=>ea(e,n,t)))}if(r.onSnapshot){let n=`xstate.snapshot.${r.id}`;t.set(n,b(r.onSnapshot).map(t=>ea(e,n,t)))}}for(let r of e.after){let e=t.get(r.eventType);e||(e=[],t.set(r.eventType,e)),e.push(r)}return t}function ec(e,t){let r="string"==typeof t?e.states[t]:t?e.states[t.target]:void 0;if(!r&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let n={source:e,actions:t&&"string"!=typeof t?_(t.actions):[],eventType:null,reenter:!1,target:r?[r]:[],toJSON:()=>({...n,source:`#${e.id}`,target:r?[`#${r.id}`]:[]})};return n}function eu(e){let t=w(e.config.target);return t?{target:t.map(t=>"string"==typeof t?eg(e.parent,t):t)}:e.parent.initial}function ed(e){return"history"===e.type}function ep(e){let t=ef(e);for(let r of t)for(let n of Z(r,e))t.add(n);return t}function ef(e){let t=new Set;return!function e(r){if(!t.has(r)){if(t.add(r),"compound"===r.type)e(r.initial.target[0]);else if("parallel"===r.type)for(let t of Q(r))e(t)}}(e),t}function eh(e,t){if(es(t))return e.machine.getStateNodeById(t);if(!e.states)throw Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let r=e.states[t];if(!r)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return r}function eg(e,t){if("string"==typeof t&&es(t))try{return e.machine.getStateNodeById(t)}catch{}let r=g(t).slice(),n=e;for(;r.length;){let e=r.shift();if(!e.length)break;n=eh(n,e)}return n}function em(e,t){if("string"==typeof t){let r=e.states[t];if(!r)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,r]}let r=Object.keys(t),n=r.map(t=>eh(e,t)).filter(Boolean);return[e.machine.root,e].concat(n,r.reduce((r,n)=>{let s=eh(e,n);if(!s)return r;let i=em(s,t[n]);return r.concat(i)},[]))}function ev(e,t){let r=e;for(;r.parent&&r.parent!==t;)r=r.parent;return r.parent===t}function ey(e,t,r){let n=new Set;for(let s of e){let e=!1,i=new Set;for(let o of n)if(function(e,t){let r=new Set(e),n=new Set(t);for(let e of r)if(n.has(e))return!0;for(let e of n)if(r.has(e))return!0;return!1}(eE([s],t,r),eE([o],t,r)))if(ev(s.source,o.source))i.add(o);else{e=!0;break}if(!e){for(let e of i)n.delete(e);n.add(s)}}return Array.from(n)}function e_(e,t){if(!e.target)return[];let r=new Set;for(let n of e.target)if(ed(n))if(t[n.id])for(let e of t[n.id])r.add(e);else for(let e of e_(eu(n),t))r.add(e);else r.add(n);return[...r]}function eS(e,t){let r=e_(e,t);if(!r)return;if(!e.reenter&&r.every(t=>t===e.source||ev(t,e.source)))return e.source;let n=function(e){let[t,...r]=e;for(let e of Z(t,void 0))if(r.every(t=>ev(t,e)))return e}(r.concat(e.source));return n||(e.reenter?void 0:e.source.machine.root)}function eE(e,t,r){let n=new Set;for(let s of e)if(s.target?.length){let e=eS(s,r);for(let r of(s.reenter&&s.source===e&&n.add(e),t))ev(r,e)&&n.add(r)}return[...n]}function eb(e,t,r,n,s,i){if(!e.length)return t;let o=new Set(t._nodes),a=t.historyValue,l=ey(e,o,a),c=t;s||([c,a]=function(e,t,r,n,s,i,o,a){let l,c=e,u=eE(n,s,i);for(let e of(u.sort((e,t)=>t.order-e.order),u))for(let t of function(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>"history"===e.type)}(e)){let r;r="deep"===t.history?t=>J(t)&&ev(t,e):t=>t.parent===e,(l??={...i})[t.id]=Array.from(s).filter(r)}for(let e of u)c=ek(c,t,r,[...e.exit,...e.invoke.map(e=>G(e.id))],o,void 0),s.delete(e);return[c,l||i]}(c,n,r,l,o,a,i,r.actionExecutor)),c=function(e,t,r,n,s,i,o,a){let l=e,c=new Set,d=new Set;(function(e,t,r,n){for(let s of e){let e=eS(s,t);for(let i of s.target||[])!ed(i)&&(s.source!==i||s.source!==e||s.reenter)&&(n.add(i),r.add(i)),ew(i,t,r,n);for(let i of e_(s,t)){let o=Z(i,e);e?.type==="parallel"&&o.push(e),ex(n,t,r,o,!s.source.parent&&s.reenter?void 0:e)}}})(n,o,d,c),a&&d.add(e.machine.root);let p=new Set;for(let e of[...c].sort((e,t)=>
10e.order-t.order)){s.add(e);let n=[];for(let t of(n.push(...e.entry),e.invoke))n.push($(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(d.has(e)){let t=e.initial.actions;n.push(...t)}if(l=ek(l,t,r,n,i,e.invoke.map(e=>e.id)),"final"===e.type){let n=e.parent,o=n?.type==="parallel"?n:n?.parent,a=o||e;for(n?.type==="compound"&&i.push(u(n.id,void 0!==e.output?S(e.output,l.context,t,r.self):void 0));o?.type==="parallel"&&!p.has(o)&&en(s,o);)p.add(o),i.push(u(o.id)),a=o,o=o.parent;if(o)continue;l=eD(l,{status:"done",output:function(e,t,r,n,s){if(void 0===n.output)return;let i=u(s.id,void 0!==s.output&&s.parent?S(s.output,e.context,t,r.self):void 0);return S(n.output,e.context,i,r.self)}(l,t,r,l.machine.root,a)})}}return l}(c=ek(c,n,r,l.flatMap(e=>e.actions),i,void 0),n,r,l,o,i,a,s);let d=[...o];"done"===c.status&&(c=ek(c,n,r,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),i,void 0));try{if(a===t.historyValue&&function(e,t){if(e.length!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}(t._nodes,o))return c;return eD(c,{_nodes:d,historyValue:a})}catch(e){throw e}}function ew(e,t,r,n){var s,i,o,a;if(ed(e))if(t[e.id]){let o=t[e.id];for(let e of o)n.add(e),ew(e,t,r,n);for(let a of o){s=a,i=e.parent,ex(n,t,r,Z(s,i))}}else{let s=eu(e);for(let i of s.target)n.add(i),s===e.parent?.initial&&r.add(e.parent),ew(i,t,r,n);for(let i of s.target){o=i,a=e.parent,ex(n,t,r,Z(o,a))}}else if("compound"===e.type){let[s]=e.initial.target;ed(s)||(n.add(s),r.add(s)),ew(s,t,r,n),ex(n,t,r,Z(s,e))}else if("parallel"===e.type)for(let s of Q(e).filter(e=>!ed(e)))[...n].some(e=>ev(e,s))||(ed(s)||(n.add(s),r.add(s)),ew(s,t,r,n))}function ex(e,t,r,n,s){for(let i of n)if((!s||ev(i,s))&&e.add(i),"parallel"===i.type)for(let n of Q(i).filter(e=>!ed(e)))[...e].some(e=>ev(e,n))||(e.add(n),ew(n,t,r,e))}function ek(e,t,r,n,s,i){let o=i?[]:void 0,a=function e(t,r,n,s,i,o){let{machine:a}=t,l=t;for(let t of s){var c;let s="function"==typeof t,u=s?t:(c="string"==typeof t?t:t.type,a.implementations.actions[c]),d={context:l.context,event:r,self:n.self,system:n.system},p=s||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:l.context,event:r}):t.params:void 0;if(!u||!("resolve"in u)){n.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:d,params:p,exec:u});continue}let[f,h,g]=u.resolve(n,l,d,p,u,i);l=f,"retryResolve"in u&&o?.push([u,h]),"execute"in u&&n.actionExecutor({type:u.type,info:d,params:h,exec:u.execute.bind(null,n,h)}),g&&(l=e(l,r,n,g,i,o))}return l}(e,t,r,n,{internalQueue:s,deferredActorIds:i},o);return o?.forEach(([e,t])=>{e.retryResolve(r,a,t)}),a}function eI(e,t,r,n){let s=e,i=[];function o(e,t,n){r.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:r.self,event:t,snapshot:e,_transitions:n}),i.push(e)}if(t.type===c)return o(s=eD(eA(s,t,r),{status:"stopped"}),t,[]),{snapshot:s,microstates:i};let l=t;if(l.type!==a){let t=l,a=t.type.startsWith("xstate.error.actor"),c=eR(t,s);if(a&&!c.length)return o(s=eD(e,{status:"error",error:t.error}),t,[]),{snapshot:s,microstates:i};o(s=eb(c,e,r,l,!1,n),t,c)}let u=!0;for(;"active"===s.status;){let e=u?function(e,t){let r=new Set;for(let n of e._nodes.filter(J))e:for(let s of[n].concat(Z(n,void 0)))if(s.always){for(let n of s.always)if(void 0===n.guard||z(n.guard,e.context,t,e)){r.add(n);break e}}return ey(Array.from(r),new Set(e._nodes),e.historyValue)}(s,l):[],t=e.length?s:void 0;if(!e.length){if(!n.length)break;e=eR(l=n.shift(),s)}u=(s=eb(e,s,r,l,!1,n))!==t,o(s,l,e)}return"active"!==s.status&&eA(s,l,r),{snapshot:s,microstates:i}}function eA(e,t,r){return ek(e,t,r,Object.values(e.children).map(e=>G(e)),[],void 0)}function eR(e,t){return t.machine.getTransitionData(t,e)}function eT(e,t){let r=ee(em(e,t));return er(e,[...r])}let eC=function(e){return function e(t,r){let n=m(t),s=m(r);return"string"==typeof s?"string"==typeof n&&s===n:"string"==typeof n?n in s:Object.keys(n).every(t=>t in s&&e(n[t],s[t]))}(e,this.value)},eP=function(e){return this.tags.has(e)},eN=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eF=function(){let{_nodes:e,tags:t,machine:r,getMeta:n,toJSON:s,can:i,hasTag:o,matches:a,...l}=this;return{...l,tags:Array.from(t)}},eO=function(){return this._nodes.reduce((e,t)=>
10(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function eU(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:er(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:eC,hasTag:eP,can:eN,getMeta:eO,toJSON:eF}}function eD(e,t={}){return eU({...e,...t},e.machine)}function ej(e,t){let{_nodes:r,tags:n,machine:s,children:i,context:o,can:a,hasTag:l,matches:c,getMeta:u,toJSON:d,...p}=e,f={};for(let e in i){let r=i[e];f[e]={snapshot:r.getPersistedSnapshot(t),src:r.src,systemId:r._systemId,syncSnapshot:r._syncSnapshot}}return{...p,context:function e(t){let r;for(let n in t){let s=t[n];if(s&&"object"==typeof s)if("sessionId"in s&&"send"in s&&"ref"in s)(r??=Array.isArray(t)?t.slice():{...t})[n]={xstate$$type:C,id:s.id};else{let i=e(s);i!==s&&((r??=Array.isArray(t)?t.slice():{...t})[n]=i)}}return r??t}(o),children:f}}function eL(e,t,r,n,{event:s,id:i,delay:o},{internalQueue:a}){let l,c=t.machine.implementations.delays;if("string"==typeof s)throw Error(`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`);let u="function"==typeof s?s(r,n):s;if("string"==typeof o){let e=c&&c[o];l="function"==typeof e?e(r,n):e}else l="function"==typeof o?o(r,n):o;return"number"!=typeof l&&a.push(u),[t,{event:u,id:i,delay:l},void 0]}function eM(e,t){let{event:r,delay:n,id:s}=t;if("number"==typeof n){e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,r,n,s)});return}}function e$(e,t){function r(e,t){}return r.type="xstate.raise",r.event=e,r.id=t?.id,r.delay=t?.delay,r.resolve=eL,r.execute=eM,r}},5342:(e,t,r)=>{"use strict";r.d(t,{Ok:()=>f,cY:()=>d});var n,s,i=r(4288),o=r(1355),a=r(1807),l=r(4751);r(9168);var c=class{constructor(e){this.name="VirtualRouter",this.mode="virtual",(0,i.VK)(this,n),(0,i.VK)(this,s,new Set);let t="undefined"==typeof window?"https://clerk.dummy":window.location.origin;(0,i.OV)(this,n,new URL(null!=e?e:"/",t))}push(e){let t=new URL((0,i.S7)(this,n).toString());t.pathname=e,(0,i.OV)(this,n,t),this.emit()}replace(e){this.push(e)}shallowPush(e){this.push(e)}pathname(){return(0,i.S7)(this,n).pathname}searchParams(){return(0,i.S7)(this,n).searchParams}subscribe(e){return(0,i.S7)(this,s).add(e),()=>(0,i.S7)(this,s).delete(e)}emit(){(0,i.S7)(this,s).forEach(e=>e((0,i.S7)(this,n)))}getSnapshot(){return(0,i.S7)(this,n)}};n=new WeakMap,s=new WeakMap;var u=new c("/"),d=()=>{let e=(0,o.useSyncExternalStore)(u.subscribe.bind(u),u.getSnapshot.bind(u));return{mode:u.mode,name:u.name,pathname:()=>e.pathname,push:u.push.bind(u),replace:u.replace.bind(u),searchParams:()=>e.searchParams,shallowPush:u.shallowPush.bind(u)}},p=()=>{let e=o.useRef(),t=(0,l.useRouter)();if(t)if(e.current)return e.current;else return e.current=t.pathname.replace(/\/\[\[\.\.\..*/,""),e.current;let r=((0,a.usePathname)()||"").split("/").filter(Boolean),n=Object.values((0,a.useParams)()||{}).filter(e=>Array.isArray(e)).flat(1/0);return e.current||(e.current=`/${r.slice(0,r.length-n.length).join("/")}`),e.current},f=()=>{let e=(0,a.useRouter)(),t=(0,a.usePathname)(),r=(0,a.useSearchParams)(),n=p(),s="undefined"!=typeof window&&window.next&&window.next.version>=i.rX;return{mode:"path",name:"NextRouter",push:t=>e.push(t),replace:t=>s?window.history.replaceState(null,"",t):e.replace(t),shallowPush:t=>s?window.history.pushState(null,"",t):e.push(t,{}),pathname:()=>t,searchParams:()=>r,inferredBasePath:()=>n}}},5606:(e,t,r)=>{"use strict";r.d(t,{v:()=>s});var n=new Set,s={warnOnce:e=>{n.has(e)||(n.add(e),console.warn(e))},logOnce:e=>{n.has(e)||(console.log(e),n.add(e))}};r(2913)},5795:(e,t,r)=>{"use strict";e.exports=r(7547)},6798:(e,t,r)=>{"use strict";r.d(t,{default:()=>s.a});var n=r(3117),s=r.n(n)},7418:(e,t,r)=>{"use strict";function n(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}r.d(t,{m:()=>n})},7547:(e,t,r)=>{"use strict";var n=r(1355),s=r(6830),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=s.useSyncExternalStore,a=n.useRef,l=n.useEffect,c=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var d=a(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;var f=o(e,(d=c(function(){function e(e){if(!l){if(l=!0,o=e,e=n(e),void 0!==s&&p.hasValue){var t=p.value;if(s(t,e))return a=t}return a=e}if(t=a,i(o,e))return t;var r=n(e);return void 0!==s&&s(t,r)?(o=e,t):(o=e,a=r)}var o,a,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,n,s]))[0],d[1]);return l(function(){p.hasValue=!0,p.value=f},[f]),u(f),f}},8019:(e,t,r)=>{"use strict";r.d(t,{sF:()=>n.sF,zz:()=>n.zz});var n=r(4142);
10r(2913)},8124:(e,t,r)=>{"use strict";r.d(t,{s:()=>o,t:()=>i});var n=r(1355);function s(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function i(...e){return t=>{let r=!1,n=e.map(e=>{let n=s(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():s(e[t],null)}}}}function o(...e){return n.useCallback(i(...e),e)}},9168:(e,t,r)=>{"use strict";r.d(t,{Ix:()=>u,_s:()=>a,cb:()=>c});var n=r(9909);r(2913);var s=r(1355),i=["after_sign_in_url","after_sign_up_url","redirect_url"];function o(e){return(0,n.ae)((0,n.GP)(e))}var a=(0,s.createContext)(null),l=(0,s.createContext)(null);function c(){let e=(0,s.useContext)(l);if(!e)throw Error("clerk: Unable to locate ClerkRouter, make sure this is rendered within `<Router>`.");return e}function u({basePath:e,children:t,router:r}){let c=function(){let e=(0,s.useContext)(a);if(!e)throw Error("clerk: Unable to locate ClerkHostRouter, make sure this is rendered within `<ClerkHostRouterContext.Provider>`.");return e}(),u=function e(t,r="/"){let s=o(r);function a(e){if((0,n.vh)(e))return e;let r=new URL(e,window.location.origin),s=t.searchParams();return i.forEach(e=>{let t=s.get(e);t&&r.searchParams.set(e,t)}),`${r.pathname}${r.search}`}return{makeDestinationUrlWithPreservedQueryParameters:a,child:function(r){return e(t,`${s}${o(r)}`)},match:function(e,r){let n=e??(r&&"/");if(!n)throw Error("[clerk] router.match() requires either a path to match, or the index flag must be set to true.");let i=o(n);return o(`${s}${i}`)===o(t.pathname())},mode:t.mode,name:t.name,push:function(e){let r=a(e);return t.push(r)},replace:function(e){let r=a(e);return t.replace(r)},shallowPush:function(e){let r=a(e);return t.shallowPush(r)},pathname:function(){return t.pathname()},searchParams:function(){return t.searchParams()},basePath:s}}(r??c,e);return s.createElement(l.Provider,{value:u},t)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.