PageSourceSearch

https://pentewan.co.uk/c8f7fe3b0e41be846d5687592cf2018ff6e22687-08a383c2e76885c34772.js

js pentewan.co.uk collected 2026-10-10 01:31:22 UTC 67,245 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkheligan_campsite_mui_theme=self.webpackChunkheligan_campsite_mui_theme||[]).push([[906],{21359:function(t,e,n){n.r(e),n.d(e,{encodeIntoResult:function(){return l},stegaEncodeSourceMap:function(){return x},stegaEncodeSourceMap$1:function(){return E}});var s=n(31125);const r=/_key\s*==\s*['"](.*)['"]/;function o(t){if(!Array.isArray(t))throw new Error("Path is not an array");return t.reduce(((t,e,n)=>{const s=typeof e;if("number"===s)return`${t}[${e}]`;if("string"===s)return`${t}${0===n?"":"."}${e}`;if(function(t){return"string"==typeof t?r.test(t.trim()):"object"==typeof t&&"_key"in t}(e)&&e._key)return`${t}[_key=="${e._key}"]`;if(Array.isArray(e)){const[n,s]=e;return`${t}[${n}:${s}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(e)}\``)}),"")}const i={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},a={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function c(t){const e=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let s;for(;null!==(s=n.exec(t));)if(void 0===s[1])if(void 0===s[2])if(void 0===s[3]);else{const t=s[3].replace(/\\(\\')/g,(t=>a[t]));e.push({_key:t,_index:-1})}else e.push(parseInt(s[2],10));else{const t=s[1].replace(/\\(\\|f|n|r|t|')/g,(t=>a[t]));e.push(t)}return e}function u(t){return t.map((t=>{if("string"==typeof t||"number"==typeof t)return t;if(""!==t._key)return{_key:t._key};if(-1!==t._index)return t._index;throw new Error(`invalid segment:${JSON.stringify(t)}`)}))}function p(t,e){if(!e?.mappings)return;const n=function(t){return`$${t.map((t=>"string"==typeof t?`['${t.replace(/[\f\n\r\t'\\]/g,(t=>i[t]))}']`:"number"==typeof t?`[${t}]`:""!==t._key?`[?(@._key=='${t._key.replace(/['\\]/g,(t=>i[t]))}')]`:`[${t._index}]`)).join("")}`}(t.map((t=>{if("string"==typeof t||"number"==typeof t)return t;if(-1!==t._index)return t._index;throw new Error(`invalid segment:${JSON.stringify(t)}`)})));if(void 0!==e.mappings[n])return{mapping:e.mappings[n],matchedPath:n,pathSuffix:""};const s=Object.entries(e.mappings).filter((([t])=>n.startsWith(t))).sort((([t],[e])=>e.length-t.length));if(0==s.length)return;const[r,o]=s[0];return{mapping:o,matchedPath:r,pathSuffix:n.substring(r.length)}}function d(t){return"object"==typeof t&&null!==t}function h(t,e,n=[]){if(function(t){return null!==t&&Array.isArray(t)}(t))return t.map(((t,s)=>{if(d(t)){const r=t._key;if("string"==typeof r)return h(t,e,n.concat({_key:r,_index:s}))}return h(t,e,n.concat(s))}));if(d(t)){if("block"===t._type||"span"===t._type){const s={...t};return"block"===t._type?s.children=h(t.children,e,n.concat("children")):"span"===t._type&&(s.text=h(t.text,e,n.concat("text"))),s}return Object.fromEntries(Object.entries(t).map((([t,s])=>[t,h(s,e,n.concat(t))])))}return e(t,n)}function l(t,e,n){return h(t,((t,s)=>{if("string"!=typeof t)return t;const r=p(s,e);if(!r)return t;const{mapping:o,matchedPath:i}=r;if("value"!==o.type||"documentValue"!==o.source.type)return t;const a=e.documents[o.source.document],u=e.paths[o.source.path],d=c(i),h=c(u).concat(s.slice(d.length));return n({sourcePath:h,sourceDocument:a,resultPath:s,value:t})}))}const f=".",y=`drafts${f}`,g=`versions${f}`;function m(t){return t.startsWith(y)}function v(t){return t.startsWith(g)}function _(t){const{baseUrl:e,workspace:n="default",tool:s="default",id:r,type:i,path:a,projectId:c,dataset:p}=t;if(!e)throw new Error("baseUrl is required");if(!a)throw new Error("path is required");if(!r)throw new Error("id is required");if("/"!==e&&e.endsWith("/"))throw new Error("baseUrl must not end with a slash");const d="default"===n?void 0:n,h="default"===s?void 0:s,l=function(t){return v(t)?t.split(f).slice(2).join(f):m(t)?t.slice(y.length):t}(r),g=Array.isArray(a)?o(u(a)):a,_=new URLSearchParams({baseUrl:e,id:l,type:i,path:g});if(d&&_.set("workspace",d),h&&_.set("tool",h),c&&_.set("projectId",c),p&&_.set("dataset",p),function(t){return!m(t)&&!v(t)}(r))_.set("perspective","published");else if(v(r)){const t=function(t){if(!v(t))return;const[e,n,...s]=t.split(f);return n}(r);_.set("perspective",t)}const b=["/"===e?"":e];d&&b.push(d);const S=["mode=presentation",`id=${l}`,`type=${i}`,`path=${encodeURIComponent(g)}`];return h&&S.push(`tool=${h}`),b.push("intent","edit",`${S.join(";")}?${_}`),b.join("/")}const b=({sourcePath:t,resultPath:e,value:n})=>{if(/^\d{4}-\d{2}-\d{2}/.test(s=n)&&Date.parse(s)||function(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(n))return!1;var s;const r=t.at(-1);return!("slug"===t.at(-2)&&"current"===r||"string"==typeof r&&(r.startsWith("_")||r.endsWith("Id"))||t.some((t=>"meta"===t||"metadata"===t||"openGraph"===t||"seo"===t))||w(t)||w(e)||"string"==typeof r&&S.has(r))},S=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","textTheme","unit","url","username","variant","website"]);function w(t){return t.some((t=>"string"==typeof t&&null!==t.match(/type/i)))}const k=20;function x(t,e,n){const{filter:o,logger:i,enabled:a}=n;if(!a){const s="config.enabled must be true, don't call this function otherwise";throw i?.error?.(`[@sanity/client]: ${s}`,{result:t,resultSourceMap:e,config:n}),new TypeError(s)}if(!e)return i?.error?.("[@sanity/client]: Missing Content Source Map from response body",{result:t,resultSourceMap:e,config:n}),t;if(!n.studioUrl){const s="config.studioUrl must be defined";throw i?.error?.(`[@sanity/client]: ${s}`,{result:t,resultSourceMap:e,config:n}),new TypeError(s)}const c={encoded:[],skipped:[]}
1,u=l(t,e,(({sourcePath:t,sourceDocument:e,resultPath:r,value:a})=>{if(!1===("function"==typeof o?o({sourcePath:t,resultPath:r,filterDefault:b,sourceDocument:e,value:a}):b({sourcePath:t,resultPath:r,value:a})))return i&&c.skipped.push({path:I(t),value:`${a.slice(0,k)}${a.length>k?"...":""}`,length:a.length}),a;i&&c.encoded.push({path:I(t),value:`${a.slice(0,k)}${a.length>k?"...":""}`,length:a.length});const{baseUrl:u,workspace:p,tool:d}=function(t){let e="string"==typeof t?t:t.baseUrl;return"/"!==e&&(e=e.replace(/\/$/,"")),"string"==typeof t?{baseUrl:e}:{...t,baseUrl:e}}("function"==typeof n.studioUrl?n.studioUrl(e):n.studioUrl);if(!u)return a;const{_id:h,_type:l,_projectId:f,_dataset:y}=e;return(0,s.C)(a,{origin:"sanity.io",href:_({baseUrl:u,workspace:p,tool:d,id:h,type:l,path:t,...!n.omitCrossDatasetReferenceData&&{dataset:y,projectId:f}})},!1)}));if(i){const t=c.skipped.length,e=c.encoded.length;if((t||e)&&((i?.groupCollapsed||i.log)?.("[@sanity/client]: Encoding source map into result"),i.log?.(`[@sanity/client]: Paths encoded: ${c.encoded.length}, skipped: ${c.skipped.length}`)),c.encoded.length>0&&(i?.log?.("[@sanity/client]: Table of encoded paths"),(i?.table||i.log)?.(c.encoded)),c.skipped.length>0){const t=new Set;for(const{path:e}of c.skipped)t.add(e.replace(r,"0").replace(/\[\d+\]/g,"[]"));i?.log?.("[@sanity/client]: List of skipped paths",[...t.values()])}(t||e)&&i?.groupEnd?.()}return u}function I(t){return o(u(t))}var E=Object.freeze({__proto__:null,stegaEncodeSourceMap:x})},25548:function(t,e,n){n.d(e,{Fk:function(){return u},jF:function(){return c},v$:function(){return p}});var s=n(49288);const r={"handshake/syn":s.Tx,"handshake/syn-ack":s.Rr,"handshake/ack":s.IM,"channel/response":s._K,"channel/heartbeat":s.vd,"channel/disconnect":s.FS,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},o={[s.Tx]:"handshake/syn",[s.Rr]:"handshake/syn-ack",[s.IM]:"handshake/ack",[s._K]:"channel/response",[s.vd]:"channel/heartbeat",[s.FS]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},i=t=>{const{data:e}=t;return e&&"object"==typeof e&&"domain"in e&&"type"in e&&"from"in e&&"to"in e&&("sanity/channels"===e.domain&&(e.domain=s.V2),"overlays"===e.to&&(e.to="visual-editing"),"overlays"===e.from&&(e.from="visual-editing"),e.channelId=e.connectionId,delete e.connectionId,e.type=r[e.type]??e.type),t},a=({context:t},e)=>{const{sources:n,targetOrigin:r}=t,i=(t=>{const{channelId:e,...n}=t,r={...n,connectionId:e};return r.domain===s.V2&&(r.domain="sanity/channels"),"visual-editing"===r.to&&(r.to="overlays"),"visual-editing"===r.from&&(r.from="overlays"),r.type=o[r.type]??r.type,"channel/response"===r.type&&r.responseTo&&!r.data&&(r.data={responseTo:r.responseTo}),("handshake/syn"===r.type||"handshake/syn-ack"===r.type||"handshake/ack"===r.type)&&(r.data={id:r.connectionId}),r})(e.message);n.forEach((t=>{t.postMessage(i,{targetOrigin:r})}))},c=()=>({listen:(0,s.CC)(i),requestMachine:(0,s.tP)().provide({actions:{"send message":a}})});function u(){return window.self!==window.top}function p(){return!!window.opener}},32177:function(t,e,n){n.d(e,{X:function(){return c}});const s=["Value","Copy","Blank","ReturnIntoArray","ReturnIntoObject","ReturnIntoObjectSameKey","PushField","PushElement","PushParent","Pop","PushFieldCopy","PushFieldBlank","PushElementCopy","PushElementBlank","ReturnIntoObjectPop","ReturnIntoObjectSameKeyPop","ReturnIntoArrayPop","ObjectSetFieldValue","ObjectCopyField","ObjectDeleteField","ArrayAppendValue","ArrayAppendSlice","StringAppendString","StringAppendSlice"];class r{model;root;patch;i;inputStack;outputStack;constructor(t,e,n){this.model=t,this.root=e,this.patch=n,this.i=0,this.inputStack=[],this.outputStack=[]}read(){return this.patch[this.i++]}process(){for(this.inputStack.push({value:this.root}),this.outputStack.push({value:this.root});this.i<this.patch.length;){let t=this.read(),e=s[t];if(!e)throw new Error(`Unknown opcode: ${t}`);this[`process${e}`].apply(this)}let t=this.outputStack.pop();return this.finalizeOutput(t)}inputEntry(){return this.inputStack[this.inputStack.length-1]}inputKey(t,e){return t.keys||(t.keys=this.model.objectGetKeys(t.value).sort()),t.keys[e]}outputEntry(){return this.outputStack[this.outputStack.length-1]}outputArray(){let t=this.outputEntry();return t.writeValue||(t.writeValue=this.model.copyArray(t.value)),t.writeValue}outputObject(){let t=this.outputEntry();return t.writeValue||(t.writeValue=this.model.copyObject(t.value)),t.writeValue}outputString(){let t=this.outputEntry();return t.writeValue||(t.writeValue=this.model.copyString(t.value)),t.writeValue}finalizeOutput(t){return t.writeValue?this.model.finalize(t.writeValue):t.value}processValue(){let t=this.model.wrap(this.read());this.outputStack.push({value:t})}processCopy(){let t=this.inputEntry();this.outputStack.push({value:t.value})}processBlank(){this.outputStack.push({value:null})}processReturnIntoArray(){let t=this.outputStack.pop(),e=this.finalizeOutput(t),n=this.outputArray();this.model.arrayAppendValue(n,e)}processReturnIntoObject(){let t=this.read(),e=this.outputStack.pop(),n=this.finalizeOutput(e);n=this.model.markChanged(n);let s=this.outputObject();this.model.objectSetField(s,t,n)}processReturnIntoObjectSameKey(){let t=this.inputEntry(),e=this.outputStack.pop(),n=this.finalizeOutput(e),s=this.outputObject();this.model.objectSetField(s,t.key,n)}processPushField(){let t=this.read(),e=this.inputEntry(),n=this.inputKey(e,t),s=this.model.objectGetField(e.value,n);this.inputStack.push({value:s,key:n})}processPushElement(){let t=this.read(),e=this.inputEntry(),n=this.model.arrayGetElement(e.value,t);this.inputStack.push({value:n})}processPop(){this.inputStack.pop()}processPushFieldCopy(){this.processPushField(),this.processCopy()}processPushFieldBlank(){this.processPushField(),this.processBlank()}processPushElementCopy(){this.processPushElement(),this.processCopy()}processPushElementBlank(){this.processPushElement(),this.processBlank()}processReturnIntoObjectPop(){this.processReturnIntoObject(),this.processPop()}processReturnIntoObjectSameKeyPop(){this.processReturnIntoObjectSameKey(),this.processPop()}processReturnIntoArrayPop(){this.processReturnIntoArray(),this.processPop()}processObjectSetFieldValue(){this.processValue(),this.processReturnIntoObject()}processObjectCopyField(){this.processPushField(),this.processCopy(),this.processReturnIntoObjectSameKey(),this.processPop()}processObjectDeleteField(){let t=this.read(),e=this.inputEntry(),n=this.inputKey(e,t),s=this.outputObject();this.model.objectDeleteField(s,n)}processArrayAppendValue(){let t=this.model.wrap(this.read()),e=this.outputArray();this.model.arrayAppendValue(e,t)}processArrayAppendSlice(){let t=this.read(),e=this.read(),n=this.outputArray(),s=this.inputEntry().value;this.model.arrayAppendSlice(n,s,t,e)}processStringAppendString(){let t=this.model.wrap(this.read()),e=this.outputString();this.model.stringAppendValue(e,t)}processStringAppendSlice(){let t=this.read(),e=this.read(),n=this.outputString(),s=this.inputEntry().value;this.model.stringAppendSlice(n,s,t,e)}}function o(t){return t>>16?4:t>>11?3:t>>7?2:1}function i(t,e,n=0){let s=n,r=0;for(r=n;s<e;r++){let e=o(t.codePointAt(r));4===e&&r++,s+=e}return r}class a{wrap(t){return t}finalize(t){return Array.isArray(t)?t:t.data}markChanged(t){return t}objectGetKeys(t){return Object.keys(t)}objectGetField(t,e){return t[e]}arrayGetElement(t,e){return t[e]}copyObject(t){let e={type:"object",data:{}};if(null!==t)for(let[n,s]of Object.entries(t))e.data[n]=s;return e}copyArray(t){return null===t?[]:t.slice()}copyString(t){return{type:"string",data:null===t?"":t}}objectSetField(t,e,n){t.data[e]=n}objectDeleteField(t,e){delete t.data[e]}arrayAppendValue(t,e){t.push(e)}arrayAppendSlice(t,e,n,s){t.push(...e.slice(n,s))}stringAppendSlice(t,e,n,s){const r=e,o=i(r,n),a=i(r,s,o);t.data+=r.slice(o,a)}stringAppendValue(t,e){t.data+=e}}function c(t,e){let n=t;return new r(new a,n,e).process()}},32433:function(t,e,n){n.d(e,{DT:function(){return o},mj:function(){return h}});n(76163);var s=n(70201),r=n(46420);function o(t,e){const n=(0,s.t)(e);if(!n.includes(t.type)){const e=1===n.length?`type "${n[0]}"`:`one of types "${n.join('", "')}"`;throw new Error(`Expected event ${JSON.stringify(t)} to have ${e}`)}}const i=new WeakMap;function a(t,e,n){let s=i.get(t);return s?e in s||(s[e]=n()):(s={[e]:n()},i.set(t,s)),s[e]}const c={},u=t=>"string"==typeof t?{type:t}:"function"==typeof t?"resolve"in t?{type:t.type}:{type:t.name}:t;class p{constructor(t,e){if(this.config=t,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=e._parent,this.key=e._key,this.machine=e._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(s.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,s.m)(this.config.states,((t,e)=>new p(t,{_parent:this,_key:e,_machine:this.machine}))):c,"compound"===this.type&&!this.config.initial)throw new Error(`No initial state specified for c
1ompound 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,s.t)(this.config.entry).slice(),this.exit=(0,s.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,s.t)(t.tags).slice()}_initialize(){this.transitions=(0,s.f)(this),this.config.always&&(this.always=(0,s.a)(this.config.always).map((t=>(0,s.b)(this,s.N,t)))),Object.keys(this.states).forEach((t=>{this.states[t]._initialize()}))}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(u),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map((t=>`#${t.id}`)),source:`#${this.id}`,actions:this.initial.actions.map(u),eventType:null})}:void 0,history:this.history,states:(0,s.m)(this.states,(t=>t.definition)),on:this.on,transitions:[...this.transitions.values()].flat().map((t=>({...t,actions:t.actions.map(u)}))),entry:this.entry.map(u),exit:this.exit.map(u),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,s.t)(this.config.invoke).map(((t,e)=>{const{src:n,systemId:r}=t,o=t.id??(0,s.c)(this.id,e),i="string"==typeof n?n:`xstate.invoke.${(0,s.c)(this.id,e)}`;return{...t,src:i,id:o,systemId:r,toJSON(){const{onDone:e,onError:n,...s}=t;return{...s,type:"xstate.invoke",src:i,id:o}}}}))))}get on(){return a(this,"on",(()=>[...this.transitions].flatMap((([t,e])=>e.map((e=>[t,e])))).reduce(((t,[e,n])=>(t[e]=t[e]||[],t[e].push(n),t)),{})))}get after(){return a(this,"delayedTransitions",(()=>(0,s.g)(this)))}get initial(){return a(this,"initial",(()=>(0,s.d)(this,this.config.initial)))}next(t,e){const n=e.type,r=[];let o;const i=a(this,`candidates-${n}`,(()=>(0,s.h)(this,n)));for(const a of i){const{guard:i}=a,u=t.context;let p=!1;try{p=!i||(0,s.e)(i,u,e,t)}catch(c){const t="string"==typeof i?i:"object"==typeof i?i.type:void 0;throw new Error(`Unable to evaluate guard ${t?`'${t}' `:""}in transition for event '${n}' in state node '${this.id}':\n${c.message}`)}if(p){r.push(...a.actions),o=a;break}}return o?[o]:void 0}get events(){return a(this,"events",(()=>{const{states:t}=this,e=new Set(this.ownEvents);if(t)for(const n of Object.keys(t)){const s=t[n];if(s.states)for(const t of s.events)e.add(`${t}`)}return Array.from(e)}))}get ownEvents(){const t=new Set([...this.transitions.keys()].filter((t=>this.transitions.get(t).some((t=>!(!t.target&&!t.actions.length&&!t.reenter))))));return Array.from(t)}}class d{constructor(t,e){this.config=t,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=t.id||"(machine)",this.implementations={actors:e?.actors??{},actions:e?.actions??{},delays:e?.delays??{},guards:e?.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 p(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(t){const{actions:e,guards:n,actors:s,delays:r}=this.implementations;return new d(this.config,{actions:{...e,...t.actions},guards:{...n,...t.guards},actors:{...s,...t.actors},delays:{...r,...t.delays}})}resolveState(t){const e=(0,s.r)(this.root,t.value),n=(0,s.i)((0,s.j)(this.root,e));return(0,s.k)({_nodes:[...n],context:t.context||{},children:{},status:(0,s.l)(n,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,e,n){return(0,s.n)(t,e,n,[]).snapshot}microstep(t,e,n){return(0,s.n)(t,e,n,[]).microstates}getTransitionData(t,e){return(0,s.o)(this.root,t.value,t,e)||[]}getPreInitialState(t,e,n){const{context:o}=this.config,i=(0,s.k)({context:"function"!=typeof o&&o?o:{},_nodes:[this.root],children:{},status:"active"},this);if("function"==typeof o){const a=({spawn:t,event:e,self:n})=>o({spawn:t,input:e.input,self:n});return(0,s.p)(i,e,t,[(0,r.a)(a)],n,void 0)}return i}getInitialSnapshot(t,e){const n=(0,s.q)(e),r=[],o=this.getPreInitialState(t,n,r),i=(0,s.s)([{target:[...(0,s.u)(this.root)],source:this.root,reenter
1:!0,actions:[],eventType:null,toJSON:null}],o,t,n,!0,r),{snapshot:a}=(0,s.n)(i,n,t,r);return a}start(t){Object.values(t.children).forEach((t=>{"active"===t.getSnapshot().status&&t.start()}))}getStateNodeById(t){const e=(0,s.v)(t),n=e.slice(1),r=(0,s.w)(e[0])?e[0].slice(1):e[0],o=this.idMap.get(r);if(!o)throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return(0,s.x)(o,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,e){return(0,s.y)(t,e)}restoreSnapshot(t,e){const n={},r=t.children;Object.keys(r).forEach((t=>{const o=r[t],i=o.snapshot,a=o.src,c="string"==typeof a?(0,s.z)(this,a):a;if(!c)return;const u=(0,s.A)(c,{id:t,parent:e.self,syncSnapshot:o.syncSnapshot,snapshot:i,src:a,systemId:o.systemId});n[t]=u}));const o=(0,s.k)({...t,children:n,_nodes:Array.from((0,s.i)((0,s.j)(this.root,t.value)))},this),i=new Set;return function t(e,n){if(!i.has(e)){i.add(e);for(const r in e){const o=e[r];if(o&&"object"==typeof o){if("xstate$$type"in o&&o.xstate$$type===s.$){e[r]=n[o.id];continue}t(o,n)}}}}(o.context,n),o}}function h({schemas:t,actors:e,actions:n,guards:s,delays:r}){return{createMachine:o=>function(t,e){return new d(t,e)}({...o,schemas:t},{actors:e,actions:n,guards:s,delays:r})}}},46420:function(t,e,n){n.d(e,{a:function(){return i},b:function(){return m},c:function(){return f},e:function(){return u},s:function(){return y}});var s=n(70201);function r(t,{machine:e,context:n},r,o){return(i,a)=>{const c=((i,a)=>
1{if("string"==typeof i){const c=(0,s.z)(e,i);if(!c)throw new Error(`Actor logic '${i}' not implemented in machine '${e.id}'`);const u=(0,s.A)(c,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:n,event:r,self:t.self}):a?.input,src:i,systemId:a?.systemId});return o[u.id]=u,u}return(0,s.A)(i,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:i,systemId:a?.systemId})})(i,a);return o[c.id]=c,t.defer((()=>{c._processingStatus!==s.T.Stopped&&c.start()})),c}}function o(t,e,n,o,{assignment:i}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const a={},c={context:e.context,event:n.event,spawn:r(t,e,n.event,a),self:t.self,system:t.system};let u={};if("function"==typeof i)u=i(c,o);else for(const s of Object.keys(i)){const t=i[s];u[s]="function"==typeof t?t(c,o):t}const p=Object.assign({},e.context,u);return[(0,s.U)(e,{context:p,children:Object.keys(a).length?{...e.children,...a}:e.children}),void 0,void 0]}function i(t){function e(t,e){}return e.type="xstate.assign",e.assignment=t,e.resolve=o,e}function a(t,e,n,s,{event:r}){return[e,{event:"function"==typeof r?r(n,s):r},void 0]}function c(t,{event:e}){t.defer((()=>t.emit(e)))}function u(t){function e(t,e){}return e.type="xstate.emit",e.event=t,e.resolve=a,e.execute=c,e}let p=function(t){return t.Parent="#_parent",t.Internal="#_internal",t}({});function d(t,e,n,s,{to:r,event:o,id:i,delay:a},c){const u=e.machine.implementations.delays;if("string"==typeof o)throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);const d="function"==typeof o?o(n,s):o;let h;if("string"==typeof a){const t=u&&u[a];h="function"==typeof t?t(n,s):t}else h="function"==typeof a?a(n,s):a;const l="function"==typeof r?r(n,s):r;let f;if("string"==typeof l){if(f=l===p.Parent?t.self._parent:l===p.Internal?t.self:l.startsWith("#_")?e.children[l.slice(2)]:c.deferredActorIds?.includes(l)?l:e.children[l],!f)throw new Error(`Unable to send event to actor '${l}' from machine '${e.machine.id}'.`)}else f=l||t.self;return[e,{to:f,targetId:"string"==typeof l?l:void 0,event:d,id:i,delay:h},void 0]}function h(t,e,n){"string"==typeof n.to&&(n.to=e.children[n.to])}function l(t,e){t.defer((()=>{const{to:n,event:r,delay:o,id:i}=e;"number"!=typeof o?t.system._relay(t.self,n,r.type===s.V?(0,s.W)(t.self.id,r.data):r):t.system.scheduler.schedule(t.self,n,r,o,i)}))}function f(t,e,n){function s(t,e){}return s.type="xstate.sendTo",s.to=t,s.event=e,s.id=n?.id,s.delay=n?.delay,s.resolve=d,s.retryResolve=h,s.execute=l,s}function y(t,e){return f(p.Parent,t,e)}function g(t,e,n,r,{collect:o}){const a=[],c=function(t){a.push(t)};return c.assign=(...t)=>{a.push(i(...t))},c.cancel=(...t)=>{a.push((0,s.M)(...t))},c.raise=(...t)=>{a.push((0,s.O)(...t))},c.sendTo=(...t)=>{a.push(f(...t))},c.sendParent=(...t)=>{a.push(y(...t))},c.spawnChild=(...t)=>{a.push((0,s.P)(...t))},c.stopChild=(...t)=>{a.push((0,s.R)(...t))},c.emit=(...t)=>{a.push(u(...t))},o({context:n.context,event:n.event,enqueue:c,check:t=>(0,s.e)(t,e.context,n.event,e),self:t.self,system:t.system},r),[e,void 0,a]}function m(t){function e(t,e){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=g,e}},49288:function(t,e,n){n.d(e,{V2:function(){return U},FS:function(){return W},IM:function(){return J},Tx:function(){return B},Rr:function(){return z},vd:function(){return F},_K:function(){return N},CC:function(){return V},RM:function(){return X},Uc:function(){return K},tP:function(){return L}});var s={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let r;const o=new Uint8Array(16);const i=[];for(let G=0;G<256;++G)i.push((G+256).toString(16).slice(1));function a(t,e=0){return(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase()}var c=function(t,e,n){if(s.randomUUID&&!e&&!t)return s.randomUUID();const i=(t=t||{}).random??t.rng?.()??function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(o)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=i[t];return e}return a(i)},u=n(76163),p=n(32433),d=n(46420),h=n(70201),l=n(72316),f=n(31635),y=n(15964),g=n(88483),m=n(28452),v=n(69391),_=n(61209),b=n(57516),S=["addListener","removeListener"],w=["addEventListener","removeEventListener"],k=["on","off"];function x(t,e,n,s){if((0,_.T)(n)&&(s=n,n=void 0),s)return x(t,e,n).pipe((0,b.I)(s));var r=(0,f.zs)(function(t){return(0,_.T)(t.addEventListener)&&(0,_.T)(t.removeEventListener)}(t)?w.map((function(s){return function(r){return t[s](e,r,n)}})):function(t){return(0,_.T)(t.addListener)&&(0,_.T)(t.removeListener)}(t)?S.map(I(t,e)):function(t){return(0,_.T)(t.on)&&(0,_.T)(t.off)}(t)?k.map(I(t,e)):[],2),o=r[0],i=r[1];if(!o&&(0,v.X)(t))return(0,m.Z)((function(t){return x(t,e,n)}
1))((0,y.Tg)(t));if(!o)throw new TypeError("Invalid event target");return new g.c((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return i(e)}}))}function I(t,e){return function(n){return function(s){return t[n](e,s)}}}var E=n(81160),$=n(81485),T=n(16126),j=n(92908),O=n(64878),A=n(6174);var P=n(61701);function R(t){return t<=0?function(){return P.w}:(0,j.N)((function(e,n){var s=0;e.subscribe((0,O._)(n,(function(e){++s<=t&&(n.next(e),t<=s&&n.complete())})))}))}var q=n(92357);const M=t=>({context:e})=>{const{count:n,include:s,exclude:r,responseType:o="message.received"}=t;return{count:n,domain:e.domain,from:e.connectTo,include:s?Array.isArray(s)?s:[s]:[],exclude:r?Array.isArray(r)?r:[r]:[],responseType:o,target:e.target,to:e.name}},D=(0,l.v)((()=>x(window,"message"))),V=t=>(0,u.OX)((({input:e})=>{return D.pipe(t?(0,E.T)(t):(0,$.F)(),(0,T.p)((t=>e=>{const{data:n}=e;return(!t.include.length||t.include.includes(n.type))&&(!t.exclude.length||!t.exclude.includes(n.type))&&n.domain===t.domain&&n.from===t.from&&n.to===t.to&&(!t.target||e.source===t.target)})(e)),(0,E.T)((i=e.responseType,t=>({type:i,message:t}))),e.count?(0,$.F)((r=e.count,void 0===o&&(o=null),o=null!=o?o:r,(0,j.N)((function(t,e){var n=[],s=0;t.subscribe((0,O._)(e,(function(t){var i,a,c,u,p=null;s++%o==0&&n.push([]);try{for(var d=(0,f.Ju)(n),h=d.next();!h.done;h=d.next())(g=h.value).push(t),r<=g.length&&(p=null!=p?p:[]).push(g)}catch(m){i={error:m}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}if(p)try{for(var l=(0,f.Ju)(p),y=l.next();!y.done;y=l.next()){var g=y.value;(0,A.o)(n,g),e.next(g)}}catch(v){c={error:v}}finally{try{y&&!y.done&&(u=l.return)&&u.call(l)}finally{if(c)throw c.error}}}),(function(){var t,s;try{for(var r=(0,f.Ju)(n),o=r.next();!o.done;o=r.next()){var i=o.value;e.next(i)}}catch(a){t={error:a}}finally{try{o&&!o.done&&(s=r.return)&&s.call(r)}finally{if(t)throw t.error}}e.complete()}),void 0,(function(){n=null})))}))),(n=t=>t,(0,_.T)(s)?(0,m.Z)(n,s,1):(0,m.Z)(n,1)),R(e.count)):(0,$.F)());var n,s,r,o,i})),U="sanity/comlink",C=1e4,N="comlink/response",F="comlink/heartbeat",W="comlink/disconnect",B="comlink/handshake/syn",z="comlink/handshake/syn-ack",J="comlink/handshake/ack",L=()=>(0,p.mj)({types:{},actors:{listen:(0,u.OX)((({input:t})=>{const e=t.signal?x(t.signal,"abort").pipe((n=`Request ${t.requestId} aborted`,t=>t.pipe(R(1),(0,E.T)((()=>{throw new Error(n)}))))):P.w;var n,s;return x(window,"message").pipe((0,T.p)((e=>e.data?.type===N&&e.data?.responseTo===t.requestId&&!!e.source&&t.sources.has(e.source))),R(t.sources.size),(s=e,(0,j.N)((function(t,e){(0,y.Tg)(s).subscribe((0,O._)(e,(function(){return e.complete()}),q.l)),!e.closed&&t.subscribe(e)}))))}))},actions:{"send message":({context:t},e)=>{const{sources:n,targetOrigin:s}=t,{message:r}=e;n.forEach((t=>{t.postMessage(r,{targetOrigin:s})}))},"on success":(0,d.c)((({context:t})=>t.parentRef),(({context:t,self:e})=>(t.response&&t.resolvable?.resolve(t.response),{type:"request.success",requestId:e.id,response:t.response,responseTo:t.responseTo}))),"on fail":(0,d.c)((({context:t})=>t.parentRef),(({context:t,self:e})=>(t.suppressWarnings||console.warn(`[@sanity/comlink] Received no response to message '${t.type}' on client '${t.from}' (ID: '${t.id}').`),t.resolvable?.reject(new Error("No response received")),{type:"request.failed",requestId:e.id}))),"on abort":(0,d.c)((({context:t})=>t.parentRef),(({context:t,self:e})=>(t.resolvable?.reject(new Error("Request aborted")),{type:"request.aborted",requestId:e.id})))},guards:{expectsResponse:({context:t})=>t.expectResponse},delays:{initialTimeout:0,responseTimeout:({context:t})=>t.responseTimeout??3e3}}).createMachine({context:({input:t})=>({channelId:t.channelId,data:t.data,domain:t.domain,expectResponse:t.expectResponse??!1,from:t.from,id:`msg-${c()}`,parentRef:t.parentRef,resolvable:t.resolvable,response:null,responseTimeout:t.responseTimeout,responseTo:t.responseTo,signal:t.signal,sources:t.sources instanceof Set?t.sources:new Set([t.sources]),suppressWarnings:t.suppressWarnings,targetOrigin:t.targetOrigin,to:t.to,type:t.type}),initial:"idle",on:{abort:".aborted"},states:{idle:{after:{initialTimeout:[{target:"sending"}]}},sending:{entry:{type:"send message",params:({context:t})=>
1{const{channelId:e,data:n,domain:s,from:r,id:o,responseTo:i,to:a,type:c}=t;return{message:{channelId:e,data:n,domain:s,from:r,id:o,to:a,type:c,responseTo:i}}}},always:[{guard:"expectsResponse",target:"awaiting"},"success"]},awaiting:{invoke:{id:"listen for response",src:"listen",input:({context:t})=>({requestId:t.id,sources:t.sources,signal:t.signal}),onError:"aborted"},after:{responseTimeout:"failed"},on:{message:{actions:(0,d.a)({response:({event:t})=>t.data.data,responseTo:({event:t})=>t.data.responseTo}),target:"success"}}},failed:{type:"final",entry:"on fail"},success:{type:"final",entry:"on success"},aborted:{type:"final",entry:"on abort"}},output:({context:t,self:e})=>({requestId:e.id,response:t.response,responseTo:t.responseTo})}),K=((0,u.SP)((({sendBack:t,input:e})=>{const n=()=>{t(e.event)};e.immediate&&n();const s=setInterval(n,e.interval);return()=>{clearInterval(s)}})),()=>(0,p.mj)({types:{},actors:{requestMachine:L(),listen:V()},actions:{"buffer handshake":(0,d.a)({handshakeBuffer:({event:t,context:e})=>((0,p.DT)(t,"message.received"),[...e.handshakeBuffer,t])}),"buffer message":(0,d.b)((({enqueue:t})=>{t.assign({buffer:({event:t,context:e})=>((0,p.DT)(t,"post"),[...e.buffer,{data:t.data,resolvable:t.resolvable,options:t.options}])}),t.emit((({event:t})=>((0,p.DT)(t,"post"),{type:"buffer.added",message:t.data})))})),"create request":(0,d.a)({requests:({context:t,event:e,self:n,spawn:s})=>{(0,p.DT)(e,"request");const r=(Array.isArray(e.data)?e.data:[e.data]).map((e=>{const r=`req-${c()}`;return s("requestMachine",{id:r,input:{channelId:t.channelId,data:e.data,domain:t.domain,expectResponse:e.expectResponse,from:t.name,parentRef:n,resolvable:e.resolvable,responseTimeout:e.options?.responseTimeout,responseTo:e.responseTo,signal:e.options?.signal,sources:t.target,suppressWarnings:e.options?.suppressWarnings,targetOrigin:t.targetOrigin,to:t.connectTo,type:e.type}})}));return[...t.requests,...r]}}),"emit heartbeat":(0,d.e)((()=>({type:"heartbeat"}))),"emit received message":(0,d.b)((({enqueue:t})=>{t.emit((({event:t})=>((0,p.DT)(t,"message.received"),{type:"message",message:t.message.data})))})),"emit status":(0,d.e)(((t,e)=>({type:"status",status:e.status}))),"post message":(0,h.O)((({event:t})=>((0,p.DT)(t,"post"),{type:"request",data:{data:t.data.data,expectResponse:!!t.resolvable,type:t.data.type,resolvable:t.resolvable,options:t.options}}))),"process pending handshakes":(0,d.b)((({context:t,enqueue:e})=>{t.handshakeBuffer.forEach((t=>e.raise(t))),e.assign({handshakeBuffer:[]})})),"remove request":(0,d.b)((({context:t,enqueue:e,event:n})=>{(0,p.DT)(n,["request.success","request.failed","request.aborted"]),(0,h.R)(n.requestId),e.assign({requests:t.requests.filter((({id:t})=>t!==n.requestId))})})),"send response":(0,h.O)((({event:t})=>((0,p.DT)(t,["message.received","heartbeat.received"]),{type:"request",data:{type:N,responseTo:t.message.data.id,data:void 0}}))),"send handshake syn ack":(0,h.O)({type:"request",data:{type:z}}),"send pending messages":(0,d.b)((({enqueue:t})=>{t.raise((({context:t})=>({type:"request",data:t.buffer.map((({data:t,resolvable:e,options:n})=>({data:t.data,type:t.type,expectResponse:!!e,resolvable:e,options:n})))}))),t.emit((({context:t})=>({type:"buffer.flushed",messages:t.buffer.map((({data:t})=>t))}))),t.assign({buffer:[]})})),"set connection config":(0,d.a)({channelId:({event:t})=>((0,p.DT)(t,"handshake.syn"),t.message.data.channelId),target:({event:t})=>((0,p.DT)(t,"handshake.syn"),t.message.source||void 0),targetOrigin:({event:t})=>((0,p.DT)(t,"handshake.syn"),t.message.origin)})},guards:{hasSource:({context:t})=>null!==t.target}}).createMachine({id:"node",context:({input:t})=>({buffer:[],channelId:null,connectTo:t.connectTo,domain:t.domain??U,handshakeBuffer:[],name:t.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:M({include:B,responseType:"handshake.syn"})},on:{"request.success":{actions:"remove request"},"request.failed":{actions:"remove request"},"request.aborted":{actions:"remove request"},"handshake.syn":{actions:"set connection config",target:".handshaking"}}
1,initial:"idle",states:{idle:{entry:[{type:"emit status",params:{status:"idle"}}],on:{post:{actions:"buffer message"}}},handshaking:{guard:"hasSource",entry:["send handshake syn ack",{type:"emit status",params:{status:"handshaking"}}],invoke:[{id:"listen for handshake ack",src:"listen",input:M({include:J,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:M({include:W,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:M({exclude:[W,B,J,F,N]})}],on:{request:{actions:"create request"},post:{actions:"buffer message"},"message.received":{actions:"buffer handshake"},disconnect:{target:"idle"}}},connected:{entry:["process pending handshakes","send pending messages",{type:"emit status",params:{status:"connected"}}],invoke:[{id:"listen for messages",src:"listen",input:M({exclude:[W,B,J,F,N]})},{id:"listen for heartbeat",src:"listen",input:M({include:F,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:M({include:W,count:1,responseType:"disconnect"})}],on:{request:{actions:"create request"},post:{actions:"post message"},disconnect:{target:"idle"},"message.received":{actions:["send response","emit received message"]},"heartbeat.received":{actions:["send response","emit heartbeat"]}}}}})),X=(t,e=K())=>{const n=(0,h.A)(e,{input:t}),s=new Map,r=new Map;let o;n.on("message",(({message:t})=>{const e=s.get(t.type);if(e)return void e.forEach((e=>e(t.data)));const n=r.get(t.type);n?n.add(t):r.set(t.type,new Set([t]))}));const i=()=>{n.stop()};return{actor:n,fetch:(t,e,s)=>{const{responseTimeout:r=C,signal:o,suppressWarnings:i}=s||{},a=Promise.withResolvers(),c={type:t,data:e};return n.send({type:"post",data:c,resolvable:a,options:{responseTimeout:r,signal:o,suppressWarnings:i}}),a.promise},machine:e,on:(t,e,n)=>{const o=s.get(t)||new Set;s.has(t)||s.set(t,o),o.add(e);const i=r.get(t);if(i){const s=n?.replay??1;Array.from(i).slice(-s).forEach((({data:t})=>e(t))),r.delete(t)}return()=>{o.delete(e)}},onStatus:(t,e)=>{const{unsubscribe:s}=n.on("status",(n=>{o=n.status,(!e||n.status===e)&&t(n.status)}));return o&&t(o),s},post:(t,e)=>{const s={type:t,data:e};n.send({type:"post",data:s})},start:()=>(n.start(),i),stop:i}}},70201:function(t,e,n){function s(){const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:void 0;if(t.__xstate__)return t.__xstate__}n.d(e,{$:function(){return q},A:function(){return U},M:function(){return F},N:function(){return c},O:function(){return Xt},P:function(){return z},R:function(){return K},S:function(){return i},T:function(){return M},U:function(){return Bt},V:function(){return d},W:function(){return f},X:function(){return h},a:function(){return E},b:function(){return it},c:function(){return j},d:function(){return ct},e:function(){return X},f:function(){return at},g:function(){return ot},h:function(){return rt},i:function(){return H},j:function(){return yt},k:function(){return Wt},l:function(){return nt},m:function(){return S},n:function(){return Pt},o:function(){return gt},p:function(){return At},q:function(){return y},r:function(){return Dt},s:function(){return xt},t:function(){return k},u:function(){return ht},v:function(){return _},w:function(){return st},x:function(){return ft},y:function(){return zt},z:function(){return O}});const r=t=>{if("undefined"==typeof window)return;const e=s();e&&e.register(t)};class o{constructor(t){this._process=t,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(t){const e={value:t,next:null};if(this._current)return this._last.next=e,void(this._last=e);this._current=e,this._last=e,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const i=".",a="",c="",u="*",p="xstate.init",d="xstate.error",h="xstate.stop";function l(t,e){return{type:`xstate.done.state.${t}`,output:e}}function f(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function y(t){return{type:p,input:t}}function g(t){setTimeout((()=>{throw t}))}const m="function"==typeof Symbol&&Symbol.observable||"@@observable";function v(t,e){const n=b(t),s=b(e);return"string"==typeof s?"string"==typeof n&&s===n:"string"==typeof n?n in s:Object.keys(n).every((t=>t in s&&v(n[t],s[t])))}function _(t){if(I(t))return t;const e=[];let n="";for(let s=0;s<t.length;s++){switch(t.charCodeAt(s)){case 92:n+=t[s+1],s++;continue;case 46:e.push(n),n="";continue}n+=t[s]}return e.push(n),e}function b(t){if((e=t)&&"object"==typeof e&&"machine"in e&&"value"in e)return t.value;var e;if("string"!=typeof t)return t;return function(t){if(1===t.length)return t[0];const e={};let n=e;for(let s=0;s<t.length-1;s++)if(s===t.length-2)n[t[s]]=t[s+1];else{const e=n;n={},e[t[s]]=n}return e}(_(t))}function S(t,e){const n={},s=Object.keys(t);for(let r=0;r<s.length;r++){const o=s[r];n[o]=e(t[o],o,t,r)}return n}function w(t){return I(t)?t:[t]}function k(t){return void 0===t?[]:w(t)}function x(t,e,n,s){return"function"==typeof t?t({context:e,event:n,self:s}):t}function I(t){return Array.isArray(t)}function E(t){return w(t).map((t=>void 0===t||"string"==typeof t?{target:t}:t))}function $(t){if(void 0!==t&&t!==a)return k(t)}function T(t,e,n){const s="object"==typeof t,r=s?t:void 0;return{next:(s?t.next:t)?.bind(r),error:(s?t.error:e)?.bind(r),complete:(s?t.complete:n)?.bind(r)}}function j(t,e){return`${e}.${t}`}function O(t,e){const n=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return t.implementations.actors[e];const[,s,r]=n,o=t.getStateNodeById(r).config.invoke;return(Array.isArray(o)?o[s]:o).src}function A(t,e){return`${t.sessionId}.${e}`}let P=0;let R=!1;const q=1;let M=function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t}({});const D={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class V{constructor(t,e){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new o(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=M.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=[];const n={...D,...e},{clock:s,logger:r,parent:i,syncSnapshot:a,id:c,systemId:u,inspect:p}=n;this.system=i?i.system:function(t,e){const n=new Map,s=new Map,r=new WeakMap,o=new Set,i={},{clock:a,logger:c}=e,u={schedule:(t,e,n,s,r=Math.random().toString(36).slice(2))=>{const o={source:t,target:e,event:n,delay:s,id:r,startedAt:Date.now()},c=A(t,r);p._snapshot._scheduledEvents[c]=o;const u=a.setTimeout((()=>{delete i[c],delete p._snapshot._scheduledEvents[c],p._relay(t,e,n)}),s);i[c]=u},cancel:(t,e)=>{const n=A(t,e),s=i[n];delete i[n],delete p._snapshot._scheduledEvents[n],void 0!==s&&a.clearTimeout(s)},cancelAll:t=>{for(const e in p._snapshot._scheduledEvents){const n=p._snapshot._scheduledEvents[e];n.source===t&&u.cancel(t,n.id)}}},p={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>"x:"+P++,_register:(t,e)=>(n.set(t,e),t),_unregister:t=>{n.delete(t.sessionId);const e=r.get(t);void 0!==e&&(s.delete(e),r.delete(t))},get:t=>s.get(t),_set:(t,e)=>{const n=s.get(t);if(n&&n!==e)throw new Error(`Actor with system ID '${t}' already exists.`);s.set(t,e),r.set(e,t)},inspect:t=>{const e=T(t);return o.add(e),{unsubscribe(){o.delete(e)}}},_sendInspectionEvent:e=>{if(!o.size)return;const n={...e,rootId:t.sessionId};o.forEach((t=>t.next?.(n)))},_relay:(t,e,n)=>{p._sendInspectionEvent({type:"@xstate.event",sourceRef:t,actorRef:e,event:n}),e._send(n)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...p._snapshot._scheduledEvents}}),start:()=>{const t=p._snapshot._scheduledEvents;p._snapshot._scheduledEvents={};for(const e in t){const{source:n,target:s,event:r,delay:o,id:i}=t[e];u.schedule(n,s,r,o,i)}},_clock:a,_logger:c};return p}(this,{clock:s,logger:r}),p&&!i&&this.system.inspect(T(p)),this.sessionId=this.system._bookId(),this.id=c??this.sessionId,this.logger=e?.logger??this.system._logger,this.clock=e?.clock??this.system._clock,this._parent=i,this._syncSnapshot=a,this.options=n,this.src=n.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:t=>{this._deferred.push(t)},system:this.system,stopChild:t=>{if(t._parent!==this)throw new Error(`Cannot stop child actor ${t.id} of ${this.id} because it is not a child`);t._stop()},emit:t=>{const e=this.eventListeners.get(t.type),n=this.eventListeners.get("*");if(!e&&!n)return;const s=[...e?e.values():[],...n?n.values():[]];for(const r of s)r(t)},actionExecutor:t=>{const e=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:t.type,params:t.params}}),!t.exec)return;const e=R;try{R=!0,t.exec(t.info,t.params)}finally{R=e}};this._processingStatus===M.Running?e():this._deferred.push(e)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),u&&(this._systemId=u,this.system._set(u,this)),this._initState(e?.snapshot??e?.state),u&&"active"!==this._snapshot.status&&this.system._unregister(this)}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:"error",output:void 0,error:e}}}update(t,e){let n;for(this._snapshot=t;n=this._deferred.shift();)try{n()}catch(o){this._deferred.length=0,this._snapshot={...t,status:"error",error:o}}switch(this._snapshot.status){case"active":for(const e of this.observers)try{e.
1next?.(t)}catch(o){g(o)}break;case"done":for(const e of this.observers)try{e.next?.(t)}catch(o){g(o)}this._stopProcedure(),this._complete(),this._doneEvent=(s=this.id,r=this._snapshot.output,{type:`xstate.done.actor.${s}`,output:r,actorId:s}),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error)}var s,r;this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:e,snapshot:t})}subscribe(t,e,n){const s=T(t,e,n);if(this._processingStatus!==M.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(r){g(r)}break;case"error":{const t=this._snapshot.error;if(s.error)try{s.error(t)}catch(r){g(r)}else g(t);break}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(t,e){let n=this.eventListeners.get(t);n||(n=new Set,this.eventListeners.set(t,n));const s=e.bind(void 0);return n.add(s),{unsubscribe:()=>{n.delete(s)}}}start(){if(this._processingStatus===M.Running)return this;this._syncSnapshot&&this.subscribe({next:t=>{"active"===t.status&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:t})},error:()=>{}}),this.system._register(this.sessionId,this),this._systemId&&this.system._set(this._systemId,this),this._processingStatus=M.Running;const t=y(this.options.input);this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t});switch(this._snapshot.status){case"done":return this.update(this._snapshot,t),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,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let e,n;try{e=this.logic.transition(this._snapshot,t,this._actorScope)}catch(s){n={err:s}}if(n){const{err:t}=n;return this._snapshot={...this._snapshot,status:"error",error:t},void this._error(t)}this.update(e,t),t.type===h&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===M.Stopped?this:(this.mailbox.clear(),this._processingStatus===M.NotStarted?(this._processingStatus=M.Stopped,this):(this.mailbox.enqueue({type:h}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(const e of this.observers)try{e.complete?.()}catch(t){g(t)}this.observers.clear()}_reportError(t){if(!this.observers.size)return void(this._parent||g(t));let e=!1;for(const s of this.observers){const r=s.error;e||=!r;try{r?.(t)}catch(n){g(n)}}this.observers.clear(),e&&g(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,f(this.id,t))}_stopProcedure(){return this._processingStatus!==M.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new o(this._process.bind(this)),this._processingStatus=M.Stopped,this.system._unregister(this)),this}_send(t){this._processingStatus!==M.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;if(t){("function"==typeof t?t:r)(this)}}toJSON(){return{xstate$$type:q,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[m](){return this}getSnapshot(){return this._snapshot}}function U(t,...[e]){return new V(t,e)}function C(t,e,n,s,{sendId:r}){return[e,{sendId:"function"==typeof r?r(n,s):r},void 0]}function N(t,e){t.defer((()=>{t.system.scheduler.cancel(t.self,e.sendId)}))}function F(t){function e(t,e){}return e.type="xstate.cancel",e.sendId=t,e.resolve=C,e.execute=N,e}function W(t,e,n,s,{id:r,systemId:o,src:i,input:a,syncSnapshot:c}){const u="string"==typeof i?O(e.machine,i):i,p="function"==typeof r?r(n):r;let d,h;return u&&(h="function"==typeof a?a({context:e.context,event:n.event,self:t.self}):a,d=U(u,{id:p,src:i,parent:t.self,syncSnapshot:c,systemId:o,input:h})),[Bt(e,{children:{...e.children,[p]:d}}),{id:r,systemId:o,actorRef:d,src:i,input:h},void 0]}function B(t,{actorRef:e}){e&&t.defer((()=>{e._processingStatus!==M.Stopped&&e.start()}))}function z(...[t,{id:e,systemId:n,input:s,syncSnapshot:r=!1}={}]){function o(t,e){}return o.type="xstate.spawnChild",o.id=e,o.systemId=n,o.src=t,o.input=s,o.syncSnapshot=r,o.resolve=W,o.execute=B,o}function J(t,e,n,s,{actorRef:r}){const o="function"==typeof r?r(n,s):r,i="string"==typeof o?e.children[o]:o;let a=e.children;return i&&(a={...a},delete a[i.id]),[Bt(e,{children:a}),i,void 0]}function L(t,e){e&&(t.system._unregister(e),e._processingStatus===M.Running?t.defer((()=>{t.stopChild(e)})):t.stopChild(e))}function K(t){function e(t,e){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=J,e.execute=L,e}function X(t,e,n,s){const{machine:r}=s,o="function"==typeof t,i=o?t:r.implementations.guards["string"==typeof t?t:t.type];if(!o&&!i)throw new Error(`Guard '${"string"==typeof t?t:t.type}' is not implemented.'.`);if("function"!=typeof i)return X(i,e,n,s);const a={context:e,event:n},c=o||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:e,event:n}):t.params:void 0;if(!("check"in i))return i(a,c);return i.check(s,a,i)}const G=t=>"atomic"===t.type||"final"===t.type;function Z(t){return Object.values(t.states).filter((t=>"history"!==t.type))}function Q(t,e){const n=[];if(e===t)return n;let s=t.parent;for(;s&&s!==e;)n.push(s),s=s.parent;return n}function H(t){const e=new Set(t),n=tt(e);for(const s of e)if("compound"!==s.type||n.get(s)&&n.get(s).length){if("parallel"===s.type)for(const t of Z(s))if("history"!==t.type&&!e.has(t)){const n=dt(t);for(const t of n)e.add(t)}}
1else dt(s).forEach((t=>e.add(t)));for(const s of e){let t=s.parent;for(;t;)e.add(t),t=t.parent}return e}function Y(t,e){const n=e.get(t);if(!n)return{};if("compound"===t.type){const t=n[0];if(!t)return{};if(G(t))return t.key}const s={};for(const r of n)s[r.key]=Y(r,e);return s}function tt(t){const e=new Map;for(const n of t)e.has(n)||e.set(n,[]),n.parent&&(e.has(n.parent)||e.set(n.parent,[]),e.get(n.parent).push(n));return e}function et(t,e){return Y(t,tt(H(e)))}function nt(t,e){return"compound"===e.type?Z(e).some((e=>"final"===e.type&&t.has(e))):"parallel"===e.type?Z(e).every((e=>nt(t,e))):"final"===e.type}const st=t=>"#"===t[0];function rt(t,e){return t.transitions.get(e)||[...t.transitions.keys()].filter((t=>{if(t===u)return!0;if(!t.endsWith(".*"))return!1;const n=t.split("."),s=e.split(".");for(let e=0;e<n.length;e++){const t=n[e],r=s[e];if("*"===t){return e===n.length-1}if(t!==r)return!1}return!0})).sort(((t,e)=>e.length-t.length)).flatMap((e=>t.transitions.get(e)))}function ot(t){const e=t.config.after;if(!e)return[];return Object.keys(e).flatMap((n=>{const s=e[n],r="string"==typeof s?{target:s}:s,o=Number.isNaN(+n)?n:+n,i=(e=>{const n=(s=e,r=t.id,{type:`xstate.after.${s}.${r}`});var s,r;const o=n.type;return t.entry.push(Xt(n,{id:o,delay:e})),t.exit.push(F(o)),o})(o);return k(r).map((t=>({...t,event:i,delay:o})))})).map((e=>{const{delay:n}=e;return{...it(t,e.event,e),delay:n}}))}function it(t,e,n){const s=$(n.target),r=n.reenter??!1,o=function(t,e){if(void 0===e)return;return e.map((e=>{if("string"!=typeof e)return e;if(st(e))return t.machine.getStateNodeById(e);const n=e[0]===i;if(n&&!t.parent)return ft(t,e.slice(1));const s=n?t.key+e:e;if(!t.parent)throw new Error(`Invalid target: "${e}" is not a valid target from the root node. Did you mean ".${e}"?`);try{return ft(t.parent,s)}catch(r){throw new Error(`Invalid transition definition for state node '${t.id}':\n${r.message}`)}}))}(t,s),a={...n,actions:k(n.actions),guard:n.guard,target:o,source:t,reenter:r,eventType:e,toJSON:()=>({...a,source:`#${t.id}`,target:o?o.map((t=>`#${t.id}`)):void 0})};return a}function at(t){const e=new Map;if(t.config.on)for(const n of Object.keys(t.config.on)){if(n===c)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const s=t.config.on[n];e.set(n,E(s).map((e=>it(t,n,e))))}if(t.config.onDone){const n=`xstate.done.state.${t.id}`;e.set(n,E(t.config.onDone).map((e=>it(t,n,e))))}for(const n of t.invoke){if(n.onDone){const s=`xstate.done.actor.${n.id}`;e.set(s,E(n.onDone).map((e=>it(t,s,e))))}if(n.onError){const s=`xstate.error.actor.${n.id}`;e.set(s,E(n.onError).map((e=>it(t,s,e))))}if(n.onSnapshot){const s=`xstate.snapshot.${n.id}`;e.set(s,E(n.onSnapshot).map((e=>it(t,s,e))))}}for(const n of t.after){let t=e.get(n.eventType);t||(t=[],e.set(n.eventType,t)),t.push(n)}return e}function ct(t,e){const n="string"==typeof e?t.states[e]:e?t.states[e.target]:void 0;if(!n&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${t.id}`);const s={source:t,actions:e&&"string"!=typeof e?k(e.actions):[],eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...s,source:`#${t.id}`,target:n?[`#${n.id}`]:[]})};return s}function ut(t){const e=$(t.config.target);return e?{target:e.map((e=>"string"==typeof e?ft(t.parent,e):e))}:t.parent.initial}function pt(t){return"history"===t.type}function dt(t){const e=ht(t);for(const n of e)for(const s of Q(n,t))e.add(s);return e}function ht(t){const e=new Set;return function t(n){if(!e.has(n))if(e.add(n),"compound"===n.type)t(n.initial.target[0]);else if("parallel"===n.type)for(const e of Z(n))t(e)}(t),e}function lt(t,e){if(st(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const n=t.states[e];if(!n)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function ft(t,e){if("string"==typeof e&&st(e))try{return t.machine.getStateNodeById(e)}catch{}const n=_(e).slice();let s=t;for(;n.length;){const t=n.shift();if(!t.length)break;s=lt(s,t)}return s}function yt(t,e){if("string"==typeof e){const n=t.states[e];if(!n)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,n]}const n=Object.keys(e),s=n.map((e=>
1lt(t,e))).filter(Boolean);return[t.machine.root,t].concat(s,n.reduce(((n,s)=>{const r=lt(t,s);if(!r)return n;const o=yt(r,e[s]);return n.concat(o)}),[]))}function gt(t,e,n,s){return"string"==typeof e?function(t,e,n,s){const r=lt(t,e).next(n,s);return r&&r.length?r:t.next(n,s)}(t,e,n,s):1===Object.keys(e).length?function(t,e,n,s){const r=Object.keys(e),o=gt(lt(t,r[0]),e[r[0]],n,s);return o&&o.length?o:t.next(n,s)}(t,e,n,s):function(t,e,n,s){const r=[];for(const o of Object.keys(e)){const i=e[o];if(!i)continue;const a=gt(lt(t,o),i,n,s);a&&r.push(...a)}return r.length?r:t.next(n,s)}(t,e,n,s)}function mt(t){return Object.keys(t.states).map((e=>t.states[e])).filter((t=>"history"===t.type))}function vt(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function _t(t,e){const n=new Set(t),s=new Set(e);for(const r of n)if(s.has(r))return!0;for(const r of s)if(n.has(r))return!0;return!1}function bt(t,e,n){const s=new Set;for(const r of t){let t=!1;const o=new Set;for(const i of s)if(_t(kt([r],e,n),kt([i],e,n))){if(!vt(r.source,i.source)){t=!0;break}o.add(i)}if(!t){for(const t of o)s.delete(t);s.add(r)}}return Array.from(s)}function St(t,e){if(!t.target)return[];const n=new Set;for(const s of t.target)if(pt(s))if(e[s.id])for(const t of e[s.id])n.add(t);else for(const t of St(ut(s),e))n.add(t);else n.add(s);return[...n]}function wt(t,e){const n=St(t,e);if(!n)return;if(!t.reenter&&n.every((e=>e===t.source||vt(e,t.source))))return t.source;const s=function(t){const[e,...n]=t;for(const s of Q(e,void 0))if(n.every((t=>vt(t,s))))return s}(n.concat(t.source));return s||(t.reenter?void 0:t.source.machine.root)}function kt(t,e,n){const s=new Set;for(const r of t)if(r.target?.length){const t=wt(r,n);r.reenter&&r.source===t&&s.add(t);for(const n of e)vt(n,t)&&s.add(n)}return[...s]}function xt(t,e,n,s,r,o){if(!t.length)return e;const i=new Set(e._nodes);let a=e.historyValue;const c=bt(t,i,a);let u=e;r||([u,a]=function(t,e,n,s,r,o,i){let a=t;const c=kt(s,r,o);let u;c.sort(((t,e)=>e.order-t.order));for(const p of c)for(const t of mt(p)){let e;e="deep"===t.history?t=>G(t)&&vt(t,p):t=>t.parent===p,u??={...o},u[t.id]=Array.from(r).filter(e)}for(const p of c)a=At(a,e,n,[...p.exit,...p.invoke.map((t=>K(t.id)))],i,void 0),r.delete(p);return[a,u||o]}(u,s,n,c,i,a,o,n.actionExecutor)),u=At(u,s,n,c.flatMap((t=>t.actions)),o,void 0),u=function(t,e,n,s,r,o,i,a){let c=t;const u=new Set,p=new Set;(function(t,e,n,s){for(const r of t){const t=wt(r,e);for(const i of r.target||[])pt(i)||r.source===i&&r.source===t&&!r.reenter||(s.add(i),n.add(i)),Et(i,e,n,s);const o=St(r,e);for(const i of o){const o=Q(i,t);"parallel"===t?.type&&o.push(t),$t(s,e,n,o,!r.source.parent&&r.reenter?void 0:t)}}})(s,i,p,u),a&&p.add(t.machine.root);const d=new Set;for(const h of[...u].sort(((t,e)=>t.order-e.order))){r.add(h);const t=[];t.push(...h.entry);for(const e of h.invoke)t.push(z(e.src,{...e,syncSnapshot:!!e.onSnapshot}));if(p.has(h)){const e=h.initial.actions;t.push(...e)}if(c=At(c,e,n,t,o,h.invoke.map((t=>t.id))),"final"===h.type){const t=h.parent;let s="parallel"===t?.type?t:t?.parent,i=s||h;for("compound"===t?.type&&o.push(l(t.id,void 0!==h.output?x(h.output,c.context,e,n.self):void 0));"parallel"===s?.type&&!d.has(s)&&nt(r,s);)d.add(s),o.push(l(s.id)),i=s,s=s.parent;if(s)continue;c=Bt(c,{status:"done",output:It(c,e,n,c.machine.root,i)})}}return c}(u,s,n,c,i,o,a,r);const p=[...i];"done"===u.status&&(u=At(u,s,n,p.sort(((t,e)=>e.order-t.order)).flatMap((t=>t.exit)),o,void 0));try{return a===e.historyValue&&function(t,e){if(t.length!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}(e._nodes,i)?u:Bt(u,{_nodes:p,historyValue:a})}catch(d){throw d}}function It(t,e,n,s,r){if(void 0===s.output)return;const o=l(r.id,void 0!==r.output&&r.parent?x(r.output,t.context,e,n.self):void 0);return x(s.output,t.context,o,n.self)}function Et(t,e,n,s){if(pt(t))if(e[t.id]){const r=e[t.id];for(const t of r)s.add(t),Et(t,e,n,s);for(const o of r)Tt(o,t.parent,s,e,n)}else{const r=ut(t);for(const o of r.target)s.add(o),r===t.parent?.initial&&n.add(t.parent),Et(o,e,n,s);for(const o of r.target)Tt(o,t.parent,s,e,n)}else if("compound"===t.type){const[r]=t.initial.target;pt(r)||(s.add(r),n.add(r)),Et(r,e,n,s),Tt(r,t,s,e,n)}else if("parallel"===t.type)for(const r of Z(t).filter((t=>!pt(t))))[...s].some((t=>vt(t,r)))||(pt(r)||(s.add(r),n.add(r)),Et(r,e,n,s))}function $t(t,e,n,s,r){for(const o of s)if(r&&!vt(o,r)||t.add(o),"parallel"===o.type)for(const s of Z(o).filter((t=>!pt(t))))[...t].some((t=>vt(t,s)))||(t.add(s),Et(s,e,n,t))}function Tt(t,e,n,s,r){$t(n,s,r,Q(t,e))}function jt(t,e){return t.implementations.actions[e]}function Ot(t,e,n,s,r,o){const{machine:i}=t;let a=t;for(const c of s){const t="function"==typeof c,s=t?c:jt(i,"string"==typeof c?c:c.type),u={context:a.context,event:e,self:n.self,system:n.system},p=t||"string"==typeof c?void 0:"params"in c?"function"==typeof c.params?c.params({context:a.context,event:e}):c.params:void 0;if(!s||!("resolve"in s)){n.actionExecutor({type:"string"==typeof c?c:"object"==typeof c?c.type:c.name||"(anonymous)",info:u,params:p,exec:s});continue}const d=s,[h,l,f]=d.resolve(n,a,u,p,s,r);a=h,"retryResolve"in d&&o?.push([d,l]),"execute"in d&&n.actionExecutor({type:d.type,info:u,params:l,exec:d.execute.bind(null,n,l)}),f&&(a=Ot(a,e,n,f,r,o))}return a}function At(t,e,n,s,r,o){const i=o?[]:void 0,a=Ot(t,e,n,s,{internalQueue:r,deferredActorIds:o},i);return i?.forEach((([t,e])=>{t.retryResolve(n,a,e)})),a}function Pt(t,e,n,s){let r=t;const o=[];function i(t,e,s){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:e,snapshot:t,_transitions:s}),o.push(t)}if(e.type===h)return r=Bt(Rt(r,e,n),{status:"stopped"}),i(r,e,[]),{snapshot:r,microstates:o};let a=e;if(a.type!==p){const e=a,c=function(t){return t.type.startsWith("xstate.error.actor")}(e),u=qt(e,r);if(c&&!u.length)return r=Bt(t,{status:"error",error:e.error}),i(r,e,[]),{snapshot:r,microstates:o};r=xt(u,t,n,a,!1,s),i(r,e,u)}let c=!0;for(;"active"===r.status;){let t=c?Mt(r,a):[];const e=t.length?r:void 0;if(!t.length){if(!s.length)break;a=s.shift(),t=qt(a,r)}r=xt(t,r,n,a,!1,s),c=r!==e,i(r,a,t)}return"active"!==r.status&&Rt(r,a,n),{snapshot:r,microstates:o}}function Rt(t,e,n){return At(t,e,n,Object.values(t.children).map((t=>K(t))),[],void 0)}function qt(t,e){return e.machine.getTransitionData(e,t)}function Mt(t,e){const n=new Set,s=t._nodes.filter(G);for(const r of s)t:for(const s of[r].concat(Q(r,void 0)))if(s.always)for(const r of s.always)if(void 0===r.guard||X(r.guard,t.context,e,t)){n.add(r);break t}return bt(Array.from(n),new Set(t._nodes),t.historyValue)}function Dt(t,e){return et(t,[...H(yt(t,e))])}const Vt=function(t){return v(t,this.value)},Ut=function(t){return this.tags.has(t)},Ct=function(t){const e=this.machine.getTransitionData(this,t);return!!e?.length&&e.some((t=>void 0!==t.target||t.actions.length))},Nt=function(){const{_nodes:t,tags:e,machine:n,getMeta:s,toJSON:r,can:o,hasTag:i,matches:a,...c}=this;return{...c,tags:Array.from(e)}},Ft=function(){return this._nodes.reduce(((t,e)=>(void 0!==e.meta&&(t[e.id]=e.meta),t)),{})};function Wt(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:et(e.root,t._nodes),tags:new Set(t._nodes.flatMap((t=>t.tags))),children:t.children,historyValue:t.historyValue||{},matches:Vt,hasTag:Ut,can:Ct,getMeta:Ft,toJSON:Nt}}function Bt(t,e={}){return Wt({...t,...e},t.machine)}function zt(t,e){const{_nodes:n,tags:s,machine:r,children:o,context:i,can:a,hasTag:c,matches:u,getMeta:p,toJSON:d,...h}=t,l={};for(const f in o){const t=o[f];l[f]={snapshot:t.getPersistedSnapshot(e),src:t.src,systemId:t._systemId,syncSnapshot:t._syncSnapshot}}return{...h,context:Jt(i),children:l}}function Jt(t){let e;for(const n in t){const s=t[n];if(s&&"object"==typeof s)if("sessionId"in s&&"send"in s&&"ref"in s)e??=Array.isArray(t)?t.slice():{...t},e[n]={xstate$$type:q,id:s.id};else{const r=Jt(s);r!==s&&(e??=Array.isArray(t)?t.slice():{...t},e[n]=r)}}return e??t}function Lt(t,e,n,s,{event:r,id:o,delay:i},{internalQueue:a}){const c=e.machine.implementations.delays;if("string"==typeof r)throw new Error(`Only event objects may be used with raise; use raise({ type: "${r}" }) instead`);const u="function"==typeof r?r(n,s):r;let p;if("string"==typeof i){const t=c&&c[i];p="function"==typeof t?t(n,s):t}else p="function"==typeof i?i(n,s):i;return"number"!=typeof p&&a.push(u),[e,{event:u,id:o,delay:p},void 0]}function Kt(t,e){const{event:n,delay:s,id:r}=e;"number"!=typeof s||t.defer((()=>{const e=t.self;t.system.scheduler.schedule(e,e,n,s,r)}))}function Xt(t,e){function n(t,e){}return n.type="xstate.raise",n.event=t,n.id=e?.id,n.delay=e?.delay,n.resolve=Lt,n.execute=Kt,n}},76163:function(t,e,n){n.d(e,{H6:function(){return g},OX:function(){return c},SP:function(){return o},Sx:function(){return h}});var s=n(70201);const r=new WeakMap;function o(t){return{config:t,start:(e,n)=>{const{self:s,system:o,emit:i}=n,a={receivers:void 0,dispose:void 0};r.set(s,a),a.dispose=t({input:e.input,system:o,self:s,sendBack:t=>
1{"stopped"!==s.getSnapshot().status&&s._parent&&o._relay(s,s._parent,t)},receive:t=>{a.receivers??=new Set,a.receivers.add(t)},emit:i})},transition:(t,e,n)=>{const o=r.get(n.self);return e.type===s.X?(t={...t,status:"stopped",error:void 0},o.dispose?.(),t):(o.receivers?.forEach((t=>t(e))),t)},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,input:e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}const i="xstate.observable.error",a="xstate.observable.complete";function c(t){return{config:t,transition:(t,e)=>{if("active"!==t.status)return t;switch(e.type){case i:return{...t,status:"error",error:e.data,input:void 0,_subscription:void 0};case a:return{...t,status:"done",input:void 0,_subscription:void 0};case s.X:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,context:void 0,input:e,_subscription:void 0}),start:(e,{self:n,system:s,emit:r})=>{"done"!==e.status&&(e._subscription=t({input:e.input,system:s,self:n,emit:r}).subscribe({next:t=>{n._parent&&s._relay(n,n._parent,t)},error:t=>{s._relay(n,n,{type:i,data:t})},complete:()=>{s._relay(n,n,{type:a})}}))},getPersistedSnapshot:({_subscription:t,...e})=>e,restoreSnapshot:t=>({...t,_subscription:void 0})}}const u="xstate.promise.resolve",p="xstate.promise.reject",d=new WeakMap;function h(t){return{config:t,transition:(t,e,n)=>{if("active"!==t.status)return t;switch(e.type){case u:{const n=e.data;return{...t,status:"done",output:n,input:void 0}}case p:return{...t,status:"error",error:e.data,input:void 0};case s.X:return d.get(n.self)?.abort(),{...t,status:"stopped",input:void 0};default:return t}},start:(e,{self:n,system:s,emit:r})=>{if("active"!==e.status)return;const o=new AbortController;d.set(n,o);Promise.resolve(t({input:e.input,system:s,self:n,signal:o.signal,emit:r})).then((t=>{"active"===n.getSnapshot().status&&(d.delete(n),s._relay(n,n,{type:u,data:t}))}),(t=>{"active"===n.getSnapshot().status&&(d.delete(n),s._relay(n,n,{type:p,data:t}))}))},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,input:e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}const l=(y=void 0,{config:f=t=>{},transition:(t,e,n)=>({...t,context:f(t.context,e,n)}),getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,context:"function"==typeof y?y({input:e}):y}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t});var f,y;function g(){return(0,s.A)(l)}}}]);
2//# sourceMappingURL=c8f7fe3b0e41be846d5687592cf2018ff6e22687-08a383c2e76885c34772.js.map

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.