PageSourceSearch

https://www.intel471.com/_next/static/immutable/chunks/2oq2eui03ajw0.js

js intel471.com collected 2026-09-24 08:29:37 UTC 74,443 bytes, 3 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,882476,568689,762472,634161,616986,629691,508832,333753,749610,902058,998703,845551,83659,178004,339876,510044,930975,863993,352530,630955,e=>{"use strict";let t,n,s,r,i;class o{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 a="xstate.init",u="xstate.error",c="xstate.stop";function l(e,t){return{type:`xstate.done.state.${e}`,output:t}}function p(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function f(e){return{type:a,input:e}}function d(e){setTimeout(()=>{throw e})}let h="function"==typeof Symbol&&Symbol.observable||"@@observable";function y(e){if(_(e))return e;let t=[],n="";for(let s=0;s<e.length;s++){switch(e.charCodeAt(s)){case 92:n+=e[s+1],s++;continue;case 46:t.push(n),n="";continue}n+=e[s]}return t.push(n),t}function g(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={},n=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)n[e[t]]=e[t+1];else{let s=n;n={},s[e[t]]=n}return t}(y(e))}function m(e,t){let n={},s=Object.keys(e);for(let r=0;r<s.length;r++){let i=s[r];n[i]=t(e[i],i,e,r)}return n}function v(e){var t;return void 0===e?[]:_(t=e)?t:[t]}function b(e,t,n,s){return"function"==typeof e?e({context:t,event:n,self:s}):e}function _(e){return Array.isArray(e)}function x(e){var t;return(_(t=e)?t:[t]).map(e=>void 0===e||"string"==typeof e?{target:e}:e)}function k(e){if(void 0!==e&&""!==e)return v(e)}function S(e,t,n){let s="object"==typeof e,r=s?e:void 0;return{next:(s?e.next:e)?.bind(r),error:(s?e.error:t)?.bind(r),complete:(s?e.complete:n)?.bind(r)}}function w(e,t){return`${t}.${e}`}function E(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,s,r]=n,i=e.getStateNodeById(r).config.invoke;return(Array.isArray(i)?i[s]:i).src}function I(e,t){if(t===e||"*"===t)return!0;if(!t.endsWith(".*"))return!1;let n=t.split("."),s=e.split(".");for(let e=0;e<n.length;e++){let t=n[e],r=s[e];if("*"===t)return e===n.length-1;if(t!==r)return!1}return!0}function $(e,t){return`${e.sessionId}.${t}`}let O=0;function j(e,t){let n=new Map,s=new Map,r=new WeakMap,i=new Set,o={},{clock:a,logger:u}=t,c={schedule:(e,t,n,s,r=Math.random().toString(36).slice(2))=>{let i={source:e,target:t,event:n,delay:s,id:r,startedAt:Date.now()},u=$(e,r);l._snapshot._scheduledEvents[u]=i;let c=a.setTimeout(()=>{delete o[u],delete l._snapshot._scheduledEvents[u],l._relay(e,t,n)},s);o[u]=c},cancel:(e,t)=>{let n=$(e,t),s=o[n];delete o[n],delete l._snapshot._scheduledEvents[n],void 0!==s&&a.clearTimeout(s)},cancelAll:e=>{for(let t in l._snapshot._scheduledEvents){let n=l._snapshot._scheduledEvents[t];n.source===e&&c.cancel(e,n.id)}}},l={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${O++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=r.get(e);void 0!==t&&(s.delete(t),r.delete(e))},get:e=>s.get(e),getAll:()=>Object.fromEntries(s.entries()),_set:(e,t)=>{let n=s.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);s.set(e,t),r.set(t,e)},inspect:e=>{let t=S(e);return i.add(t),{unsubscribe(){i.delete(t)}}},_sendInspectionEvent:t=>{if(!i.size)return;let n={...t,rootId:e.sessionId};i.forEach(e=>e.next?.(n))},_relay:(e,t,n)=>{l._sendInspectionEvent({type:"@xstate.event",sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{let e=l._snapshot._scheduledEvents;for(let t in l._snapshot._scheduledEvents={},e){let{source:n,target:s,event:r,delay:i,id:o}=e[t];c.schedule(n,s,r,i,o)}},_clock:a,_logger:u};return l}let A=!1,T=((eZ={})[eZ.NotStarted=0]="NotStarted",eZ[eZ.Running=1]="Running",eZ[eZ.Stopped=2]="Stopped",eZ),M={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class P{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 o(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=T.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={...M,...t},{clock:s,logger:r,parent:i,syncSnapshot:a,id:u,systemId:c,inspect:l}=n;this.system=i?i.system:j(this,{clock:s,logger:r}),l&&!i&&this.system.inspect(S(l)),this.sessionId=this.system._bookId(),this.id=u??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=i,this._syncSnapshot=a,this.options=n,this.src=n.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=>
1{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),n=this.eventListeners.get("*");if(t||n)for(let s of[...t?t.values():[],...n?n.values():[]])try{s(e)}catch(e){d(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=A;try{A=!0,e.exec(e.info,e.params)}finally{A=t}};this._processingStatus===T.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 n;for(this._snapshot=e;n=this._deferred.shift();)try{n()}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){d(e)}break;case"done":var s;for(let t of this.observers)try{t.next?.(e)}catch(e){d(e)}this._stopProcedure(),this._complete(),this._doneEvent=(s=this.id,{type:`xstate.done.actor.${s}`,output:this._snapshot.output,actorId:s}),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,n){let s=S(e,t,n);if(this._processingStatus!==T.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(e){d(e)}break;case"error":{let e=this._snapshot.error;if(s.error)try{s.error(e)}catch(e){d(e)}else d(e)}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let s=t.bind(void 0);return n.add(s),{unsubscribe:()=>{n.delete(s)}}}select(e,t=Object.is){return{subscribe:n=>{let s=S(n),r=e(this.getSnapshot());return this.subscribe(n=>{let i=e(n);t(r,i)||(r=i,s.next?.(i))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===T.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=T.Running;let e=f(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,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){n={err:e}}if(n){let{err:e}=n;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===T.Stopped||((this.mailbox.clear(),this._processingStatus===T.NotStarted)?this._processingStatus=T.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){d(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||d(e),this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let s=n.error;t||=!s;try{s?.(e)}catch(e){d(e)}}this.observers.clear(),this.eventListeners.clear(),t&&d(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,p(this.id,e))}_stopProcedure(){return this._processingStatus!==T.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new o(this._process.bind(this)),this._processingStatus=T.Stopped,this.system._unregister(this)),this}_send(e){this._processingStatus!==T.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:t}=this.options;t&&("function"==typeof t?t:t=>{if("u"<typeof window)return;let n=function(){let t="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g;if(t.__xstate__)return t.__xstate__}();n&&n.register(t)})(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[h](){return this}getSnapshot(){return this._snapshot}}function R(e,...[t]){return new P(e,t)}function q(e,t,n,s,{sendId:r}){return[t,{sendId:"function"==typeof r?r(n,s):r},void 0]}function N(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function C(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=q,t.execute=N,t}function D(e,t,n,s,{id:r,systemId:i,src:o,input:a,syncSnapshot:u}){let c,l,p="string"==typeof o?E(t.machine,o):o,f="function"==typeof r?r(n):r;return p&&(l="function"==typeof a?a({context:t.context,event:n.event,self:e.self}):a,c=R(p,{id:f,src:o,parent:e.self,syncSnapshot:u,systemId:i,input:l})),[eR(t,{children:{...t.children,[f]:c}}),{id:r,systemId:i,actorRef:c,src:o,input:l},void 0]}function U(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==T.Stopped&&t.start()})}function L(...[e,{id:t,systemId:n,input:s,syncSnapshot:r=!1}={}]){function i(e,t){}return i.type="xstate.spawnChild",i.id=t,i.systemId=n,i.src=e,i.input=s,i.syncSnapshot=r,i.resolve=D,i.execute=U,i}function B(e,t,n,s,{actorRef:r}){let i="function"==typeof r?r(n,s):r,o="string"==typeof i?t.children[i]:i,a=t.children;return o&&(a={...a},delete a[o.id]),[eR(t,{children:a}),o,void 0]}function V(e,t){if(t){if(!function e(t,n){let s=n.getSnapshot();if(s&&"children"in s)for(let n of Object.values(s.children))e(t,n);t.system._unregister(n)}(e,t),t._processingStatus!==T.Running)return void e.stopChild(t);e.defer(()=>{e.stopChild(t)})}}function W(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=B,t.execute=V,t}function J(e,{context:t,event:n},{guards:s}){return s.every(s=>F(s,t,n,e))}function F(e,t,n,s){let{machine:r}=s,i="function"==typeof e,o=i?e:r.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 F(o,t,n,s);let a={context:t,event:n},u=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:t,event:n}):e.params:void 0;return"check"in o?o.check(s,a,o):o(a,u)}function z(e){return"atomic"===e.type||"final"===e.type}function K(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function G(e,t){let n=[];if(t===e)return n;let s=e.parent;for(;s&&s!==t;)n.push(s),s=s.parent;return n}function H(e){let t=new Set(e),n=Y(t);for(let e of t)if("compound"!==e.type||n.get(e)&&n.get(e).length){if("parallel"===e.type){for(let n of K(e))if("history"!==n.type&&!t.has(n))for(let e of eu(n))t.add(e)}}
1else eu(e).forEach(e=>t.add(e));for(let e of t){let n=e.parent;for(;n;)t.add(n),n=n.parent}return t}function Y(e){let t=new Map;for(let n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function Q(e,t){return function e(t,n){let s=n.get(t);if(!s)return{};if("compound"===t.type){let e=s[0];if(!e)return{};if(z(e))return e.key}let r={};for(let t of s)r[t.key]=e(t,n);return r}(e,Y(H(t)))}function X(e,t){return"compound"===t.type?K(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?K(t).every(t=>X(e,t)):"final"===t.type}let Z=e=>"#"===e[0];function ee(e,t){let n=e.transitions.get(t),s=[...e.transitions.keys()].filter(e=>e!==t&&I(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t));return n?[...n,...s]:s}function et(e){let t=e.config.after;return t?Object.keys(t).flatMap(n=>{var s;let r,i,o=t[n],a=Number.isNaN(+n)?n:+n,u=(s=e.id,i=(r={type:`xstate.after.${a}.${s}`}).type,e.entry.push(eD(r,{id:i,delay:a})),e.exit.push(C(i)),i);return v("string"==typeof o?{target:o}:o).map(e=>({...e,event:u,delay:a}))}).map(t=>{let{delay:n}=t;return{...en(e,t.event,t),delay:n}}):[]}function en(e,t,n){let s=k(n.target),r=n.reenter??!1,i=function(e,t){if(void 0!==t)return t.map(t=>{if("string"!=typeof t)return t;if(Z(t))return e.machine.getStateNodeById(t);let n="."===t[0];if(n&&!e.parent)return ep(e,t.slice(1));let s=n?e.key+t:t;if(e.parent)try{return ep(e.parent,s)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':
2${t.message}`)}throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}(e,s),o={...n,actions:v(n.actions),guard:n.guard,target:i,source:e,reenter
2:r,eventType:t,toJSON:()=>({...o,source:`#${e.id}`,target:i?i.map(e=>`#${e.id}`):void 0})};return o}function es(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(""===n)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let s=e.config.on[n];t.set(n,x(s).map(t=>en(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,x(e.config.onDone).map(t=>en(e,n,t)))}for(let n of e.invoke){if(n.onDone){let s=`xstate.done.actor.${n.id}`;t.set(s,x(n.onDone).map(t=>en(e,s,t)))}if(n.onError){let s=`xstate.error.actor.${n.id}`;t.set(s,x(n.onError).map(t=>en(e,s,t)))}if(n.onSnapshot){let s=`xstate.snapshot.${n.id}`;t.set(s,x(n.onSnapshot).map(t=>en(e,s,t)))}}for(let n of e.after){let e=t.get(n.eventType);e||(e=[],t.set(n.eventType,e)),e.push(n)}return t}function er(e){let t=[],n=s=>{Object.values(s).forEach(s=>{if(s.config.route&&s.config.id){let n=s.config.id,r=s.config.route.guard,i=({event:e})=>e.to===`#${n}`,o={...s.config.route,guard:r?function(e){function t(e,t){return!1}return t.check=J,t.guards=e,t}([i,r]):i,target:`#${n}`};t.push(en(e,"xstate.route",o))}s.states&&n(s.states)})};n(e.states),t.length>0&&e.transitions.set("xstate.route",t)}function ei(e,t){let n="string"==typeof t?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let s={source:e,actions:t&&"string"!=typeof t?v(t.actions):[],eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...s,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return s}function eo(e){let t=k(e.config.target);return t?{target:t.map(t=>"string"==typeof t?ep(e.parent,t):t)}:"parallel"===e.parent.type?{target:[e.parent]}:e.parent.initial}function ea(e){return"history"===e.type}function eu(e){let t=ec(e);for(let n of t)for(let s of G(n,e))t.add(s);return t}function ec(e){let t=new Set;return!function e(n){if(!t.has(n)){if(t.add(n),"compound"===n.type)e(n.initial.target[0]);else if("parallel"===n.type)for(let t of K(n))e(t)}}(e),t}function el(e,t){if(Z(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 n=e.states[t];if(!n)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function ep(e,t){if("string"==typeof t&&Z(t))try{return e.machine.getStateNodeById(t)}catch{}let n=y(t).slice(),s=e;for(;n.length;){let e=n.shift();if(!e.length)break;s=el(s,e)}return s}function ef(e,t){if("string"==typeof t){let n=e.states[t];if(!n)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,n]}let n=Object.keys(t),s=n.map(t=>el(e,t)).filter(Boolean);return[e.machine.root,e].concat(s,n.reduce((n,s)=>{let r=el(e,s);if(!r)return n;let i=ef(r,t[s]);return n.concat(i)},[]))}function ed(e,t,n,s){if("string"==typeof t){let r;return(r=el(e,t).next(n,s))&&r.length?r:e.next(n,s)}if(1===Object.keys(t).length){let r,i;return(i=ed(el(e,(r=Object.keys(t))[0]),t[r[0]],n,s))&&i.length?i:e.next(n,s)}let r=[];for(let i of Object.keys(t)){let o=t[i];if(!o)continue;let a=ed(el(e,i),o,n,s);a&&r.push(...a)}return r.length?r:e.next(n,s)}function eh(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function ey(e,t,n){let s=new Set;for(let r of e){let e=!1,i=new Set;for(let o of s)if(function(e,t){let n=new Set(e),s=new Set(t);for(let e of n)if(s.has(e))return!0;for(let e of s)if(n.has(e))return!0;return!1}(ev([r],t,n),ev([o],t,n)))if(eh(r.source,o.source))i.add(o);else{e=!0;break}if(!e){for(let e of i)s.delete(e);s.add(r)}}return Array.from(s)}function eg(e,t){if(!e.target)return[];let n=new Set;for(let s of e.target)if(ea(s))if(t[s.id])for(let e of t[s.id])n.add(e);else for(let e of eg(eo(s),t))n.add(e);else n.add(s);return[...n]}function em(e,t){let n=eg(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||eh(t,e.source)))return e.source;let s=function(e){let[t,...n]=e;for(let e of G(t,void 0))if(n.every(t=>eh(t,e)))return e}(n.concat(e.source));return s||(e.reenter?void 0:e.source.machine.root)}function ev(e,t,n){let s=new Set;for(let r of e)if(r.target?.length){let e=em(r,n);for(let n of(r.reenter&&r.source===e&&s.add(e),t))eh(n,e)&&s.add(n)}return[...s]}function eb(e,t,n,s,r){return e_([{target:[...ec(e)],source:e,reenter
2:!0,actions:[],eventType:null,toJSON:null}],t,n,s,!0,r)}function e_(e,t,n,s,r,i){let o=[];if(!e.length)return[t,o];let a=n.actionExecutor;n.actionExecutor=e=>{o.push(e),a(e)};try{let a=new Set(t._nodes),u=t.historyValue,c=ey(e,a,u),p=t;r||([p,u]=function(e,t,n,s,r,i,o,a){let u,c=e,l=ev(s,r,i);for(let e of(l.sort((e,t)=>t.order-e.order),l))for(let t of function(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>"history"===e.type)}(e)){let n;n="deep"===t.history?t=>z(t)&&eh(t,e):t=>t.parent===e,(u??={...i})[t.id]=Array.from(r).filter(n)}for(let e of l)c=eS(c,t,n,[...e.exit,...e.invoke.map(e=>W(e.id))],o,void 0),r.delete(e);return[c,u||i]}(p,s,n,c,a,u,i,n.actionExecutor)),p=eS(p,s,n,c.flatMap(e=>e.actions),i,void 0),p=function(e,t,n,s,r,i,o,a){let u=e,c=new Set,p=new Set;(function(e,t,n,s){for(let r of e){let e=em(r,t);for(let i of r.target||[])!ea(i)&&(r.source!==i||r.source!==e||r.reenter)&&(s.add(i),n.add(i)),ex(i,t,n,s);for(let i of eg(r,t)){let o=G(i,e);e?.type==="parallel"&&o.push(e),ek(s,t,n,o,!r.source.parent&&r.reenter?void 0:e)}}})(s,o,p,c),a&&p.add(e.machine.root);let f=new Set;for(let e of[...c].sort((e,t)=>e.order-t.order)){r.add(e);let s=[];for(let t of(s.push(...e.entry),e.invoke))s.push(L(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(p.has(e)){let t=e.initial.actions;s.push(...t)}if(u=eS(u,t,n,s,i,e.invoke.map(e=>e.id)),"final"===e.type){let s=e.parent,o=s?.type==="parallel"?s:s?.parent,a=o||e;for(s?.type==="compound"&&i.push(l(s.id,void 0!==e.output?b(e.output,u.context,t,n.self):void 0));o?.type==="parallel"&&!f.has(o)&&X(r,o);)f.add(o),i.push(l(o.id)),a=o,o=o.parent;if(o)continue;u=eR(u,{status:"done",output:function(e,t,n,s,r){if(void 0===s.output)return;let i=l(r.id,void 0!==r.output&&r.parent?b(r.output,e.context,t,n.self):void 0);return b(s.output,e.context,i,n.self)}(u,t,n,u.machine.root,a)})}}return u}(p,s,n,c,a,i,u,r);let f=[...a];"done"===p.status&&(p=eS(p,s,n,f.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),i,void 0));try{if(u===t.historyValue&&function(e,t){if(e.length!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}(t._nodes,a))return[p,o];return[eR(p,{_nodes:f,historyValue:u}),o]}catch(e){throw e}}finally{n.actionExecutor=a}}function ex(e,t,n,s){var r,i,o,a;if(ea(e))if(t[e.id]){let o=t[e.id];for(let e of o)s.add(e),ex(e,t,n,s);for(let a of o){r=a,i=e.parent,ek(s,t,n,G(r,i))}}else{let r=eo(e);for(let i of r.target)s.add(i),r===e.parent?.initial&&n.add(e.parent),ex(i,t,n,s);for(let i of r.target){o=i,a=e.parent,ek(s,t,n,G(o,a))}}else if("compound"===e.type){let[r]=e.initial.target;ea(r)||(s.add(r),n.add(r)),ex(r,t,n,s),ek(s,t,n,G(r,e))}else if("parallel"===e.type)for(let r of K(e).filter(e=>!ea(e)))[...s].some(e=>eh(e,r))||(ea(r)||(s.add(r),n.add(r)),ex(r,t,n,s))}function ek(e,t,n,s,r){for(let i of s)if((!r||eh(i,r))&&e.add(i),"parallel"===i.type)for(let s of K(i).filter(e=>!ea(e)))[...e].some(e=>eh(e,s))||(e.add(s),ex(s,t,n,e))}function eS(e,t,n,s,r,i){let o=i?[]:void 0,a=function e(t,n,s,r,i,o){let{machine:a}=t,u=t;for(let t of r){var c;let r="function"==typeof t,l=r?t:(c="string"==typeof t?t:t.type,a.implementations.actions[c]),p={context:u.context,event:n,self:s.self,system:s.system},f=r||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:u.context,event:n}):t.params:void 0;if(!l||!("resolve"in l)){s.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:p,params:f,exec:l});continue}let[d,h,y]=l.resolve(s,u,p,f,l,i);u=d,"retryResolve"in l&&o?.push([l,h]),"execute"in l&&s.actionExecutor({type:l.type,info:p,params:h,exec:l.execute.bind(null,s,h)}),y&&(u=e(u,n,s,y,i,o))}return u}(e,t,n,s,{internalQueue:r,deferredActorIds:i},o);return o?.forEach(([e,t])=>{e.retryResolve(n,a,t)}),a}function ew(e,t,n,s){let r=e,i=[];function o(e,t,s){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:t,snapshot:e[0],_transitions:s}),i.push(e)}if(t.type===c)return o([r=eR(eE(r,t,n),{status:"stopped"}),[]],t,[]),{snapshot:r,microsteps:i};let u=t;if(u.type!==a){let t=u,a=t.type.startsWith("xstate.error.actor"),c=eI(t,r);if(a&&!c.length)return o([r=eR(e,{status:"error",error:t.error}),[]],t,[]),{snapshot:r,microsteps:i};let l=e_(c,e,n,u,!1,s);r=l[0],o(l,t,c)}let l=!0,p=e.machine.options?.maxIterations??1/0,f=0;for(;"active"===r.status;){if(++f>p)throw Error(`Infinite loop detected: the machine has processed more than ${p} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let e=l?function(e,t){let n=new Set;for(let s of e._nodes.filter(z))e:for(let r of[s].concat(G(s,void 0)))if(r.always){for(let s of r.always)if(void 0===s.guard||F(s.guard,e.context,t,e)){n.add(s);break e}}return ey(Array.from(n),new Set(e._nodes),e.historyValue)}(r,u):[],t=e.length?r:void 0;if(!e.length){if(!s.length)break;e=eI(u=s.shift(),r)}let i=e_(e,r,n,u,!1,s);l=(r=i[0])!==t,o(i,u,e)}return"active"!==r.status&&eE(r,u,n),{snapshot:r,microsteps:i}}
2function eE(e,t,n){return eS(e,t,n,Object.values(e.children).map(e=>W(e)),[],void 0)}function eI(e,t){return t.machine.getTransitionData(t,e)}function e$(e,t){let n=H(ef(e,t));return Q(e,[...n])}let eO=function(e){return function e(t,n){let s=g(t),r=g(n);return"string"==typeof r?"string"==typeof s&&r===s:"string"==typeof s?s in r:Object.keys(s).every(t=>t in r&&e(s[t],r[t]))}(e,this.value)},ej=function(e){return this.tags.has(e)},eA=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eT=function(){let{_nodes:e,tags:t,machine:n,getMeta:s,toJSON:r,can:i,hasTag:o,matches:a,...u}=this;return{...u,tags:Array.from(t)}},eM=function(){return this._nodes.reduce((e,t)=>(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function eP(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:Q(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:eO,hasTag:ej,can:eA,getMeta:eM,toJSON:eT}}function eR(e,t={}){return eP({...e,...t},e.machine)}function eq(e,t){let{_nodes:n,tags:s,machine:r,children:i,context:o,can:a,hasTag:u,matches:c,getMeta:l,toJSON:p,...f}=e,d={};for(let e in i){let n=i[e];d[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...f,context:function e(t){let n;for(let s in t){let r=t[s];if(r&&"object"==typeof r)if("sessionId"in r&&"send"in r&&"ref"in r)(n??=Array.isArray(t)?t.slice():{...t})[s]={xstate$$type:1,id:r.id};else{let i=e(r);i!==r&&((n??=Array.isArray(t)?t.slice():{...t})[s]=i)}}return n??t}(o),children:d,historyValue:function(e){if("object"!=typeof e||null===e)return{};let t={};for(let n in e){let s=e[n];Array.isArray(s)&&(t[n]=s.map(e=>({id:e.id})))}return t}(f.historyValue)}}function eN(e,t,n,s,{event:r,id:i,delay:o},{internalQueue:a}){let u,c=t.machine.implementations.delays;if("string"==typeof r)throw Error(`Only event objects may be used with raise; use raise({ type: "${r}" }) instead`);let l="function"==typeof r?r(n,s):r;if("string"==typeof o){let e=c&&c[o];u="function"==typeof e?e(n,s):e}else u="function"==typeof o?o(n,s):o;return"number"!=typeof u&&a.push(l),[t,{event:l,id:i,delay:u},void 0]}function eC(e,t){let{event:n,delay:s,id:r}=t;if("number"==typeof s)return void e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,s,r)})}function eD(e,t){function n(e,t){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=eN,n.execute=eC,n}e.s(["$",0,1,"B",0,es,"C",0,x,"D",0,en,"E",0,F,"F",0,w,"G",0,et,"H",0,ei,"I",0,ee,"J",0,er,"K",0,e$,"L",0,H,"M",0,eP,"N",0,"","O",0,X,"P",0,ed,"Q",0,eS,"R",0,eR,"S",0,".","T",0,y,"U",0,Z,"V",0,ep,"W",0,eq,"X",0,c,"Y",0,E,"Z",0,u,"_",0,p,"a",0,j,"a0",0,T,"b",0,C,"c",0,R,"d",0,L,"e",0,ew,"f",0,f,"g",0,eb,"h",0,G,"i",0,z,"m",0,I,"q",0,ef,"r",0,eD,"s",0,W,"t",0,v,"z",0,m],568689);let eU=new WeakMap;function eL(e){return{config:e,start:(t,n)=>{let{self:s,system:r,emit:i}=n,o={receivers:void 0,dispose:void 0};eU.set(s,o),o.dispose=e({input:t.input,system:r,self:s,sendBack:e=>{"stopped"!==s.getSnapshot().status&&s._parent&&r._relay(s,s._parent,e)},receive:e=>{o.receivers??=new Set,o.receivers.add(e)},emit:i})},transition:(e,t,n)=>{let s=eU.get(n.self);return t.type===c?(e={...e,status:"stopped",error:void 0},eU.delete(n.self),s.receivers?.clear(),s.dispose?.()):s.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 eB="xstate.observable.error",eV="xstate.observable.complete";function eW(e){return{config:e,transition:(e,t)=>{if("active"!==e.status)return e;switch(t.type){case eB:return{...e,status:"error",error:t.data,input:void 0,_subscription:void 0};case eV:return{...e,status:"done",input:void 0,_subscription:void 0};case c:return e._subscription.unsubscribe(),{...e,status:"stopped",input:void 0,_subscription:void 0};default:return e}},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,context:void 0,input:t,_subscription:void 0}),start:(t,{self:n,system:s,emit:r})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:s,self:n,emit:r}).subscribe({next:e=>{n._parent&&s._relay(n,n._parent,e)},error:e=>{s._relay(n,n,{type:eB,data:e})},complete:()=>{s._relay(n,n,{type:eV})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}let eJ="xstate.promise.resolve",eF="xstate.promise.reject",ez=new WeakMap,eK=(e1=void 0,{config:e0=e=>void 0,transition:(e,t,n)=>({...e,context:e0(e.context)}),getInitialSnapshot:(e,t)=>
2({status:"active",output:void 0,error:void 0,context:"function"==typeof e1?e1({input:t}):e1}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e});function eG(){return R(eK)}e.s(["createEmptyActor",0,eG,"fromCallback",0,eL,"fromEventObservable",0,eW,"fromPromise",0,function(e){return{config:e,transition:(e,t,n)=>{if("active"!==e.status)return e;switch(t.type){case eJ:{let n=t.data;return{...e,status:"done",output:n,input:void 0}}case eF:return{...e,status:"error",error:t.data,input:void 0};case c:return ez.get(n.self)?.abort(),ez.delete(n.self),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:n,system:s,emit:r})=>{if("active"!==t.status)return;let i=new AbortController;ez.set(n,i),Promise.resolve(e({input:t.input,system:s,self:n,signal:i.signal,emit:r})).then(e=>{"active"===n.getSnapshot().status&&(ez.delete(n),s._relay(n,n,{type:eJ,data:e}))},e=>{"active"===n.getSnapshot().status&&(ez.delete(n),s._relay(n,n,{type:eF,data:e}))})},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}],762472);let eH=eG(),eY=eH,eQ=new Set;function eX(e){return e===eH}e.s(["a",0,function(e){for(let t of(eY=e,eQ))t()},"i",0,eQ,"n",0,eH,"r",0,eX,"t",()=>eY],634161);var eZ,e0,e1,e6,e2,e3=e.i(20165),e5=e.i(567468),e8=e.i(134921),e9=e.i(878524);function e4(e){return e.split(/[[.\]]/g).filter(Boolean).map(e=>{var t;return e.includes("==")?function(e){let[t,n]=e.split("==");if("_key"!==t)throw Error(`Currently only "_key" is supported as path segment. Found ${t}`);if(typeof n>"u")throw Error('Invalid path segment, expected `key=="value"`');return{_key:n.replace(/^['"]/,"").replace(/['"]$/,"")}}(e):e7.test(t=e)?Number(t):t})}let e7=/^-?\d+$/;function te(e){return"string"==typeof e?._key}function tt(e){return"object"==typeof e&&"_key"in e&&"string"==typeof e._key}let tn=/^[a-z_$]+/;function ts(e){return e.map((e,t)=>{var n;return n=0===t,Array.isArray(e)?`[${e[0]}:${e[1]||""}]`:"number"==typeof e?`[${e}]`:tt(e)?`[_key==${JSON.stringify(e._key)}]`:"string"==typeof e&&tn.test(e)?n?e:`.${e}`:`['${e}']`}).join("")}function tr(e){return Array.isArray(e)?e:[e]}function ti(e){if("createIfNotExists"in e)return{type:"createIfNotExists",document:e.createIfNotExists};if("createOrReplace"in e)return{type:"createOrReplace",document:e.createOrReplace};if("create"in e)return{type:"create",document:e.create};if("delete"in e)return{id:e.delete.id,type:"delete"};if("patch"in e){var t,n,s,r,i,o,a;return{type:"patch",id:e.patch.id,patches:[..."set"in(n=t=e.patch)?Object.keys(n.set).map(e=>({path:e4(e),op:{type:"set",value:n.set[e]}})):[],..."setIfMissing"in(s=t)?Object.keys(s.setIfMissing).map(e=>({path:e4(e),op:{type:"setIfMissing",value:s.setIfMissing[e]}})):[],..."unset"in(r=t)?r.unset.map(e=>({path:e4(e),op:{type:"unset"}})):[],..."inc"in(i=t)?Object.keys(i.inc).map(e=>({path:e4(e),op:{type:"inc",amount:i.inc[e]}})):[],..."inc"in(o=t)?Object.keys(o.dec).map(e=>({path:e4(e),op:{type:"dec",amount:o.dec[e]}})):[],...function(e){if(!("insert"in e))return[];let t=function(e){let t=to.filter(t=>t in e);if(t.length>1)throw Error(`Insert patch is ambiguous. Should only contain one of: ${to.join(", ")}, instead found ${t.join(", ")}`);return t[0]}(e.insert);if(!t)throw Error("Insert patch missing position");let n=e4(e.insert[t]),s=n.pop();return[{path:n,op:{type:"insert",position:t,referenceItem:s,items:e.insert.items}}]}(t),..."diffMatchPatch"in(a=t)?Object.keys(a.diffMatchPatch).map(e=>({path:e4(e),op:{type:"diffMatchPatch",value:a.diffMatchPatch[e]}})):[]]}}throw Error(`Unknown mutation: ${JSON.stringify(e)}`)}e.s(["isArrayElement",0,function(e){return"number"==typeof e||tt(e)},"isKeyedElement",0,tt,"isPropertyElement",0,function(e){return"string"==typeof e},"startsWith",0,function(e,t){return e.length<=t.length&&e.every((e,n)=>{var s,r;return s=e,r=function(e,t){if(t<0||t>=e.length)throw Error("Index out of bounds");return e[t]}(t,n),te(s)&&te(r)?s._key===r._key:"number"==typeof s?Number(s)===Number(r):s===r})},"stringify",0,ts],616986);let to=["before","replace","after"];function ta(e){return tl(e)}function tu(e){return e.flatMap(ta)}function tc(e){return{transactionId:e.id,mutations:tu(e.mutations)}}function tl(e){switch(e.type){case"create":case"createIfNotExists":case"createOrReplace":return{[e.type]:e.document};case"delete":return{delete:{id:e.id}};case"patch":{let t=e.options?.ifRevision;return e.patches.map(n=>({patch:{id:e.id,...t&&{ifRevisionID:t},...tp(n)}}))}}}function tp(e){let{path:t,op:n}=e;if("unset"===n.type)return{unset:[ts(t)]};if("insert"===n.type)return{insert:{[n.position]:ts([...t,n.referenceItem]),items:n.items}};if("diffMatchPatch"===n.type)return{diffMatchPatch:{[ts(t)]:n.value}};if("inc"===n.type)return{inc:{[ts(t)]:n.amount}};if("dec"===n.type)return{dec:{[ts(t)]:n.amount}};if("set"===n.type||"setIfMissing"===n.type)return{[n.type]:{[ts(t)]:n.value}};if("truncate"===n.type){let e=[n.startIndex,"number"==typeof n.endIndex?n.endIndex:""].join(":");return{unset:[`${ts(t)}[${e}]`]}}if("upsert"===n.type)return{unset:n.items.map(e=>
2ts([...t,{_key:e._key}])),insert:{[n.position]:ts([...t,n.referenceItem]),items:n.items}};if("assign"===n.type)return{set:Object.fromEntries(Object.keys(n.value).map(e=>[ts(t.concat(e)),n.value[e]]))};if("unassign"===n.type)return{unset:n.keys.map(e=>ts(t.concat(e)))};if("replace"===n.type)return{insert:{replace:ts(t.concat(n.referenceItem)),items:n.items}};if("remove"===n.type)return{unset:[ts(t.concat(n.referenceItem))]};throw"insertIfMissing"===n.type?Error("Patch type insertIfMissing is not supported by Sanity"):Error(`Unknown operation type ${n.type}`)}e.s(["encode",0,ta,"encodeAll",0,tu,"encodeMutation",0,tl,"encodePatch",0,tp,"encodeTransaction",0,tc],629691),e.s(["isObject",0,function(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}],508832);function tf(e,t,n){return{type:"patch",id:e,patches:tr(t),...n?{options:n}:{}}}function td(e,t){return{path:"string"==typeof e?e4(e):e,op:t}}function th(e){return{type:"createIfNotExists",document:e}}function ty(e,t,n){return{type:"insert",referenceItem:n,position:t,items:tr(e)}}function tg(e,t){return{type:"truncate",startIndex:e,endIndex:t}}var tm=Object.freeze({__proto__:null,decode:function(e){return ti(e)},decodeAll:function(e){return e.map(ti)},encode:ta,encodeAll:tu,encodeMutation:tl,encodePatch:tp,encodeTransaction:tc});e.s(["SanityEncoder",0,tm,"at",0,td,"createIfNotExists",0,th,"insert",0,ty,"patch",0,tf,"remove",0,function(e){return{type:"remove",referenceItem:e}},"truncate",0,tg],333753);let tv=new Uint8Array(16),tb=[];for(let e=0;e<256;++e)tb.push((e+256).toString(16).slice(1));let t_=function(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){let s=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(tv);if(s.length<16)throw Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=s[e];return t}return function(e,t=0){return(tb[e[t+0]]+tb[e[t+1]]+tb[e[t+2]]+tb[e[t+3]]+"-"+tb[e[t+4]]+tb[e[t+5]]+"-"+tb[e[t+6]]+tb[e[t+7]]+"-"+tb[e[t+8]]+tb[e[t+9]]+"-"+tb[e[t+10]]+tb[e[t+11]]+tb[e[t+12]]+tb[e[t+13]]+tb[e[t+14]]+tb[e[t+15]]).toLowerCase()}(s)}(e,t,n):crypto.randomUUID()};function tx(e,t,n,s,{assignment:r}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let i={},o={context:t.context,event:n.event,spawn:function(e,{machine:t,context:n},s,r){return(i,o)=>{let a=((i,o)=>{if("string"!=typeof i)return R(i,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:o?.input,src:i,systemId:o?.systemId});{let a=E(t,i);if(!a)throw Error(`Actor logic '${i}' not implemented in machine '${t.id}'`);let u=R(a,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:"function"==typeof o?.input?o.input({context:n,event:s,self:e.self}):o?.input,src:i,systemId:o?.systemId});return r[u.id]=u,u}})(i,o);return r[a.id]=a,e.defer(()=>{a._processingStatus!==T.Stopped&&a.start()}),a}}(e,t,n.event,i),self:e.self,system:e.system},a={};if("function"==typeof r)a=r(o,s);else for(let e of Object.keys(r)){let t=r[e];a[e]="function"==typeof t?t(o,s):t}let u=Object.assign({},t.context,a);return[eR(t,{context:u,children:Object.keys(i).length?{...t.children,...i}:t.children}),void 0,void 0]}function tk(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=tx,t}let tS=new WeakMap;function tw(e,t,n){let s=tS.get(e);return s?t in s||(s[t]=n()):(s={[t]:n()},tS.set(e,s)),s[t]}let tE={},tI=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class t${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("."),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?m(this.config.states,(e,t)=>new t$(e,{_parent:this,_key:t,_machine:this.machine})):tE,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for c
2ompound 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=v(this.config.entry).slice(),this.exit=v(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=v(e.tags).slice()}_initialize(){this.transitions=es(this),this.config.always&&(this.always=x(this.config.always).map(e=>en(this,"",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.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(tI),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(tI),eventType:null})}:void 0,history:this.history,states:m(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(tI)})),entry:this.entry.map(tI),exit:this.exit.map(tI),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 tw(this,"invoke",()=>v(this.config.invoke).map((e,t)=>{let{src:n,systemId:s}=e,r=e.id??w(this.id,t),i="string"==typeof n?n:`xstate.invoke.${w(this.id,t)}`;return{...e,src:i,id:r,systemId:s,toJSON(){let{onDone:t,onError:n,...s}=e;return{...s,type:"xstate.invoke",src:i,id:r}}}}))}get on(){return tw(this,"on",()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return tw(this,"delayedTransitions",()=>et(this))}get initial(){return tw(this,"initial",()=>ei(this,this.config.initial))}next(e,t){let n,s=t.type,r=[];for(let i of tw(this,`candidates-${s}`,()=>ee(this,s))){let{guard:o}=i,a=e.context,u=!1;try{u=!o||F(o,a,t,e)}catch(t){let e="string"==typeof o?o:"object"==typeof o?o.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${s}' in state node '${this.id}':
3${t.message}`)}if(u){r.push(...i.actions),n=i;break}}return n?[n]:void 0}get events(){return tw(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let s=e[n];if(s.states)for(let e of s.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){return Array.from(new Set(Object.keys(Object.fromEntries(this.transitions)).filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter)))))}}class tO{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.options=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.options={maxIterations:1/0,...this.config.options},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 t$(e,{_key:this.id,_machine:this}),this.root._initialize(),er(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:s,delays:r}=this.implementations;return new tO(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...s,...e.actors},delays:{...r,...e.delays}})}resolveState(e){let t=e$(this.root,e.value),n=H(ef(this.root,t));return eP({_nodes:[...n],context:e.context||{},children:{},status:X(n,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return ew(e,t,n,[]).snapshot}microstep(e,t,n){return ew(e,t,n,[]).microsteps.map(([e])=>e)}getTransitionData(e,t){return ed(this.root,e.value,e,t)||[]}_getPreInitialState(e,t,n){let{context:s}=this.config,r=eP({context:"function"!=typeof s&&s?s:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof s?eS(r,t,e,[tk(({spawn:e,event:t,self:n})=>s({spawn:e,input:t.input,self:n}))],n,void 0):r}getInitialSnapshot(e,t){let n=f(t),s=[],r=eP({context:"function"!=typeof this.config.context&&this.config.context?this.config.context:{},_nodes:[this.root],children:{},status:"active"},this);try{r=this._getPreInitialState(e,n,s);let[t]=eb(this.root,r,e,n,s),{snapshot:i}=ew(t,n,e,s);return i}catch(e){return eR(r,{status:"error",error:e})}}
3start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=y(e),n=t.slice(1),s=Z(t[0])?t[0].slice(1):t[0],r=this.idMap.get(s);if(!r)throw Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);return ep(r,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return eq(e,t)}restoreSnapshot(e,t){let n={},s=e.children;Object.keys(s).forEach(e=>{let r=s[e],i=r.snapshot,o=r.src,a="string"==typeof o?E(this,o):o;if(!a)return;let u=R(a,{id:e,parent:t.self,syncSnapshot:r.syncSnapshot,snapshot:i,src:o,systemId:r.systemId});n[e]=u});let r=function(e,t){if(!t||"object"!=typeof t)return{};let n={};for(let s in t)for(let r of t[s]){let t=function(e,t){if(t instanceof t$)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,r);t&&(n[s]??=[],n[s].push(t))}return n}(this.root,e.historyValue),i=eP({...e,children:n,_nodes:Array.from(H(ef(this.root,e.value))),historyValue:r},this),o=new Set;return!function e(t,n){if(!o.has(t))for(let s in o.add(t),t){let r=t[s];if(r&&"object"==typeof r){if("xstate$$type"in r&&1===r.xstate$$type){t[s]=n[r.id];continue}e(r,n)}}}(i.context,n),i}}function tj(e,t,n,s,{event:r}){return[t,{event:"function"==typeof r?r(n,s):r},void 0]}function tA(e,{event:t}){e.defer(()=>e.emit(t))}function tT(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=tj,t.execute=tA,t}let tM=((e6={}).Parent="#_parent",e6.Internal="#_internal",e6);function tP(e,t,n,s,{to:r,event:i,id:o,delay:a},u){let c,l,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(n,s):i;if("string"==typeof a){let e=p&&p[a];c="function"==typeof e?e(n,s):e}else c="function"==typeof a?a(n,s):a;let d="function"==typeof r?r(n,s):r;if("string"==typeof d){if(!(l=d===tM.Parent?e.self._parent:d===tM.Internal?e.self:d.startsWith("#_")?t.children[d.slice(2)]:u.deferredActorIds?.includes(d)?d:t.children[d]))throw Error(`Unable to send event to actor '${d}' from machine '${t.machine.id}'.`)}else l=d||e.self;return[t,{to:l,targetId:"string"==typeof d?d:void 0,event:f,id:o,delay:c},void 0]}function tR(e,t,n){"string"==typeof n.to&&(n.to=t.children[n.to])}function tq(e,t){e.defer(()=>{let{to:n,event:s,delay:r,id:i}=t;"number"==typeof r?e.system.scheduler.schedule(e.self,n,s,r,i):e.system._relay(e.self,n,s.type===u?p(e.self.id,s.data):s)})}function tN(e,t,n){function s(e,t){}return s.type="xstate.sendTo",s.to=e,s.event=t,s.id=n?.id,s.delay=n?.delay,s.resolve=tP,s.retryResolve=tR,s.execute=tq,s}function tC(e,t){return tN(tM.Parent,e,t)}function tD(e,t,n,s,{collect:r}){let i=[],o=function(e){i.push(e)};return o.assign=(...e)=>{i.push(tk(...e))},o.cancel=(...e)=>{i.push(C(...e))},o.raise=(...e)=>{i.push(eD(...e))},o.sendTo=(...e)=>{i.push(tN(...e))},o.sendParent=(...e)=>{i.push(tC(...e))},o.spawnChild=(...e)=>{i.push(L(...e))},o.stopChild=(...e)=>{i.push(W(...e))},o.emit=(...e)=>{i.push(tT(...e))},r({context:n.context,event:n.event,enqueue:o,check:e=>F(e,t.context,n.event,t),self:e.self,system:e.system},s),[t,void 0,i]}function tU(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=tD,t}function tL(e,t,n,s,{value:r,label:i}){return[t,{value:"function"==typeof r?r(n,s):r,label:i},void 0]}function tB({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function tV(e=({context:e,event:t})=>({context:e,event:t}),t){function n(e,t){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=tL,n.execute=tB,n}function tW(e,t){let n=v(t);if(!n.some(t=>I(e.type,t))){let t=1===n.length?`type matching "${n[0]}"`:`one of types matching "${n.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function tJ({schemas:e,actors:t,actions:n,guards:s,delays:r}){return{assign:tk,sendTo:tN,raise:eD,log:tV,cancel:C,stopChild:W,enqueueActions:tU,emit:tT,spawnChild:L,createStateConfig:e=>e,createAction:e=>e,createMachine:i=>new tO({...i,schemas:e},{actors:t,actions:n,guards:s,delays:r}),extend:i=>tJ({schemas:e,actors:t,actions:{...n,...i.actions},guards:{...s,...i.guards},delays:{...r,...i.delays}})}}e.s(["a",0,tT,"b",0,tC,"e",0,tU,"l",0,tV,"s",0,tN],749610),e.s(["assertEvent",0,tW,"setup",0,tJ],902058),e.s(["assign",0,tk],998703),e.s(["createActor",0,R],845551),e.s(["emit",0,tT],83659),e.s(["enqueueActions",0,tU],178004),e.s(["raise",0,eD],339876),e.s(["stopChild",0,W],510044);
3var tF=e.i(982100),tz=e.i(824627),tK=e.i(866312),tG=e.i(7560),tH=e.i(907844),tY=e.i(806298),tQ=e.i(827540),tX=e.i(159862),tZ=e.i(80205),t0=e.i(633482),t1=e.i(516165),t6=e.i(602435),t2=e.i(913186),t3=Array.isArray,t5=["addListener","removeListener"],t8=["addEventListener","removeEventListener"],t9=["on","off"];function t4(e,t,n,s){if((0,tQ.isFunction)(n)&&(s=n,n=void 0),s){return t4(e,t,n).pipe((r=s,(0,t2.map)(function(e){return t3(e)?r.apply(void 0,(0,tz.__spreadArray)([],(0,tz.__read)(e))):r(e)})))}var r,i,o,a,u=(0,tz.__read)((i=e,(0,tQ.isFunction)(i.addEventListener)&&(0,tQ.isFunction)(i.removeEventListener))?t8.map(function(s){return function(r){return e[s](t,r,n)}}):(o=e,(0,tQ.isFunction)(o.addListener)&&(0,tQ.isFunction)(o.removeListener))?t5.map(t7(e,t)):(a=e,(0,tQ.isFunction)(a.on)&&(0,tQ.isFunction)(a.off))?t9.map(t7(e,t)):[],2),c=u[0],l=u[1];if(!c&&(0,t6.isArrayLike)(e))return(0,tY.mergeMap)(function(e){return t4(e,t,n)})((0,t0.innerFrom)(e));if(!c)throw TypeError("Invalid event target");return new t1.Observable(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return c(t),function(){return l(t)}})}function t7(e,t){return function(n){return function(s){return e[n](t,s)}}}var ne=e.i(913072);function nt(e){return e<=0?function(){return tF.EMPTY}:(0,tK.operate)(function(t,n){var s=0;t.subscribe((0,tG.createOperatorSubscriber)(n,function(t){++s<=e&&(n.next(t),e<=s&&n.complete())}))})}var nn=e.i(450363);let ns=e=>({context:t})=>{let{count:n,include:s,exclude:r,responseType:i="message.received"}=e;return{count:n,domain:t.domain,from:t.connectTo,include:s?Array.isArray(s)?s:[s]:[],exclude:r?Array.isArray(r)?r:[r]:[],responseType:i,target:t.target,to:t.name}},nr=(0,tX.defer)(()=>t4(window,"message")),ni=e=>eW(({input:t})=>{var n,s,r;let i;return nr.pipe(e?(0,t2.map)(e):(0,ne.pipe)(),(0,tZ.filter)(e=>{let{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)}),(0,t2.map)((i=t.responseType,e=>({type:i,message:e}))),t.count?(0,ne.pipe)((n=t.count,void 0===s&&(s=null),s=null!=s?s:n,(0,tK.operate)(function(e,t){var r=[],i=0;e.subscribe((0,tG.createOperatorSubscriber)(t,function(e){var o,a,u,c,l=null;i++%s==0&&r.push([]);try{for(var p=(0,tz.__values)(r),f=p.next();!f.done;f=p.next()){var d=f.value;d.push(e),n<=d.length&&(l=null!=l?l:[]).push(d)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}if(l)try{for(var h=(0,tz.__values)(l),y=h.next();!y.done;y=h.next()){var d=y.value;(0,tH.arrRemove)(r,d),t.next(d)}}catch(e){u={error:e}}finally{try{y&&!y.done&&(c=h.return)&&c.call(h)}finally{if(u)throw u.error}}},function(){var e,n;try{for(var s=(0,tz.__values)(r),i=s.next();!i.done;i=s.next()){var o=i.value;t.next(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}t.complete()},void 0,function(){r=null}))})),(r=e=>e,(0,tQ.isFunction)(void 0)?(0,tY.mergeMap)(r,void 0,1):(0,tY.mergeMap)(r,1)),nt(t.count)):(0,ne.pipe)())}),no="sanity/comlink",na="comlink/response",nu="comlink/heartbeat",nc="comlink/disconnect",nl="comlink/handshake/syn",np="comlink/handshake/syn-ack",nf="comlink/handshake/ack",nd=()=>tJ({types:{},actors:{listen:eW(({input:e})=>{let t,n=e.signal?t4(e.signal,"abort").pipe((t=`Request ${e.requestId} aborted`,e=>e.pipe(nt(1),(0,t2.map)(()=>{throw Error(t)})))):tF.EMPTY;return t4(window,"message").pipe((0,tZ.filter)(t=>t.data?.type==="comlink/response"&&t.data?.responseTo===e.requestId&&!!t.source&&e.sources.has(t.source)),nt(e.sources.size),(0,tK.operate)(function(e,t){(0,t0.innerFrom)(n).subscribe((0,tG.createOperatorSubscriber)(t,function(){return t.complete()},nn.noop)),t.closed||e.subscribe(t)}))})},actions:{"send message":({context:e},t)=>{let{sources:n,targetOrigin:s}=e,{message:r}=t;
3n.forEach(e=>{e.postMessage(r,{targetOrigin:s})})},"on success":tN(({context:e})=>e.parentRef,({context:e,self:t})=>(e.response&&e.resolvable?.resolve(e.response),{type:"request.success",requestId:t.id,response:e.response,responseTo:e.responseTo})),"on fail":tN(({context:e})=>e.parentRef,({context:e,self:t})=>(e.suppressWarnings||console.warn(`[@sanity/comlink] Received no response to message '${e.type}' on client '${e.from}' (ID: '${e.id}').`),e.resolvable?.reject(Error("No response received")),{type:"request.failed",requestId:t.id})),"on abort":tN(({context:e})=>e.parentRef,({context:e,self:t})=>(e.resolvable?.reject(Error("Request aborted")),{type:"request.aborted",requestId:t.id}))},guards:{expectsResponse:({context:e})=>e.expectResponse},delays:{initialTimeout:0,responseTimeout:({context:e})=>e.responseTimeout??3e3}}).createMachine({context:({input:e})=>({channelId:e.channelId,data:e.data,domain:e.domain,expectResponse:e.expectResponse??!1,from:e.from,id:`msg-${t_()}`,parentRef:e.parentRef,resolvable:e.resolvable,response:null,responseTimeout:e.responseTimeout,responseTo:e.responseTo,signal:e.signal,sources:e.sources instanceof Set?e.sources:new Set([e.sources]),suppressWarnings:e.suppressWarnings,targetOrigin:e.targetOrigin,to:e.to,type:e.type}),initial:"idle",on:{abort:".aborted"},states:{idle:{after:{initialTimeout:[{target:"sending"}]}},sending:{entry:{type:"send message",params:({context:e})=>{let{channelId:t,data:n,domain:s,from:r,id:i,responseTo:o,to:a,type:u}=e;return{message:{channelId:t,data:n,domain:s,from:r,id:i,to:a,type:u,responseTo:o}}}},always:[{guard:"expectsResponse",target:"awaiting"},"success"]},awaiting:{invoke:{id:"listen for response",src:"listen",input:({context:e})=>({requestId:e.id,sources:e.sources,signal:e.signal}),onError:"aborted"},after:{responseTimeout:"failed"},on:{message:{actions:tk({response:({event:e})=>e.data.data,responseTo:({event:e})=>e.data.responseTo}),target:"success"}}},failed:{type:"final",entry:"on fail"},success:{type:"final",entry:"on success"},aborted:{type:"final",entry:"on abort"}},output:({context:e,self:t})=>({requestId:t.id,response:e.response,responseTo:e.responseTo})});eL(({sendBack:e,input:t})=>{let n=()=>{e(t.event)};t.immediate&&n();let s=setInterval(n,t.interval);return()=>{clearInterval(s)}});let nh=()=>tJ({types:{},actors:{requestMachine:nd(),listen:ni()},actions:{"buffer handshake":tk({handshakeBuffer:({event:e,context:t})=>(tW(e,"message.received"),[...t.handshakeBuffer,e])}),"buffer message":tU(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>(tW(e,"post"),[...t.buffer,{data:e.data,resolvable:e.resolvable,options:e.options}])}),e.emit(({event:e})=>(tW(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":tk({requests:({context:e,event:t,self:n,spawn:s})=>{tW(t,"request");let r=(Array.isArray(t.data)?t.data:[t.data]).map(t=>s("requestMachine",{id:`req-${t_()}`,input:{channelId:e.channelId,data:t.data,domain:e.domain,expectResponse:t.expectResponse,from:e.name,parentRef:n,resolvable:t.resolvable,responseTimeout:t.options?.responseTimeout,responseTo:t.responseTo,signal:t.options?.signal,sources:e.target,suppressWarnings:t.options?.suppressWarnings,targetOrigin:e.targetOrigin,to:e.connectTo,type:t.type}}));return[...e.requests,...r]}}),"emit heartbeat":tT(()=>({type:"heartbeat"})),"emit received message":tU(({enqueue:e})=>{e.emit(({event:e})=>(tW(e,"message.received"),{type:"message",message:e.message.data}))}),"emit status":tT((e,t)=>({type:"status",status:t.status})),"post message":eD(({event:e})=>(tW(e,"post"),{type:"request",data:{data:e.data.data,expectResponse:!!e.resolvable,type:e.data.type,resolvable:e.resolvable,options:e.options}})),"process pending handshakes":tU(({context:e,enqueue:t})=>{e.handshakeBuffer.forEach(e=>t.raise(e)),t.assign({handshakeBuffer:[]})}),"remove request":tU(({context:e,enqueue:t,event:n})=>{tW(n,["request.success","request.failed","request.aborted"]),W(n.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==n.requestId)})}),"send response":eD(({event:e})=>(tW(e,["message.received","heartbeat.received"]),{type:"request",data:{type:na,responseTo:e.message.data.id,data:void 0}})),"send handshake syn ack":eD({type:"request",data:{type:np}}),"send pending messages":tU(({enqueue:e})=>{e.raise(({context:e})=>({type:"request",data:e.buffer.map(({data:e,resolvable:t,options:n})=>({data:e.data,type:e.type,expectResponse:!!t,resolvable:t,options:n}))})),e.emit(({context:e})=>({type:"buffer.flushed",messages:e.buffer.map(({data:e})=>e)}
3)),e.assign({buffer:[]})}),"set connection config":tk({channelId:({event:e})=>(tW(e,"handshake.syn"),e.message.data.channelId),target:({event:e})=>(tW(e,"handshake.syn"),e.message.source||void 0),targetOrigin:({event:e})=>(tW(e,"handshake.syn"),e.message.origin)})},guards:{hasSource:({context:e})=>null!==e.target}}).createMachine({id:"node",context:({input:e})=>({buffer:[],channelId:null,connectTo:e.connectTo,domain:e.domain??"sanity/comlink",handshakeBuffer:[],name:e.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:ns({include:nl,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"}},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:ns({include:nf,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:ns({include:nc,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:ns({exclude:[nc,nl,nf,nu,na]})}],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:ns({exclude:[nc,nl,nf,nu,na]})},{id:"listen for heartbeat",src:"listen",input:ns({include:nu,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:ns({include:nc,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"]}}}}});e.s(["DOMAIN",0,no,"MSG_DISCONNECT",0,nc,"MSG_HANDSHAKE_ACK",0,nf,"MSG_HANDSHAKE_SYN",0,nl,"MSG_HANDSHAKE_SYN_ACK",0,np,"MSG_HEARTBEAT",0,nu,"MSG_RESPONSE",0,na,"createListenLogic",0,ni,"createNode",0,(e,t=nh())=>{let n=R(t,{input:e}),s=new Map,r=new Map,i;n.on("message",({message:e})=>{let t=s.get(e.type);if(t)return void t.forEach(t=>t(e.data));let n=r.get(e.type);n?n.add(e):r.set(e.type,new Set([e]))});let o=()=>{n.stop()};return{actor:n,fetch:(e,t,s)=>{let r,i,{responseTimeout:o=1e4,signal:a,suppressWarnings:u}=s||{},c="function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((e,t)=>{r=e,i=t}),resolve:r,reject:i};return n.send({type:"post",data:{type:e,data:t},resolvable:c,options:{responseTimeout:o,signal:a,suppressWarnings:u}}),c.promise},machine:t,on:(e,t,n)=>{let i=s.get(e)||new Set;s.has(e)||s.set(e,i),i.add(t);let o=r.get(e);if(o){let s=n?.replay??1;Array.from(o).slice(-s).forEach(({data:e})=>t(e)),r.delete(e)}return()=>{i.delete(t)}},onStatus:(e,t)=>{let s=n.on("status",n=>{i=n.status,t&&n.status!==t||e(n.status)});return i&&e(i),()=>s.unsubscribe()},post:(e,t)=>{n.send({type:"post",data:{type:e,data:t}})},start:()=>(n.start(),o),stop:o}},"createNodeMachine",0,nh,"createRequestMachine",0,nd],930975);let ny={"handshake/syn":nl,"handshake/syn-ack":np,"handshake/ack":nf,"channel/response":na,"channel/heartbeat":nu,"channel/disconnect":nc,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},ng={[nl]:"handshake/syn",[np]:"handshake/syn-ack",[nf]:"handshake/ack",[na]:"channel/response",[nu]:"channel/heartbeat",[nc]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},nm=e=>{let{data:t}=e;return t&&"object"==typeof t&&"domain"in t&&"type"in t&&"from"in t&&"to"in t&&("sanity/channels"===t.domain&&(t.domain=no),"overlays"===t.to&&(t.to="visual-editing"),"overlays"===t.from&&(t.from="visual-editing"),t.channelId=t.connectionId,delete t.connectionId,t.type=ny[t.type]??t.type),e},nv=({context:e},t)=>{let{sources:n,targetOrigin:s}=e,r=(e=>{let{channelId:t,...n}=e,s={...n,connectionId:t};return s.domain===no&&(s.domain="sanity/channels"),"visual-editing"===s.to&&(s.to="overlays"),"visual-editing"===s.from&&(s.from="overlays"),s.type=ng[s.type]??s.type,"channel/response"===s.type&&s.responseTo&&!s.data&&(s.data={responseTo:s.responseTo}),("handshake/syn"===s.type||"handshake/syn-ack"===s.type||"handshake/ack"===s.type)&&(s.data={id:s.connectionId}),s})(t.message);
3n.forEach(e=>{e.postMessage(r,{targetOrigin:s})})};function nb(){return window.self!==window.top}function n_(){return!!window.opener}e.s(["createCompatibilityActors",0,()=>({listen:ni(nm),requestMachine:nd().provide({actions:{"send message":nv}})}),"isMaybePreviewIframe",0,nb,"isMaybePreviewWindow",0,n_],863993);let nx=/_key\s*==\s*['"](.*)['"]/,nk=/^\d*:\d*$/;function nS(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function nw(e){return"string"==typeof e?nx.test(e.trim()):"object"==typeof e&&"_key"in e}var nE=e.i(937985);let nI=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n$=/_key\s*==\s*['"](.*)['"]/;function nO(e,t,n){let s="string"==typeof t?function(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(nI);if(!t)throw Error("Invalid path string");return t.map(nj)}(t):t;if(!Array.isArray(s))throw Error("Path must be an array or a string");let r=e;for(let e=0;e<s.length;e++){let t=s[e];if(nS(t)){if(!Array.isArray(r))return n;r=r[t]}if(nw(t)){if(!Array.isArray(r))return n;r=r.find(e=>e._key===t._key)}if("string"==typeof t&&(r="object"==typeof r&&r?r[t]:void 0),void 0===r)return n}return r}function nj(e){return nS(e)?Number(e.replace(/[^\d]/g,"")):nw(e)?{_key:e.match(n$)[1]}:!function(e){if("string"==typeof e&&nk.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;let[t,n]=e;return("number"==typeof t||""===t)&&("number"==typeof n||""===n)}(e)?e:function(e){let[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e)}function nA(){return(0,nE.useSyncExternalStore)(nP,nM,nT)}function nT(){return eH}function nM(){return eY}function nP(e){return eQ.add(e),()=>eQ.delete(e)}function nR(e,t){let n;return(...s)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(e,s)},t)}}function nq(e,t){let n=nb(),s=n_();if(eX(t)||!n&&!s)throw Error("The `useDocuments` hook cannot be used in this context");let r=(0,e5.getDraftId)(e),i=(0,e8.getPublishedId)(e),o=t.getSnapshot().context?.documents,a=o?.[r],u=o?.[i],c=a||u;if(!c)throw Error(`Document "${e}" not found`);let l=a.getSnapshot().context?.local||u.getSnapshot().context?.local,p=new Promise(e=>{if(l)e(l);else{let t=c.on("ready",n=>{let{snapshot:s}=n;e(s||null),t.unsubscribe()})}});return{draftDoc:a,draftId:r,getSnapshot:()=>p,publishedDoc:u,publishedId:i,get snapshot(){if(!l)throw Error(`Snapshot for document "${e}" not found`);return l}}}function nN(e){let t=(()=>{if(i)return i;i=[];for(let e=0;e<256;++e)i[e]=(e+256).toString(16).slice(1);return i})();return(function(e=16){let t=new Uint8Array(e);return crypto.getRandomValues(t),t})(e).reduce((e,n)=>e+t[n],"").slice(0,e)}function nC(e){let t="string"==typeof e?e:e.path,n=t.lastIndexOf("."),s=t.substring(n+1,t.length);if(!s.indexOf("["))throw Error("Invalid path: not an array");let r=t.lastIndexOf("["),i=t.substring(0,r),o,a;if(s.includes("_key")){let e=s.indexOf('"')+1,t=s.indexOf('"',e);o=s.substring(e,t),a=!0}else{let e=s.indexOf("[")+1,t=s.indexOf("]",e);o=s.substring(e,t),a=!1}if(!i||!o)throw Error("Invalid path");return{path:i,key:o,hasExplicitKey:a}}async function nD(e,t,n){if(!e.type)throw Error("Node type is missing");let{path:s,key:r}=nC(e),i=await t.getSnapshot(),o=nO(i,s),a=nO(i,e.path),u=o.findIndex(e=>e._key===r),c=-1,l="before";if("first"===n){if(0===u)return[];c=0,l="before"}else if("last"===n){if(u===o.length-1)return[];c=-1,l="after"}else if("next"===n){if(u===o.length-1)return[];c=u,l="after"}else if("previous"===n){if(0===u)return[];c=u-1,l="before"}return[td(s,tg(u,u+1)),td(s,ty(a,l,c))]}e.s(["a",0,function(e,t){let{path:n,key:s}=nC(e),r=nO(t,n).findIndex(e=>e._key===s);return[td(n,tg(r,r+1))]},"c",0,function(){let e=(0,e3.c)(2),t=nA(),n;return e[0]===t?n=e[1]:(n=eX(t),e[0]=t,e[1]=n),!n},"i",0,nD,"l",0,nO,"n",0,function(e,t,n){let{path:s,key:r}=nC(e);return[td(s,ty([{_type:t,_key:nN()}],n,{_key:r}))]},"o",0,function(){let e=(0,e3.c)(7),t=nA(),n;e[0]===t?n=e[1]:(n=e=>({id:e,commit:()=>{let{draftDoc:n}=nq(e,t);n.send({type:"submit"})},get:n=>{let{snapshot:s}=nq(e,t);return n?nO(s,n):s},getSnapshot:function(e,t){let{getSnapshot:n}=nq(e,t);return n}(e,t),patch:async(n,s)=>{let r=nq(e,t),{draftDoc:i,draftId:o,getSnapshot:a,publishedId:u}=r,{commit:c=!0}=s||{},l=await ("function"==typeof n?n({draftId:o,publishedId:u,get snapshot(){return r.snapshot},getSnapshot:a}):n),p=await a();if(!p)throw Error(`Snapshot for document "${e}" not found`);i.send({type:"mutate",mutations:[th({...p,_id:o}),tf(o,l)]}),c&&("object"==typeof c&&"debounce"in c?nR(()=>i.send({type:"submit"}),c.debounce)():i.send({type:"submit"}))}}),e[0]=t,e[1]=n);let s=n,r;e[2]===t?r=e[3]:(r=(e,n,s)=>{let{draftDoc:r}=nq(e,t),{commit:i}=s||{},o=void 0===i||i;r.send({type:"mutate",mutations:n}),o&&("object"==typeof o&&"debounce"in o?nR(()=>r.send({type:"submit"}),o.debounce)():r.send({type:"submit"}))},e[2]=t,e[3]=r);let i=r,o;return e[4]!==s||e[5]!==i?(o={getDocument:s,mutateDocument:i},e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"r",0,nC,"s",0,nA,"t",0,function(e,t,n="after"){let{path:s,key:r}=nC(e);return[td(s,ty({...nO(t,e.path),_key:nN()},n,{_key:r}))]}],882476);var nU=e.i(859950);e.s(["studioPath",()=>nU.x],352530);var nU=nU;let nL={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function nB(e){return e||t?{lang:e?.lang??t?.lang,message:e?.message,abortEarly:e?.abortEarly??t?.abortEarly,abortPipeEarly:e?.abortPipeEarly??t?.abortPipeEarly}:nL}function nV(e,t,i,o,a){var u,c,l,p;let f,d=a&&"input"in a?a.input:i.value,h=a?.expected??e.expects??null,y=a?.received??("string"==(f=typeof d)?`"${d}"`:"number"===f||"bigint"===f||"boolean"===f?`${d}`:"object"===f||"function"===f?(d&&Object.getPrototypeOf(d)?.constructor?.name)??"null":f),g={kind:e.kind,type:e.type,input:d,expected:h,received:y,message:`Invalid ${t}: ${h?`Expected ${h} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:a?.path,issues:a?.issues,lang:o.lang,abortEarly:o.abortEarly,abortPipeEarly:o.abortPipeEarly},m="schema"===e.kind,v=a?.message??e.message??(u=e.reference,c=g.lang,r?.get(u)?.get(c))??(m?(l=g.lang,s?.get(l)):null)??o.message??(p=g.lang,n?.get(p));void 0!==v&&(g.message="function"==typeof v?v(g):v),m&&(i.typed=!1),i.issues?i.issues.push(g):i.issues=[g]}function nW(e){return e["~standard"]={version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},nB())},e}
3var nJ=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function nF(e,t){return{kind:"validation",type:"min_length",reference:nF,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&nV(this,"length",e,t,{received:`${e.value.length}`}),e}}}let nz={abortEarly:!0};function nK(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function nG(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function nH(e,t){return nW({kind:"schema",type:"object",reference:nH,expects:"Object",async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&"object"==typeof n)for(let s in e.typed=!0,e.value={},this.entries){let r=this.entries[s];if(s in n||("exact_optional"===r.type||"optional"===r.type||"nullish"===r.type)&&void 0!==r.default){let i=s in n?n[s]:nG(r),o=r["~run"]({value:i},t);if(o.issues){let r={type:"object",origin:"value",input:n,key:s,value:i};for(let t of o.issues)t.path?t.path.unshift(r):t.path=[r],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[s]=o.value}else if(void 0!==r.fallback)e.value[s]=nK(r);else if("exact_optional"!==r.type&&"optional"!==r.type&&"nullish"!==r.type&&(nV(this,"key",e,t,{input:void 0,expected:`"${s}"`,path:[{type:"object",origin:"key",input:n,key:s,value:n[s]}]}),t.abortEarly))break}else nV(this,"type",e,t);return e}})}function nY(e,t){return nW({kind:"schema",type:"optional",reference:nY,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=nG(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}})}function nQ(e){return nW({kind:"schema",type:"string",reference:nQ,expects:"string",async:!1,message:e,"~run"(e,t){return"string"==typeof e.value?e.typed=!0:nV(this,"type",e,t),e}})}function nX(...e){return nW({...e[0],pipe:e,"~run"(t,n){for(let s of e)if("metadata"!==s.kind){if(t.issues&&("schema"===s.kind||"transformation"===s.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=s["~run"](t,n))}return t}})}function nZ(e,t,n){let s=e["~run"]({value:t},nB(n));return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}let n0=nX(nQ(),nF(1)),n1=nY(n0),n6=nH({baseUrl:n0,dataset:n1,id:n0,path:n0,projectId:n1,tool:n1,type:n1,workspace:n1,perspective:(e2=nQ(),nW({...e2,fallback:"drafts","~run"(e,t){let n=e2["~run"](e,t);return n.issues?{typed:!0,value:nK(this,n,t)}:n}}))});function n2(e){return!n6["~run"]({value:e},nz).issues}function n3(e){let t="";for(let n of e){if("string"==typeof n){t&&(t+="."),t+=n;continue}if("number"==typeof n){t&&(t+=":"),t+=`${n}`;continue}if(null!==n&&Array.isArray(n)){t&&(t+=":"),t+=`${n.join(",")}}`;continue}if(n._key){t&&(t+=":"),t+=`${n._key}`;continue}}return t}let n5=/^([\w-]+):(0|[1-9][0-9]{0,8})$/,n8=/^([\w-]+):([0-9]+),([0-9]+)$/,n9=/^([\w-]+):([\w-]+)$/,n4=nX(nQ(),nF(1)),n7=nH({origin:n4,href:n4,data:nY(function e(t,n,s){return nW({kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:n,message:s,"~run"(e,t){let n=e.value;if(n&&"object"==typeof n){for(let s in e.typed=!0,e.value={},n)if(Object.prototype.hasOwnProperty.call(n,s)&&"__proto__"!==s&&"prototype"!==s&&"constructor"!==s){let r=n[s],i=this.key["~run"]({value:s},t);if(i.issues){let o={type:"object",origin:"key",input:n,key:s,value:r};for(let t of i.issues)t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=i.issues),t.abortEarly){e.typed=!1;break}}let o=this.value["~run"]({value:r},t);if(o.issues){let i={type:"object",origin:"value",input:n,key:s,value:r};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}i.typed&&o.typed||(e.typed=!1),i.typed&&(e.value[i.value]=o.value)}}else nV(this,"type",e,t);return e}})}(nQ(),function e(){return nW({kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,"~run":e=>(e.typed=!0,e)})}()))});function se(e){let t=e.indexOf("/intent/edit/");if(-1!==t)try{let n=e.slice(t+13),s=n.indexOf("?"),r=-1===s?n:n.slice(0,s),i={};for(let e of r.split(";")){let t=e.indexOf("=");if(-1===t)continue;let n=e.slice(0,t);("id"===n||"type"===n||"path"===n||"tool"===n)&&(i[n]=decodeURIComponent(e.slice(t+1)))}-1!==s&&Object.assign(i,Object.fromEntries(new URLSearchParams(n.slice(s+1)))),i.baseUrl??=e.slice(0,t)||"/";let o=nZ(n6,i);return o.success?o.output:void 0}catch{return}}function st(e){let t=nZ(n6,e);if(t.success)return t.output;let n=nZ(n7,e);if(n.success){let{href:e}=n.output;try{let t=new URL(e,typeof document>"u"?"https://example.com":location.origin);return t.searchParams.size>0?function(e,t){let n=e["~run"]({value:t},nB(void 0));if(n.issues)throw new nJ(n.issues);return n.value}
3(n6,Object.fromEntries(t.searchParams.entries())):se(e)??n.output}catch(t){return se(e)||(console.error("Failed to parse sanity node",t),n.output)}}}e.s(["createDataAttribute",0,function e(t){function n(e){return e?"string"==typeof e?nU.x.fromString(e):e:[]}function s(e){if(!e.id)throw Error("`id` is required to create a data attribute");if(!e.type)throw Error("`type` is required to create a data attribute");if(!e.path||!e.path.length)throw Error("`path` is required to create a data attribute");return function(e){let{id:t,path:n,baseUrl:s,tool:r,workspace:i,type:o}=e;if(n2(e))return[["id",(0,e8.getPublishedId)(t)],["type",o],["path",n3(nU.x.fromString(n))],["base",encodeURIComponent(s)],["workspace",i],["tool",r]].filter(([,e])=>!!e).map(e=>e.join("=")).join(";")}({baseUrl:e.baseUrl||"/",workspace:e.workspace,tool:e.tool,type:e.type,id:e.id,path:"string"==typeof e.path?e.path:nU.x.toString(e.path),perspective:e.perspective})}let r=e=>s({...t,path:[...n(t.path),...n(e)]});return r.toString=function(){return s(t)},r.combine=function(n){return e({...t,...n})},r.scope=function(s){return e({...t,path:[...n(t.path),...n(s)]})},r},"decodeSanityNodeData",0,function(e){if("object"==typeof e&&e)return st(e);try{return st(JSON.parse(e))}catch{let t=e.split(";").reduce((e,t)=>{let[n,s]=t.split("=");if(!n||t.includes("=")&&!s)return e;switch(n){case"id":e.id=s;break;case"type":e.type=s;break;case"path":e.path=nU.x.toString(function(e){let t=[];for(let n of e.split(".")){let e=n5.exec(n);if(e){t.push(e[1],Number(e[2]));continue}let s=n8.exec(n);if(s){t.push(s[1],[Number(s[2]),Number(s[3])]);continue}let r=n9.exec(n);if(r){t.push(r[1],{_key:r[2]});continue}t.push(n)}return t}(s));break;case"base":e.baseUrl=decodeURIComponent(s);break;case"perspective":e.perspective=s;break;case"tool":e.tool=s;break;case"workspace":e.workspace=s;break;case"projectId":e.projectId=s;break;case"dataset":e.dataset=s}return e},{});if(n2(t))return t;return}},"pathToUrlString",0,n3],630955)},878524,(e,t,n)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==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.