PageSourceSearch

https://www.copilotkit.ai/_next/static/chunks/7939.521a8b9399eb741c.js

js copilotkit.ai collected 2026-10-02 03:07:09 UTC 181,599 bytes, 216 lines download raw bytes

1"use strict";(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[7939],{23190:(e,t,n)=>{var r=n(23796).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;t.c=function(e){return r.H.useMemoCache(e)}},37939:(e,t,n)=>{let r,i;n.r(t),n.d(t,{renderVisualEditing:()=>lJ});var o,s,a,l,u,c,d,p,f=n(87448),h=n(23796),y=n(88588),m=n(77616);let g={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},v=new Uint8Array(16),b=[];for(let e=0;e<256;++e)b.push((e+256).toString(16).slice(1));let x=function(e,t,n){if(g.randomUUID&&!t&&!e)return g.randomUUID();var i=e,o=n;let s=(i=i||{}).random??i.rng?.()??function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(v)}();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((o=o||0)<0||o+16>t.length)throw RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[o+e]=s[e];return t}return function(e,t=0){return(b[e[t+0]]+b[e[t+1]]+b[e[t+2]]+b[e[t+3]]+"-"+b[e[t+4]]+b[e[t+5]]+"-"+b[e[t+6]]+b[e[t+7]]+"-"+b[e[t+8]]+b[e[t+9]]+"-"+b[e[t+10]]+b[e[t+11]]+b[e[t+12]]+b[e[t+13]]+b[e[t+14]]+b[e[t+15]]).toLowerCase()}(s)},w=e=>{if("undefined"==typeof window)return;let t=function(){let e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:void 0;if(e.__xstate__)return e.__xstate__}();t&&t.register(e)};class _{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 E="xstate.init",j="xstate.stop";function k(e,t){return{type:`xstate.done.state.${e}`,output:t}}function S(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function I(e){return{type:E,input:e}}function T(e){setTimeout(()=>{throw e})}let M="function"==typeof Symbol&&Symbol.observable||"@@observable";function $(e){if(N(e))return e;let t=[],n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r]}return t.push(n),t}function A(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 r=n;n={},r[e[t]]=n}return t}($(e))}function C(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let o=r[i];n[o]=t(e[o],o,e,i)}return n}function O(e){return N(e)?e:[e]}function R(e){var t;return void 0===e?[]:N(t=e)?t:[t]}function P(e,t,n,r){return"function"==typeof e?e({context:t,event:n,self:r}):e}function N(e){return Array.isArray(e)}function z(e){var t;return(N(t=e)?t:[t]).map(e=>void 0===e||"string"==typeof e?{target:e}:e)}function L(e){if(void 0!==e&&""!==e)return R(e)}function D(e,t,n){let r="object"==typeof e,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}function U(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,i]=n,o=e.getStateNodeById(i).config.invoke;return(Array.isArray(o)?o[r]:o).src}function q(e,t){if(t===e||"*"===t)return!0;if(!t.endsWith(".*"))return!1;let n=t.split("."),r=e.split(".");for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if("*"===t)return e===n.length-1;if(t!==i)return!1}return!0}function V(e,t){return`${e.sessionId}.${t}`}let F=0,Y=!1,W=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),B={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class G{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 _(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=W.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...B,...t},{clock:r,logger:i,parent:o,syncSnapshot:s,id:a,systemId:l,inspect:u}=n;this.system=o?o.system:function(e,t){let n=new Map,r=new Map,i=new WeakMap,o=new Set,s={},{clock:a,logger:l}=t,u={schedule:(e,t,n,r,i=Math.random().toString(36).slice(2))=>{let o={source:e,target:t,event:n,delay:r,id:i,startedAt:Date.now()},l=V(e,i);c._snapshot._scheduledEvents[l]=o;let u=a.setTimeout(()=>{delete s[l],delete c._snapshot._scheduledEvents[l],c._relay(e,t,n)},r);s[l]=u},cancel:(e,t)=>
1{let n=V(e,t),r=s[n];delete s[n],delete c._snapshot._scheduledEvents[n],void 0!==r&&a.clearTimeout(r)},cancelAll:e=>{for(let t in c._snapshot._scheduledEvents){let n=c._snapshot._scheduledEvents[t];n.source===e&&u.cancel(e,n.id)}}},c={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${F++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=i.get(e);void 0!==t&&(r.delete(t),i.delete(e))},get:e=>r.get(e),getAll:()=>Object.fromEntries(r.entries()),_set:(e,t)=>{let n=r.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);r.set(e,t),i.set(t,e)},inspect:e=>{let t=D(e);return o.add(t),{unsubscribe(){o.delete(t)}}},_sendInspectionEvent:t=>{if(!o.size)return;let n={...t,rootId:e.sessionId};o.forEach(e=>e.next?.(n))},_relay:(e,t,n)=>{c._sendInspectionEvent({type:"@xstate.event",sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...c._snapshot._scheduledEvents}}),start:()=>{let e=c._snapshot._scheduledEvents;for(let t in c._snapshot._scheduledEvents={},e){let{source:n,target:r,event:i,delay:o,id:s}=e[t];u.schedule(n,r,i,o,s)}},_clock:a,_logger:l};return c}(this,{clock:r,logger:i}),u&&!o&&this.system.inspect(D(u)),this.sessionId=this.system._bookId(),this.id=a??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=o,this._syncSnapshot=s,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=>{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 r of[...t?t.values():[],...n?n.values():[]])try{r(e)}catch(e){T(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=Y;try{Y=!0,e.exec(e.info,e.params)}finally{Y=t}};this._processingStatus===W.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),l&&(this.systemId=l,this.system._set(l,this)),this._initState(t?.snapshot??t?.state),l&&"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){T(e)}break;case"done":var r;for(let t of this.observers)try{t.next?.(e)}catch(e){T(e)}this._stopProcedure(),this._complete(),this._doneEvent=(r=this.id,{type:`xstate.done.actor.${r}`,output:this._snapshot.output,actorId:r}),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 r=D(e,t,n);if(this._processingStatus!==W.Stopped)this.observers.add(r);else switch(this._snapshot.status){case"done":try{r.complete?.()}catch(e){T(e)}break;case"error":{let e=this._snapshot.error;if(r.error)try{r.error(e)}catch(e){T(e)}else T(e)}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let r=t.bind(void 0);return n.add(r),{unsubscribe:()=>{n.delete(r)}}}start(){if(this._processingStatus===W.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=W.Running;let e=I(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===j&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===W.Stopped||((this.mailbox.clear(),this._processingStatus===W.NotStarted)?this._processingStatus=W.Stopped:this.mailbox.enqueue({type:j})),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){T(e)}this.observers.clear()}_reportError(e){if(!this.observers.size){this._parent||T(e);return}let t=!1;for(let n of this.observers){let r=n.error;t||=!r;try{r?.(e)}catch(e){T(e)}}this.observers.clear(),t&&T(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,S(this.id,e))}_stopProcedure(){return this._processingStatus!==W.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new _(this._process.bind(this)),this._processingStatus=W.Stopped,this.system._unregister(this)),this}_send(e){this._processingStatus!==W.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&("function"==typeof e?e:w)(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[M](){return this}getSnapshot(){return this._snapshot}}function J(e,...[t]){return new G(e,t)}function H(e,t,n,r,{sendId:i}){return[t,{sendId:"function"==typeof i?i(n,r):i},void 0]}function Z(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function X(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=H,t.execute=Z,t}function K(e,t,n,r,{id:i,systemId:o,src:s,input:a,syncSnapshot:l}){let u,c,d="string"==typeof s?U(t.machine,s):s,p="function"==typeof i?i(n):i;return d&&(c="function"==typeof a?a({context:t.context,event:n.event,self:e.self}):a,u=J(d,{id:p,src:s,parent:e.self,syncSnapshot:l,systemId:o,input:c})),[eD(t,{children:{...t.children,[p]:u}}),{id:i,systemId:o,actorRef:u,src:s,input:c},void 0]}function Q(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==W.Stopped&&t.start()})}function ee(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function o(e,t){}return o.type="xstate.spawnChild",o.id=t,o.systemId=n,o.src=e,o.input=r,o.syncSnapshot=i,o.resolve=K,o.execute=Q,o}function et(e,t,n,r,{actorRef:i}){let o="function"==typeof i?i(n,r):i,s="string"==typeof o?t.children[o]:o,a=t.children;return s&&(a={...a},delete a[s.id]),[eD(t,{children:a}),s,void 0]}function en(e,t){if(t){if(e.system._unregister(t),t._processingStatus!==W.Running)return void e.stopChild(t);e.defer(()=>{e.stopChild(t)})}}function er(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=et,t.execute=en,t}function ei(e,t,n,r){let{machine:i}=r,o="function"==typeof e,s=o?e:i.implementations.guards["string"==typeof e?e:e.type];if(!o&&!s)throw Error(`Guard '${"string"==typeof e?e:e.type}' is not implemented.'.`);if("function"!=typeof s)return ei(s,t,n,r);let a={context:t,event:n},l=o||"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 s?s.check(r,a,s):s(a,l)}let eo=e=>"atomic"===e.type||"final"===e.type;function es(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function ea(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function el(e){let t=new Set(e),n=eu(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 es(e))if("history"!==n.type&&!t.has(n))for(let e of em(n))t.add(e)}}
1else em(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 eu(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 ec(e,t){return function e(t,n){let r=n.get(t);if(!r)return{};if("compound"===t.type){let e=r[0];if(!e)return{};if(eo(e))return e.key}let i={};for(let t of r)i[t.key]=e(t,n);return i}(e,eu(el(t)))}function ed(e,t){return"compound"===t.type?es(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?es(t).every(t=>ed(e,t)):"final"===t.type}let ep=e=>"#"===e[0];function ef(e,t,n){let r=L(n.target),i=n.reenter??!1,o=function(e,t){if(void 0!==t)return t.map(t=>{if("string"!=typeof t)return t;if(ep(t))return e.machine.getStateNodeById(t);let n="."===t[0];if(n&&!e.parent)return eb(e,t.slice(1));let r=n?e.key+t:t;if(e.parent)try{return eb(e.parent,r)}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,r),s={...n,actions:R(n.actions),guard:n.guard,target:o,source:e,reenter
2:i,eventType:t,toJSON:()=>({...s,source:`#${e.id}`,target:o?o.map(e=>`#${e.id}`):void 0})};return s}function eh(e){let t=L(e.config.target);return t?{target:t.map(t=>"string"==typeof t?eb(e.parent,t):t)}:e.parent.initial}function ey(e){return"history"===e.type}function em(e){let t=eg(e);for(let n of t)for(let r of ea(n,e))t.add(r);return t}function eg(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 es(n))e(t)}}(e),t}function ev(e,t){if(ep(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 eb(e,t){if("string"==typeof t&&ep(t))try{return e.machine.getStateNodeById(t)}catch{}let n=$(t).slice(),r=e;for(;n.length;){let e=n.shift();if(!e.length)break;r=ev(r,e)}return r}function ex(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),r=n.map(t=>ev(e,t)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((n,r)=>{let i=ev(e,r);if(!i)return n;let o=ex(i,t[r]);return n.concat(o)},[]))}function ew(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function e_(e,t,n){let r=new Set;for(let i of e){let e=!1,o=new Set;for(let s of r)if(function(e,t){let n=new Set(e),r=new Set(t);for(let e of n)if(r.has(e))return!0;for(let e of r)if(n.has(e))return!0;return!1}(ek([i],t,n),ek([s],t,n)))if(ew(i.source,s.source))o.add(s);else{e=!0;break}if(!e){for(let e of o)r.delete(e);r.add(i)}}return Array.from(r)}function eE(e,t){if(!e.target)return[];let n=new Set;for(let r of e.target)if(ey(r))if(t[r.id])for(let e of t[r.id])n.add(e);else for(let e of eE(eh(r),t))n.add(e);else n.add(r);return[...n]}function ej(e,t){let n=eE(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||ew(t,e.source)))return e.source;let r=function(e){let[t,...n]=e;for(let e of ea(t,void 0))if(n.every(t=>ew(t,e)))return e}(n.concat(e.source));return r||(e.reenter?void 0:e.source.machine.root)}function ek(e,t,n){let r=new Set;for(let i of e)if(i.target?.length){let e=ej(i,n);for(let n of(i.reenter&&i.source===e&&r.add(e),t))ew(n,e)&&r.add(n)}return[...r]}function eS(e,t,n,r,i,o){if(!e.length)return t;let s=new Set(t._nodes),a=t.historyValue,l=e_(e,s,a),u=t;i||([u,a]=function(e,t,n,r,i,o,s,a){let l,u=e,c=ek(r,i,o);for(let e of(c.sort((e,t)=>t.order-e.order),c))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=>eo(t)&&ew(t,e):t=>t.parent===e,(l??={...o})[t.id]=Array.from(i).filter(n)}for(let e of c)u=eM(u,t,n,[...e.exit,...e.invoke.map(e=>er(e.id))],s,void 0),i.delete(e);return[u,l||o]}(u,r,n,l,s,a,o,n.actionExecutor)),u=function(e,t,n,r,i,o,s,a){let l=e,u=new Set,c=new Set;(function(e,t,n,r){for(let i of e){let e=ej(i,t);for(let o of i.target||[])!ey(o)&&(i.source!==o||i.source!==e||i.reenter)&&(r.add(o),n.add(o)),eI(o,t,n,r);for(let o of eE(i,t)){let s=ea(o,e);e?.type==="parallel"&&s.push(e),eT(r,t,n,s,!i.source.parent&&i.reenter?void 0:e)}}})(r,s,c,u),a&&c.add(e.machine.root);let d=new Set;for(let e of[...u].sort((e,t)=>e.order-t.order)){i.add(e);let r=[];for(let t of(r.push(...e.entry),e.invoke))r.push(ee(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(c.has(e)){let t=e.initial.actions;r.push(...t)}if(l=eM(l,t,n,r,o,e.invoke.map(e=>e.id)),"final"===e.type){let r=e.parent,s=r?.type==="parallel"?r:r?.parent,a=s||e;for(r?.type==="compound"&&o.push(k(r.id,void 0!==e.output?P(e.output,l.context,t,n.self):void 0));s?.type==="parallel"&&!d.has(s)&&ed(i,s);)d.add(s),o.push(k(s.id)),a=s,s=s.parent;if(s)continue;l=eD(l,{status:"done",output:function(e,t,n,r,i){if(void 0===r.output)return;let o=k(i.id,void 0!==i.output&&i.parent?P(i.output,e.context,t,n.self):void 0);return P(r.output,e.context,o,n.self)}(l,t,n,l.machine.root,a)})}}return l}(u=eM(u,r,n,l.flatMap(e=>e.actions),o,void 0),r,n,l,s,o,a,i);let c=[...s];"done"===u.status&&(u=eM(u,r,n,c.sort((e,t)=>
2t.order-e.order).flatMap(e=>e.exit),o,void 0));try{if(a===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,s))return u;return eD(u,{_nodes:c,historyValue:a})}catch(e){throw e}}function eI(e,t,n,r){var i,o,s,a;if(ey(e))if(t[e.id]){let s=t[e.id];for(let e of s)r.add(e),eI(e,t,n,r);for(let a of s){i=a,o=e.parent,eT(r,t,n,ea(i,o))}}else{let i=eh(e);for(let o of i.target)r.add(o),i===e.parent?.initial&&n.add(e.parent),eI(o,t,n,r);for(let o of i.target){s=o,a=e.parent,eT(r,t,n,ea(s,a))}}else if("compound"===e.type){let[i]=e.initial.target;ey(i)||(r.add(i),n.add(i)),eI(i,t,n,r),eT(r,t,n,ea(i,e))}else if("parallel"===e.type)for(let i of es(e).filter(e=>!ey(e)))[...r].some(e=>ew(e,i))||(ey(i)||(r.add(i),n.add(i)),eI(i,t,n,r))}function eT(e,t,n,r,i){for(let o of r)if((!i||ew(o,i))&&e.add(o),"parallel"===o.type)for(let r of es(o).filter(e=>!ey(e)))[...e].some(e=>ew(e,r))||(e.add(r),eI(r,t,n,e))}function eM(e,t,n,r,i,o){let s=o?[]:void 0,a=function e(t,n,r,i,o,s){let{machine:a}=t,l=t;for(let t of i){var u;let i="function"==typeof t,c=i?t:(u="string"==typeof t?t:t.type,a.implementations.actions[u]),d={context:l.context,event:n,self:r.self,system:r.system},p=i||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:l.context,event:n}):t.params:void 0;if(!c||!("resolve"in c)){r.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:d,params:p,exec:c}
2);continue}let[f,h,y]=c.resolve(r,l,d,p,c,o);l=f,"retryResolve"in c&&s?.push([c,h]),"execute"in c&&r.actionExecutor({type:c.type,info:d,params:h,exec:c.execute.bind(null,r,h)}),y&&(l=e(l,n,r,y,o,s))}return l}(e,t,n,r,{internalQueue:i,deferredActorIds:o},s);return s?.forEach(([e,t])=>{e.retryResolve(n,a,t)}),a}function e$(e,t,n,r){let i=e,o=[];function s(e,t,r){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:t,snapshot:e,_transitions:r}),o.push(e)}if(t.type===j)return s(i=eD(eA(i,t,n),{status:"stopped"}),t,[]),{snapshot:i,microstates:o};let a=t;if(a.type!==E){let t=a,l=t.type.startsWith("xstate.error.actor"),u=eC(t,i);if(l&&!u.length)return s(i=eD(e,{status:"error",error:t.error}),t,[]),{snapshot:i,microstates:o};s(i=eS(u,e,n,a,!1,r),t,u)}let l=!0;for(;"active"===i.status;){let e=l?function(e,t){let n=new Set;for(let r of e._nodes.filter(eo))e:for(let i of[r].concat(ea(r,void 0)))if(i.always){for(let r of i.always)if(void 0===r.guard||ei(r.guard,e.context,t,e)){n.add(r);break e}}return e_(Array.from(n),new Set(e._nodes),e.historyValue)}(i,a):[],t=e.length?i:void 0;if(!e.length){if(!r.length)break;e=eC(a=r.shift(),i)}l=(i=eS(e,i,n,a,!1,r))!==t,s(i,a,e)}return"active"!==i.status&&eA(i,a,n),{snapshot:i,microstates:o}}function eA(e,t,n){return eM(e,t,n,Object.values(e.children).map(e=>er(e)),[],void 0)}function eC(e,t){return t.machine.getTransitionData(t,e)}let eO=function(e){return function e(t,n){let r=A(t),i=A(n);return"string"==typeof i?"string"==typeof r&&i===r:"string"==typeof r?r in i:Object.keys(r).every(t=>t in i&&e(r[t],i[t]))}(e,this.value)},eR=function(e){return this.tags.has(e)},eP=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eN=function(){let{_nodes:e,tags:t,machine:n,getMeta:r,toJSON:i,can:o,hasTag:s,matches:a,...l}=this;return{...l,tags:Array.from(t)}},ez=function(){return this._nodes.reduce((e,t)=>(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function eL(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:ec(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:eO,hasTag:eR,can:eP,getMeta:ez,toJSON:eN}}function eD(e,t={}){return eL({...e,...t},e.machine)}function eU(e,t,n,r,{event:i,id:o,delay:s},{internalQueue:a}){let l,u=t.machine.implementations.delays;if("string"==typeof i)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let c="function"==typeof i?i(n,r):i;if("string"==typeof s){let e=u&&u[s];l="function"==typeof e?e(n,r):e}else l="function"==typeof s?s(n,r):s;return"number"!=typeof l&&a.push(c),[t,{event:c,id:o,delay:l},void 0]}function eq(e,t){let{event:n,delay:r,id:i}=t;if("number"==typeof r)return void e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,r,i)})}function eV(e,t){function n(e,t){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=eU,n.execute=eq,n}let eF="xstate.observable.error",eY="xstate.observable.complete";function eW(e){return{config:e,transition:(e,t)=>{if("active"!==e.status)return e;switch(t.type){case eF:return{...e,status:"error",error:t.data,input:void 0,_subscription:void 0};case eY:return{...e,status:"done",input:void 0,_subscription:void 0};case j: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:r,emit:i})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:r,self:n,emit:i}).subscribe({next:e=>{n._parent&&r._relay(n,n._parent,e)},error:e=>{r._relay(n,n,{type:eF,data:e})},complete:()=>{r._relay(n,n,{type:eY})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}let eB="xstate.promise.resolve",eG="xstate.promise.reject",eJ=new WeakMap;function eH(e){return{config:e,transition:(e,t,n)=>{if("active"!==e.status)return e;switch(t.type){case eB:{let n=t.data;return{...e,status:"done",output:n,input:void 0}}case eG:return{...e,status:"error",error:t.data,input:void 0};case j:return eJ.get(n.self)?.abort(),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:n,system:r,emit:i})=>{if("active"!==t.status)return;let o=new AbortController;eJ.set(n,o),Promise.resolve(e({input:t.input,system:r,self:n,signal:o.signal,emit:i})).then(e=>
2{"active"===n.getSnapshot().status&&(eJ.delete(n),r._relay(n,n,{type:eB,data:e}))},e=>{"active"===n.getSnapshot().status&&(eJ.delete(n),r._relay(n,n,{type:eG,data:e}))})},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let eZ=function(e,t){return{config:e,transition:(t,n,r)=>({...t,context:e(t.context,n,r)}),getInitialSnapshot:(e,n)=>({status:"active",output:void 0,error:void 0,context:"function"==typeof t?t({input:n}):t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}(e=>void 0,void 0);function eX(e,t,n,r,{assignment:i}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},s={context:t.context,event:n.event,spawn:function(e,{machine:t,context:n},r,i){let o=(o,s)=>{if("string"!=typeof o)return J(o,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:s?.input,src:o,systemId:s?.systemId});{let a=U(t,o);if(!a)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let l=J(a,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:"function"==typeof s?.input?s.input({context:n,event:r,self:e.self}):s?.input,src:o,systemId:s?.systemId});return i[l.id]=l,l}};return(t,n)=>{let r=o(t,n);return i[r.id]=r,e.defer(()=>{r._processingStatus!==W.Stopped&&r.start()}),r}}(e,t,n.event,o),self:e.self,system:e.system},a={};if("function"==typeof i)a=i(s,r);else for(let e of Object.keys(i)){let t=i[e];a[e]="function"==typeof t?t(s,r):t}let l=Object.assign({},t.context,a);return[eD(t,{context:l,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function eK(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=eX,t}let eQ=new WeakMap;function e0(e,t,n){let r=eQ.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},eQ.set(e,r)),r[t]}let e1={},e2=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class e3{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?C(this.config.states,(e,t)=>new e3(e,{_parent:this,_key:t,_machine:this.machine})):e1,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=!0===this.config.history?"shallow":this.config.history||!1,this.entry=R(this.config.entry).slice(),this.exit=R(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=R(e.tags).slice()}_initialize(){this.transitions=function(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 r=e.config.on[n];t.set(n,z(r).map(t=>ef(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,z(e.config.onDone).map(t=>ef(e,n,t)))}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,z(n.onDone).map(t=>ef(e,r,t)))}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,z(n.onError).map(t=>ef(e,r,t)))}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,z(n.onSnapshot).map(t=>ef(e,r,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}(this),this.config.always&&(this.always=z(this.config.always).map(e=>
2ef(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(e2),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(e2),eventType:null})}:void 0,history:this.history,states:C(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(e2)})),entry:this.entry.map(e2),exit:this.exit.map(e2),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 e0(this,"invoke",()=>R(this.config.invoke).map((e,t)=>{var n,r;let{src:i,systemId:o}=e,s=e.id??(n=this.id,`${t}.${n}`),a="string"==typeof i?i:`xstate.invoke.${r=this.id,`${t}.${r}`}`;return{...e,src:a,id:s,systemId:o,toJSON(){let{onDone:t,onError:n,...r}=e;return{...r,type:"xstate.invoke",src:a,id:s}}}}))}get on(){return e0(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 e0(this,"delayedTransitions",()=>(function(e){let t=e.config.after;if(!t)return[];let n=t=>{var n;let r=(n=e.id,{type:`xstate.after.${t}.${n}`}),i=r.type;return e.entry.push(eV(r,{id:i,delay:t})),e.exit.push(X(i)),i};return Object.keys(t).flatMap(e=>{let r=t[e],i=Number.isNaN(+e)?e:+e,o=n(i);return R("string"==typeof r?{target:r}:r).map(e=>({...e,event:o,delay:i}))}).map(t=>{let{delay:n}=t;return{...ef(e,t.event,t),delay:n}})})(this))}get initial(){return e0(this,"initial",()=>(function(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 r={source:e,actions:t&&"string"!=typeof t?R(t.actions):[],eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r})(this,this.config.initial))}next(e,t){let n,r=t.type,i=[];for(let o of e0(this,`candidates-${r}`,()=>{var e;return e=this,e.transitions.get(r)||[...e.transitions.keys()].filter(e=>q(r,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))})){let{guard:s}=o,a=e.context,l=!1;try{l=!s||ei(s,a,t,e)}catch(t){let e="string"==typeof s?s:"object"==typeof s?s.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${r}' in state node '${this.id}':
3${t.message}`)}if(l){i.push(...o.actions),n=o;break}}return n?[n]:void 0}get events(){return e0(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let r=e[n];if(r.states)for(let e of r.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 e4{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new e3(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:r,delays:i}=this.implementations;return new e4(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...r,...e.actors},delays:{...i,...e.delays}})}resolveState(e){let t=function(e,t){let n=el(ex(e,t));return ec(e,[...n])}(this.root,e.value),n=el(ex(this.root,t));return eL({_nodes:[...n],context:e.context||{},children:{},status:ed(n,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return e$(e,t,n,[]).snapshot}microstep(e,t,n){return e$(e,t,n,[]).microstates}getTransitionData(e,t){return function e(t,n,r,i){if("string"==typeof n){let e=ev(t,n).next(r,i);return e&&e.length?e:t.next(r,i)}if(1===Object.keys(n).length){let o=Object.keys(n),s=e(ev(t,o[0]),n[o[0]],r,i);return s&&s.length?s:t.next(r,i)}let o=[];for(let s of Object.keys(n)){let a=n[s];if(!a)continue;let l=e(ev(t,s),a,r,i);l&&o.push(...l)}return o.length?o:t.next(r,i)}(this.root,e.value,e,t)||[]}getPreInitialState(e,t,n){let{context:r}=this.config,i=eL({context:"function"!=typeof r&&r?r:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof r?eM(i,t,e,[eK(({spawn:e,event:t,self:n})=>r({spawn:e,input:t.input,self:n}))],n,void 0):i}getInitialSnapshot(e,t){let n=I(t),r=[],i=this.getPreInitialState(e,n,r),{snapshot:o}
3=e$(eS([{target:[...eg(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,e,n,!0,r),n,e,r);return o}start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=$(e),n=t.slice(1),r=ep(t[0])?t[0].slice(1):t[0],i=this.idMap.get(r);if(!i)throw Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return eb(i,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){let{_nodes:n,tags:r,machine:i,children:o,context:s,can:a,hasTag:l,matches:u,getMeta:c,toJSON:d,...p}=e,f={};for(let e in o){let n=o[e];f[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...p,context:function e(t){let n;for(let r in t){let i=t[r];if(i&&"object"==typeof i)if("sessionId"in i&&"send"in i&&"ref"in i)(n??=Array.isArray(t)?t.slice():{...t})[r]={xstate$$type:1,id:i.id};else{let o=e(i);o!==i&&((n??=Array.isArray(t)?t.slice():{...t})[r]=o)}}return n??t}(s),children:f,historyValue:function(e){if("object"!=typeof e||null===e)return{};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(e=>({id:e.id})))}return t}(p.historyValue)}}restoreSnapshot(e,t){let n={},r=e.children;Object.keys(r).forEach(e=>{let i=r[e],o=i.snapshot,s=i.src,a="string"==typeof s?U(this,s):s;if(!a)return;let l=J(a,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:o,src:s,systemId:i.systemId});n[e]=l});let i=function(e,t){if(!t||"object"!=typeof t)return{};let n={};for(let r in t)for(let i of t[r]){let t=function(e,t){if(t instanceof e3)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,i);t&&(n[r]??=[],n[r].push(t))}return n}(this.root,e.historyValue),o=eL({...e,children:n,_nodes:Array.from(el(ex(this.root,e.value))),historyValue:i},this),s=new Set;return!function e(t,n){if(!s.has(t))for(let r in s.add(t),t){let i=t[r];if(i&&"object"==typeof i){if("xstate$$type"in i&&1===i.xstate$$type){t[r]=n[i.id];continue}e(i,n)}}}(o.context,n),o}}function e5(e,t,n,r,{event:i}){return[t,{event:"function"==typeof i?i(n,r):i},void 0]}function e6(e,{event:t}){e.defer(()=>e.emit(t))}function e8(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=e5,t.execute=e6,t}let e9=function(e){return e.Parent="#_parent",e.Internal="#_internal",e}({});function e7(e,t,n,r,{to:i,event:o,id:s,delay:a},l){let u,c,d=t.machine.implementations.delays;if("string"==typeof o)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);let p="function"==typeof o?o(n,r):o;if("string"==typeof a){let e=d&&d[a];u="function"==typeof e?e(n,r):e}else u="function"==typeof a?a(n,r):a;let f="function"==typeof i?i(n,r):i;if("string"==typeof f){if(!(c=f===e9.Parent?e.self._parent:f===e9.Internal?e.self:f.startsWith("#_")?t.children[f.slice(2)]:l.deferredActorIds?.includes(f)?f:t.children[f]))throw Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`)}else c=f||e.self;return[t,{to:c,targetId:"string"==typeof f?f:void 0,event:p,id:s,delay:u},void 0]}function te(e,t,n){"string"==typeof n.to&&(n.to=t.children[n.to])}function tt(e,t){e.defer(()=>{let{to:n,event:r,delay:i,id:o}=t;if("number"==typeof i)return void e.system.scheduler.schedule(e.self,n,r,i,o);e.system._relay(e.self,n,"xstate.error"===r.type?S(e.self.id,r.data):r)})}function tn(e,t,n){function r(e,t){}return r.type="xstate.sendTo",r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=e7,r.retryResolve=te,r.execute=tt,r}function tr(e,t){return tn(e9.Parent,e,t)}function ti(e,t,n,r,{collect:i}){let o=[],s=function(e){o.push(e)};return s.assign=(...e)=>{o.push(eK(...e))},s.cancel=(...e)=>{o.push(X(...e))},s.raise=(...e)=>{o.push(eV(...e))},s.sendTo=(...e)=>{o.push(tn(...e))},s.sendParent=(...e)=>{o.push(tr(...e))},s.spawnChild=(...e)=>{o.push(ee(...e))},s.stopChild=(...e)=>{o.push(er(...e))},s.emit=(...e)=>{o.push(e8(...e))},i({context:n.context,event:n.event,enqueue:s,check:e=>ei(e,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,o]}function to(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=ti,t}function ts(e,t,n,r,{value:i,label:o}){return[t,{value:"function"==typeof i?i(n,r):i,label:o},void 0]}function ta({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function tl(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=ts,n.execute=ta,n}function tu(e,t){let n=R(t);if(!n.some(t=>q(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}`)}}
3function tc({schemas:e,actors:t,actions:n,guards:r,delays:i}){return{assign:eK,sendTo:tn,raise:eV,log:tl,cancel:X,stopChild:er,enqueueActions:to,emit:e8,spawnChild:ee,createStateConfig:e=>e,createAction:e=>e,createMachine:o=>new e4({...o,schemas:e},{actors:t,actions:n,guards:r,delays:i}),extend:o=>tc({schemas:e,actors:t,actions:{...n,...o.actions},guards:{...r,...o.guards},delays:{...i,...o.delays}})}}var td=n(53737),tp=n(78197),tf=n(48085),th=n(81400),ty=n(34059),tm=n(84962),tg=n(56133),tv=n(66026),tb=n(27216),tx=n(73178);let tw=e=>({context:t})=>{let{count:n,include:r,exclude:i,responseType:o="message.received"}=e;return{count:n,domain:t.domain,from:t.connectTo,include:r?Array.isArray(r)?r:[r]:[],exclude:i?Array.isArray(i)?i:[i]:[],responseType:o,target:t.target,to:t.name}},t_=e=>t=>{let{data:n}=t;return(!e.include.length||e.include.includes(n.type))&&(!e.exclude.length||!e.exclude.includes(n.type))&&n.domain===e.domain&&n.from===e.from&&n.to===e.to&&(!e.target||t.source===e.target)},tE=e=>t=>({type:e,message:t}),tj=(0,td.v)(()=>(0,tp.R)(window,"message")),tk=e=>eW(({input:t})=>tj.pipe(e?(0,tf.T)(e):(0,th.F)(),(0,ty.p)(t_(t)),(0,tf.T)(tE(t.responseType)),t.count?(0,th.F)((0,tm.S)(t.count),(0,tg.H)(e=>e),(0,tv.s)(t.count)):(0,th.F)())),tS="sanity/comlink",tI="comlink/response",tT="comlink/heartbeat",tM="comlink/disconnect",t$="comlink/handshake/syn",tA="comlink/handshake/syn-ack",tC="comlink/handshake/ack",tO=e=>t=>t.pipe((0,tv.s)(1),(0,tf.T)(()=>{throw Error(e)})),tR=()=>tc({types:{},actors:{listen:eW(({input:e})=>{let t=e.signal?(0,tp.R)(e.signal,"abort").pipe(tO(`Request ${e.requestId} aborted`)):tb.w;return(0,tp.R)(window,"message").pipe((0,ty.p)(t=>t.data?.type===tI&&t.data?.responseTo===e.requestId&&!!t.source&&e.sources.has(t.source)),(0,tv.s)(e.sources.size),(0,tx.Q)(t))})},actions:{"send message":({context:e},t)=>{let{sources:n,targetOrigin:r}=e,{message:i}=t;n.forEach(e=>{e.postMessage(i,{targetOrigin:r})})},"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-${x()}`,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:r,from:i,id:o,responseTo:s,to:a,type:l}=e;return{message:{channelId:t,data:n,domain:r,from:i,id:o,to:a,type:l,responseTo:s}}}},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:eK({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})});o=({sendBack:e,input:t})=>{let n=()=>{e(t.event)};t.immediate&&n();let r=setInterval(n,t.interval);return()=>{clearInterval(r)}};let tP=()=>tc({types:{},actors:{requestMachine:tR(),listen:tk()},actions:{"buffer handshake":eK({handshakeBuffer:({event:e,context:t})=>(tu(e,"message.received"),[...t.handshakeBuffer,e])}),"buffer message":to(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>(tu(e,"post"),[...t.buffer,{data:e.data,resolvable:e.resolvable,options:e.options}])}),e.emit(({event:e})=>(tu(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":eK({requests:({context:e,event:t,self:n,spawn:r})=>{tu(t,"request");let i=(Array.isArray(t.data)?t.data:[t.data]).map(t=>r("requestMachine",{id:`req-${x()}`,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.o
3ptions?.suppressWarnings,targetOrigin:e.targetOrigin,to:e.connectTo,type:t.type}}));return[...e.requests,...i]}}),"emit heartbeat":e8(()=>({type:"heartbeat"})),"emit received message":to(({enqueue:e})=>{e.emit(({event:e})=>(tu(e,"message.received"),{type:"message",message:e.message.data}))}),"emit status":e8((e,t)=>({type:"status",status:t.status})),"post message":eV(({event:e})=>(tu(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":to(({context:e,enqueue:t})=>{e.handshakeBuffer.forEach(e=>t.raise(e)),t.assign({handshakeBuffer:[]})}),"remove request":to(({context:e,enqueue:t,event:n})=>{tu(n,["request.success","request.failed","request.aborted"]),er(n.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==n.requestId)})}),"send response":eV(({event:e})=>(tu(e,["message.received","heartbeat.received"]),{type:"request",data:{type:tI,responseTo:e.message.data.id,data:void 0}})),"send handshake syn ack":eV({type:"request",data:{type:tA}}),"send pending messages":to(({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)})),e.assign({buffer:[]})}),"set connection config":eK({channelId:({event:e})=>(tu(e,"handshake.syn"),e.message.data.channelId),target:({event:e})=>(tu(e,"handshake.syn"),e.message.source||void 0),targetOrigin:({event:e})=>(tu(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??tS,handshakeBuffer:[],name:e.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:tw({include:t$,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:tw({include:tC,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:tw({include:tM,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:tw({exclude:[tM,t$,tC,tT,tI]})}],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:tw({exclude:[tM,t$,tC,tT,tI]})},{id:"listen for heartbeat",src:"listen",input:tw({include:tT,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:tw({include:tM,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"]}}}}}),tN=(e,t=tP())=>{let n,r=J(t,{input:e}),i=new Map,o=new Map;r.on("message",({message:e})=>{let t=i.get(e.type);if(t)return void t.forEach(t=>t(e.data));let n=o.get(e.type);n?n.add(e):o.set(e.type,new Set([e]))});let s=()=>{r.stop()};return{actor:r,fetch:(e,t,n)=>{let{responseTimeout:i=1e4,signal:o,suppressWarnings:s}=n||{},a=function(){let e,t;return"function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}();return r.send({type:"post",data:{type:e,data:t},resolvable:a,options:{responseTimeout:i,signal:o,suppressWarnings:s}}),a.promise},machine:t,on:(e,t,n)=>{let r=i.get(e)||new Set;i.has(e)||i.set(e,r),r.add(t);let s=o.get(e);if(s){let r=n?.replay??1;Array.from(s).slice(-r).forEach(({data:e})=>t(e)),o.delete(e)}return()=>{r.delete(t)}},onStatus:(e,t)=>{let i=r.on("status",r=>{n=r.status,t&&r.status!==t||e(r.status)});return n&&e(n),()=>i.unsubscribe()},post:(e,t)=>
3{r.send({type:"post",data:{type:e,data:t}})},start:()=>(r.start(),s),stop:s}},tz={"handshake/syn":t$,"handshake/syn-ack":tA,"handshake/ack":tC,"channel/response":tI,"channel/heartbeat":tT,"channel/disconnect":tM,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},tL={[t$]:"handshake/syn",[tA]:"handshake/syn-ack",[tC]:"handshake/ack",[tI]:"channel/response",[tT]:"channel/heartbeat",[tM]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},tD=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=tS),"overlays"===t.to&&(t.to="visual-editing"),"overlays"===t.from&&(t.from="visual-editing"),t.channelId=t.connectionId,delete t.connectionId,t.type=tz[t.type]??t.type),e},tU=e=>{let{channelId:t,...n}=e,r={...n,connectionId:t};return r.domain===tS&&(r.domain="sanity/channels"),"visual-editing"===r.to&&(r.to="overlays"),"visual-editing"===r.from&&(r.from="overlays"),r.type=tL[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},tq=({context:e},t)=>{let{sources:n,targetOrigin:r}=e,i=tU(t.message);n.forEach(e=>{e.postMessage(i,{targetOrigin:r})})},tV=()=>({listen:tk(tD),requestMachine:tR().provide({actions:{"send message":tq}})});function tF(){return window.self!==window.top}function tY(){return!!window.opener}var tW=n(42069),tB=n(5453),tG=n(97380),tJ=n(70297);function tH(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):tZ.test(t=e)?Number(t):t})}let tZ=/^-?\d+$/;function tX(e){return"string"==typeof e?._key}let tK=/^[a-z_$]+/;function tQ(e){return e.map((e,t)=>{var n,r;return n=0===t,Array.isArray(e)?`[${e[0]}:${e[1]||""}]`:"number"==typeof e?`[${e}]`:"object"==typeof(r=e)&&"_key"in r&&"string"==typeof r._key?`[_key==${JSON.stringify(e._key)}]`:"string"==typeof e&&tK.test(e)?n?e:`.${e}`:`['${e}']`}).join("")}function t0(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,r,i,o,s;return{type:"patch",id:e.patch.id,patches:[..."set"in(n=t=e.patch)?Object.keys(n.set).map(e=>({path:tH(e),op:{type:"set",value:n.set[e]}})):[],..."setIfMissing"in(r=t)?Object.keys(r.setIfMissing).map(e=>({path:tH(e),op:{type:"setIfMissing",value:r.setIfMissing[e]}})):[],..."unset"in(i=t)?i.unset.map(e=>({path:tH(e),op:{type:"unset"}})):[],..."inc"in(o=t)?Object.keys(o.inc).map(e=>({path:tH(e),op:{type:"inc",amount:o.inc[e]}})):[],..."inc"in(s=t)?Object.keys(s.dec).map(e=>({path:tH(e),op:{type:"dec",amount:s.dec[e]}})):[],...function(e){if(!("insert"in e))return[];let t=function(e){let t=t1.filter(t=>t in e);if(t.length>1)throw Error(`Insert patch is ambiguous. Should only contain one of: ${t1.join(", ")}, instead found ${t.join(", ")}`);return t[0]}(e.insert);if(!t)throw Error("Insert patch missing position");let n=tH(e.insert[t]),r=n.pop();return[{path:n,op:{type:"insert",position:t,referenceItem:r,items:e.insert.items}}]}(t)]}}throw Error(`Unknown mutation: ${JSON.stringify(e)}`)}let t1=["before","replace","after"];function t2(e){return t4(e)}function t3(e){return e.flatMap(t2)}function t4(e){if("create"===e.type||"createIfNotExists"===e.type||"createOrReplace"===e.type)return{[e.type]:e.document};if("delete"===e.type)return{delete:{id:e.id}};let t=e.options?.ifRevision;return e.patches.map(n=>({patch:{id:e.id,...t&&{ifRevisionID:t},...function(e){let{path:t,op:n}=e;if("unset"===n.type)return{unset:[tQ(t)]};if("insert"===n.type)return{insert:{[n.position]:tQ([...t,n.referenceItem]),items:n.items}};if("diffMatchPatch"===n.type)return{diffMatchPatch:{[tQ(t)]:n.value}};if("inc"===n.type)return{inc:{[tQ(t)]:n.amount}};if("dec"===n.type)return{dec:{[tQ(t)]:n.amount}};if("set"===n.type||"setIfMissing"===n.type)return{[n.type]:{[tQ(t)]:n.value}};if("truncate"===n.type){let e=[n.startIndex,"number"==typeof n.endIndex?n.endIndex:""].join(":");return{unset:[`${tQ(t)}[${e}]`]}}if("upsert"===n.type)return{unset:n.items.map(e=>
3tQ([...t,{_key:e._key}])),insert:{[n.position]:tQ([...t,n.referenceItem]),items:n.items}};if("assign"===n.type)return{set:Object.fromEntries(Object.keys(n.value).map(e=>[tQ(t.concat(e)),n.value[e]]))};if("unassign"===n.type)return{unset:n.keys.map(e=>tQ(t.concat(e)))};if("replace"===n.type)return{insert:{replace:tQ(t.concat(n.referenceItem)),items:n.items}};if("remove"===n.type)return{unset:[tQ(t.concat(n.referenceItem))]};throw Error(`Unknown operation type ${n.type}`)}(n)}}))}function t5(e){return Array.isArray(e)?e:[e]}function t6(e){return"string"==typeof e?{_key:e}:e}function t8(e){return e?{options:{ifRevision:e}}:null}var t9=Object.freeze({__proto__:null,decode:function(e){return t0(e)},decodeAll:function(e){return e.map(t0)},encode:t2,encodeAll:t3,encodeMutation:t4,encodeTransaction:function(e){return{transactionId:e.id,mutations:t3(e.mutations)}}});function t7(e,t,n){return{type:"insert",referenceItem:n,position:t,items:t5(e)}}function ne(e,t){return{type:"truncate",startIndex:e,endIndex:t}}function nt(e){return{type:"remove",referenceItem:e}}function nn(e,t){return{path:"string"==typeof e?tH(e):e,op:t}}let nr=J(eZ),ni=nr,no=new Set,ns=/_key\s*==\s*['"](.*)['"]/,na=/^\d*:\d*$/;function nl(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function nu(e){return"string"==typeof e?ns.test(e.trim()):"object"==typeof e&&"_key"in e}let nc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nd=/_key\s*==\s*['"](.*)['"]/;
3function np(e,t,n){let r="string"==typeof t?function(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(nc);if(!t)throw Error("Invalid path string");return t.map(nf)}(t):t;if(!Array.isArray(r))throw Error("Path must be an array or a string");let i=e;for(let e=0;e<r.length;e++){let t=r[e];if(nl(t)){if(!Array.isArray(i))return n;i=i[t]}if(nu(t)){if(!Array.isArray(i))return n;i=i.find(e=>e._key===t._key)}if("string"==typeof t&&(i="object"==typeof i&&null!==i?i[t]:void 0),typeof i>"u")return n}return i}function nf(e){return nl(e)?Number(e.replace(/[^\d]/g,"")):nu(e)?{_key:e.match(nd)[1]}:!function(e){if("string"==typeof e&&na.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 nh(){return(0,h.useSyncExternalStore)(ng,nm,ny)}function ny(){return nr}function nm(){return ni}function ng(e){return no.add(e),()=>no.delete(e)}function nv(){let e,t=(0,m.c)(2),n=nh();return t[0]!==n?(e=n===nr,t[0]=n,t[1]=e):e=t[1],!e}function nb(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(e,r)},t)}}function nx(e,t){let n=tF(),r=tY();if(t===nr||!n&&!r)throw Error("The `useDocuments` hook cannot be used in this context");let i=(0,tB.T4)(e),o=(0,tB.IM)(e),s=t.getSnapshot().context?.documents,a=s?.[i],l=s?.[o],u=a||l;if(!u)throw Error(`Document "${e}" not found`);let c=a.getSnapshot().context?.local||l.getSnapshot().context?.local,d=new Promise(e=>{if(c)e(c);else{let t=u.on("ready",n=>{let{snapshot:r}=n;e(r||null),t.unsubscribe()})}});return{draftDoc:a,draftId:i,getSnapshot:()=>d,publishedDoc:l,publishedId:o,get snapshot(){if(!c)throw Error(`Snapshot for document "${e}" not found`);return c}}}function nw(){let e,t,n,r=(0,m.c)(7),i=nh();r[0]!==i?(e=e=>({id:e,commit:()=>{let{draftDoc:t}=nx(e,i);t.send({type:"submit"})},get:t=>{let{snapshot:n}=nx(e,i);return t?np(n,t):n},getSnapshot:function(e,t){let{getSnapshot:n}=nx(e,t);return n}(e,i),patch:async(t,n)=>{let r=nx(e,i),{draftDoc:o,draftId:s,getSnapshot:a,publishedId:l}=r,{commit:u=!0}=n||{},c=await ("function"==typeof t?t({draftId:s,publishedId:l,get snapshot(){return r.snapshot},getSnapshot:a}):t),d=await a();if(!d)throw Error(`Snapshot for document "${e}" not found`);o.send({type:"mutate",mutations:[{type:"createIfNotExists",document:{...d,_id:s}},{type:"patch",id:s,patches:t5(c),...{}}]}),u&&("object"==typeof u&&"debounce"in u?nb(()=>o.send({type:"submit"}),u.debounce)():o.send({type:"submit"}))}}),r[0]=i,r[1]=e):e=r[1];let o=e;r[2]!==i?(t=(e,t,n)=>{let{draftDoc:r}=nx(e,i),{commit:o}=n||{},s=void 0===o||o;r.send({type:"mutate",mutations:t}),s&&("object"==typeof s&&"debounce"in s?nb(()=>r.send({type:"submit"}),s.debounce)():r.send({type:"submit"}))},r[2]=i,r[3]=t):t=r[3];let s=t;return r[4]!==o||r[5]!==s?(n={getDocument:o,mutateDocument:s},r[4]=o,r[5]=s,r[6]=n):n=r[6],n}let n_=(()=>{let e;return()=>{if(e)return e;e=[];for(let t=0;t<256;++t)e[t]=(t+256).toString(16).slice(1);return e}})();function nE(e){let t=n_();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 nj(e){let t,n,r="string"==typeof e?e:e.path,i=r.lastIndexOf("."),o=r.substring(i+1,r.length);if(!o.indexOf("["))throw Error("Invalid path: not an array");let s=r.lastIndexOf("["),a=r.substring(0,s);if(o.includes("_key")){let e=o.indexOf('"')+1,r=o.indexOf('"',e);t=o.substring(e,r),n=!0}else{let e=o.indexOf("[")+1,r=o.indexOf("]",e);t=o.substring(e,r),n=!1}if(!a||!t)throw Error("Invalid path");return{path:a,key:t,hasExplicitKey:n}}async function nk(e,t,n){if(!e.type)throw Error("Node type is missing");let{path:r,key:i}=nj(e),o=await t.getSnapshot(),s=np(o,r),a=np(o,e.path),l=s.findIndex(e=>e._key===i),u=-1,c="before";if("first"===n){if(0===l)return[];u=0,c="before"}else if("last"===n){if(l===s.length-1)return[];u=-1,c="after"}else if("next"===n){if(l===s.length-1)return[];u=l,c="after"}else if("previous"===n){if(0===l)return[];u=l-1,c="before"}return[nn(r,ne(l,l+1)),nn(r,t7(a,c,u))]}var nS=n(44283);let nI=(0,nS.FsL)((0,nS.YjP)(),(0,nS.BpQ)(1)),nT=(0,nS.lqM)(nI),nM=(0,nS.Ikc)({baseUrl:nI,dataset:nT,id:nI,path:nI,projectId:nT,tool:nT,type:nT,workspace:nT,perspective:(0,nS.NpB)((0,nS.YjP)(),"drafts")}),n$=/^([\w-]+):(0|[1-9][0-9]*)$/,nA=/^([\w-]+):([0-9]+),([0-9]+)$/,nC=/^([\
3w-]+):([\w-]+)$/,nO=(0,nS.FsL)((0,nS.YjP)(),(0,nS.BpQ)(1)),nR=(0,nS.Ikc)({origin:nO,href:nO,data:(0,nS.lqM)((0,nS.g1P)((0,nS.YjP)(),(0,nS.L5J)()))});function nP(e){let t=(0,nS.xLC)(nM,e);if(t.success)return t.output;let n=(0,nS.xLC)(nR,e);if(n.success)try{let e=new URL(n.output.href,typeof document>"u"?"https://example.com":location.origin);return e.searchParams.size>0?(0,nS.qgA)(nM,Object.fromEntries(e.searchParams.entries())):n.output}catch(e){return console.error("Failed to parse sanity node",e),n.output}}var nN={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},nz={0:8203,1:8204,2:8205,3:65279},nL={0:String.fromCodePoint(nz[0]),1:String.fromCodePoint(nz[1]),2:String.fromCodePoint(nz[2]),3:String.fromCodePoint(nz[3])},nD=[,,,,].fill(String.fromCodePoint(nz[0])).join(""),nU=Object.fromEntries(Object.entries(nL).map(e=>[e[1],+e[0]])),nq=Object.fromEntries(Object.entries(nN).map(e=>e.reverse())),nV=`${Object.values(nN).map(e=>`\\u{${e.toString(16)}}`).join("")}`,nF=RegExp(`[${nV}]{4,}`,"gu");let nY=[];for(let e=0;e<256;++e)nY.push((e+256).toString(16).slice(1));let nW=new Uint8Array(16);var nB={randomUUID:"u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function nG(e,t,n){if(nB.randomUUID&&!e)return nB.randomUUID();let r=(e=e||{}).random??e.rng?.()??function(){if(!i){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");i=crypto.getRandomValues.bind(crypto)}return i(nW)}();if(r.length<16)throw Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(nY[e[t+0]]+nY[e[t+1]]+nY[e[t+2]]+nY[e[t+3]]+"-"+nY[e[t+4]]+nY[e[t+5]]+"-"+nY[e[t+6]]+nY[e[t+7]]+"-"+nY[e[t+8]]+nY[e[t+9]]+"-"+nY[e[t+10]]+nY[e[t+11]]+nY[e[t+12]]+nY[e[t+13]]+nY[e[t+14]]+nY[e[t+15]]).toLowerCase()}(r)}function nJ(e){let t=e.getBoundingClientRect();return{x:t.x+scrollX,y:t.y+scrollY,w:t.width,h:t.height}}function nH(e,t,n){return"x"===n?{x:e.x+t,y:e.y,w:e.w-2*t,h:e.h}:{x:e.x,y:e.y+t,w:e.w,h:e.h-2*t}}function nZ(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function nX(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function nK(e,t,n){let r,i,o={x:e.x1,y:e.y1};if(t.some(e=>(function(e,t){let n=e.x>=t.x&&e.x<=t.x+t.w,r=e.y>=t.y&&e.y<=t.y+t.h;return n&&r})(o,nH(e,Math.min(e.w,e.h)/10,"horizontal"===n?"x":"y"))))return null;for(let s of t){let t=function(e,t){let n=[{x1:t.x,y1:t.y,x2:t.x+t.w,y2:t.y},{x1:t.x+t.w,y1:t.y,x2:t.x+t.w,y2:t.y+t.h},{x1:t.x+t.w,y1:t.y+t.h,x2:t.x,y2:t.y+t.h},{x1:t.x,y1:t.y+t.h,x2:t.x,y2:t.y}],r=[];for(let t=0;t<n.length;t++){let i=function(e,t){let{x1:n,y1:r,x2:i,y2:o}=e,{x1:s,y1:a,x2:l,y2:u}=t;if(n===i&&r===o||s===l&&a===u)return!1;let c=(u-a)*(i-n)-(l-s)*(o-r);if(0===c)return!1;let d=((l-s)*(r-a)-(u-a)*(n-s))/c,p=((i-n)*(r-a)-(o-r)*(n-s))/c;return!(d<0)&&!(d>1)&&!(p<0)&&!(p>1)&&{x:n+d*(i-n),y:r+d*(o-r)}}(e,n[t]);if(i){let e=!1;for(let t=0;t<r.length;t++)r[t].x===i.x&&r[t].y===i.y&&(e=!0);e||r.push(i)}}return 0!==r.length&&r.sort((t,n)=>nX(t,{x:e.x1,y:e.y1})-nX(n,{x:e.x1,y:e.y1}))}(e,nH(s,Math.min(s.w,s.h)/10,"horizontal"===n?"x":"y"));if(t){let e=t[0];r?nX(o,e)<nX(o,r)&&(r=e,i=s):(r=e,i=s)}}return i||null}function nQ(e,t,n){let{x:r,y:i,w:o,h:s}=e,{x:a,y:l}=n;return{x:a+(r-a)*t,y:l+(i-l)*t,w:o*t,h:s*t}}function n0(e){let t=Math.max(0,Math.min(...e.map(e=>e.y))),n=Math.min(document.body.scrollHeight,Math.max(...e.map(e=>e.y+e.h)));return{min:t,max:n,height:n-t}}function n1(e,t){return t.find(t=>nZ(nJ(t.elements.element),e))?.sanity}function n2(e,t,n){return Object.values(t).every(e=>null===e)?null:"horizontal"===n?{left:t.left?{rect:t.left,sanity:n1(t.left,e)}:null,right:t.right?{rect:t.right,sanity:n1(t.right,e)}:null}:{top:t.top?{rect:t.top,sanity:n1(t.top,e)}:null,bottom:t.bottom?{rect:t.bottom,sanity:n1(t.bottom,e)}:null}}function n3(e){let t=document.body.getBoundingClientRect();return{x:Math.max(t.x,Math.min(e.clientX,t.x+t.width)),y:e.clientY+window.scrollY}}function n4(e,t,n){let r=nJ(t),i=[...t.querySelectorAll(":where(h1, h2, h3, h4, p, a, img, span, button):not(:has(*))")];e.x<=r.x&&(e.x=r.x),e.x>=r.x+r.w&&(e.x=r.x+r.w),e.y>=r.y+r.h&&(e.y=r.y+r.h),e.y<=r.y&&(e.y=r.y);let o=i.map(e=>{let t=nQ(nJ(e),n,{x:r.x,y:r.y});return{x:t.x-r.x,y:t.y-r.y,w:t.w,h:t.h,tagName:e.tagName}});return{offsetX:(r.x-e.x)*n,offsetY:(r.y-e.y)*n,w:r.w*n,h:r.h*n,maxWidth:r.w*n*.75,childRects:o}}async function n5(e,t,n,r,i){return new Promise(o=>{e.addEventListener("transitionend",()=>{setTimeout(()=>{r({type:"overlay/dragEndMinimapTransition"})},2*i),o()},{once:!0}),r({type:"overlay/dragStartMinimapTransition"}),r({type:"overlay/dragToggleMinimap",display:!0}),document.body.style.overflow="hidden",document.body.style.height="100%",document.documentElement.style.overflow="initial",document.documentElement.style.height="100%",setTimeout(()=>{e.style.transformOrigin="50% 0px",e.style.transition="transform 150ms ease",e.style.transform=`translate3d(0px, ${-n+scrollY}px, 0px) scale(${t})`},25)})}function n6(e){let t=function(e){let t=Math.max(0,Math.min(...e.map(e=>e.x))),n=Math.min(document.body.offsetWidth,Math.max(...e.map(e=>e.x+e.w)));return{min:t,max:n,width:n-t}}(e),n=n0(e),r=t.min>8&&t.min+t.width<=window.innerWidth-8,i=n.min>8&&n.min+n.height<=document.body.scrollHeight-8,o=r&&i;return{x:o?t.min-8:t.min,y:o?n.min-8:n.min,w:o?t.width+16:t.width,h:o?n.height+16:n.height}}async function n8(e,t,n,r,i,o){return new Promise(s=>{if(1===new DOMMatrix(window.getComputedStyle(t).transform).a)return;let a=n-window.innerHeight,l=scrollY;(e-=window.innerHeight/2)<0&&(e=0),t.addEventListener("transitionend",()=>{t.style.transition="none",t.style.transform="none",scrollTo({top:e,behavior:"instant"}),setTimeout(()=>{r({type:"overlay/dragEndMinimapTransition"}),r({type:"overlay/dragToggleMinimap",display:!1})},2*i),s()},{once:!0}),r({type:"overlay/dragStartMinimapTransition"}),t.style.transform=`translateY(${Math.max(l-e,-a+l)}px) scale(1)`,o&&(document.body.style.overflow=o.body.overflow,document.body.style.height=o.body.height,document.documentElement.style.overflow=o.documentElement.overflow,document.documentElement.style.height=o.documentElement.height)})}let n9=!1,n7={y:0},re={x:0,y:0},rt=typeof document>"u"?0:document.documentElement.scrollHeight,rn=null,rr=e=>e instanceof HTMLElement||e instanceof SVGElement,ri=e=>e&&rr(e)?e.dataset?.sanityOverlayElement?e:ri(e.parentElement):null;function ro(e){return nF.lastIndex=0,nF.test(e)}function rs(e,t=!1){return ro(e)?function(e,t=!1){try{let n=function(e){let t=e.match(nF);if(t)return function(e,t=!1){let n=Array.from(e);if(n.length%2==0){if(n.length%4||!e.startsWith(nD))return function(e,t){var n;let r=[];for(let t=.5*e.length;t--;){let n=`${nq[e[2*t].codePointAt(0)]}${nq[e[2*t+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(n,16)))}let i=[],o=[r.join("")],s=10;for(;o.length;){let e=o.shift();try{if(i.push(JSON.parse(e)),t)break}catch(r){if(!s--)throw r;let t=+(null==(n=r.message.match(/\sposition\s(\d+)$/))?void 0:n[1]);if(!t)throw r;o.unshift(e.substring(0,t),e.substring(t))}}return i}(n,t)}
3else throw Error("Encoded data has invalid length");let r=n.slice(4),i=new Uint8Array(r.length/4);for(let e=0;e<i.length;e++)i[e]=nU[r[4*e]]<<6|nU[r[4*e+1]]<<4|nU[r[4*e+2]]<<2|nU[r[4*e+3]];let o=new TextDecoder().decode(i);if(t){let e=o.indexOf("\0");return -1===e&&(e=o.length),[JSON.parse(o.slice(0,e))]}return o.split("\0").filter(Boolean).map(e=>JSON.parse(e))}(t[0],!0)[0]}(e);return n&&"sanity.io"===n.origin?(t&&(n.href=n.href?.replace(".alt","")),n):null}catch(t){return console.error("Failed to decode stega for string: ",e,"with the original error: ",t),null}}(e,t):null}let ra=e=>e.nodeType===Node.ELEMENT_NODE,rl=e=>"IMG"===e.tagName,ru=e=>"TIME"===e.tagName,rc=e=>"SVG"===e.tagName.toUpperCase();function rd(e){return"path"in e}function rp(e){if(!e.length||!e.map(e=>rd(e)).every((e,t,n)=>e===n[0]))return;if(!rd(e[0]))return e[0];let t=e.filter(rd),n=e[0],r=["projectId","dataset","id","baseUrl","workspace","tool"];for(let e=1;e<t.length;e++){let i=t[e];if(r.some(e=>i[e]!==n?.[e])){n=void 0;break}n={...n,path:function(e,t){let n=e.split("."),r=t.split("."),i=Math.min(n.length,r.length);return n=n.slice(0,i).reverse(),r=r.slice(0,i).reverse(),n.reduce((e,t,n)=>t===r[n]?[...e,t]:[],[]).reverse().join(".")}(n.path,i.path)}}return n}function rf(e){let t=e.lastIndexOf(".");return e.substring(t,e.length).includes("[")}function rh(e){if(!rf(e))return null;let t=e.split(".");return t[t.length-1]=t[t.length-1].replace(/\[.*?\]/g,"[]"),t.join(".")}function ry(e,t){return!!rf(e.path)&&!!rf(t.path)&&rh(e.path)===rh(t.path)}function rm(e,t,n,r){if(!e.getAttribute("data-sanity")||e.getAttribute("data-sanity-drag-disable")||!t||!rd(t)||!rf(t.path))return null;let i=e.getAttribute("data-sanity-drag-group"),o=[...n].reduce((e,n)=>{let o=r.get(n),s=n.getAttribute("data-sanity-drag-disable"),a=n.getAttribute("data-sanity-drag-group"),l=null!==n.getAttribute("data-sanity");return o?.sanity&&!s&&rd(o.sanity)&&ry(t,o.sanity)&&(null===i||i===a)&&l&&e.push(o),e},[]);return o.length<=1?null:o}let rg=(0,h.createContext)(null);var rv=n(91172);let rb=function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n};var rx=function(e){return function(t){return null==e?void 0:e[t]}}({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),rw="object"==typeof global&&global&&global.Object===Object&&global,r_="object"==typeof self&&self&&self.Object===Object&&self,rE=rw||r_||Function("return this")(),rj=rE.Symbol;let rk=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i};var rS=Array.isArray,rI=Object.prototype,rT=rI.hasOwnProperty,rM=rI.toString,r$=rj?rj.toStringTag:void 0;let rA=function(e){var t=rT.call(e,r$),n=e[r$];try{e[r$]=void 0;var r=!0}catch(e){}var i=rM.call(e);return r&&(t?e[r$]=n:delete e[r$]),i};var rC=Object.prototype.toString,rO=rj?rj.toStringTag:void 0;
3let rR=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":rO&&rO in Object(e)?rA(e):rC.call(e)},rP=function(e){return null!=e&&"object"==typeof e},rN=function(e){return"symbol"==typeof e||rP(e)&&"[object Symbol]"==rR(e)};var rz=1/0,rL=rj?rj.prototype:void 0,rD=rL?rL.toString:void 0;let rU=function e(t){if("string"==typeof t)return t;if(rS(t))return rk(t,e)+"";if(rN(t))return rD?rD.call(t):"";var n=t+"";return"0"==n&&1/t==-rz?"-0":n},rq=function(e){return null==e?"":rU(e)};var rV=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,rF=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),rY=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,rW=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rB="\ud800-\udfff",rG="\\u2700-\\u27bf",rJ="a-z\\xdf-\\xf6\\xf8-\\xff",rH="A-Z\\xc0-\\xd6\\xd8-\\xde",rZ="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rX="['’]",rK="["+rZ+"]",rQ="["+rJ+"]",r0="[^"+rB+rZ+"\\d+"+rG+rJ+rH+"]",r1="(?:\ud83c[\udde6-\uddff]){2}",r2="[\ud800-\udbff][\udc00-\udfff]",r3="["+rH+"]",r4="(?:"+rQ+"|"+r0+")",r5="(?:"+r3+"|"+r0+")",r6="(?:"+rX+"(?:d|ll|m|re|s|t|ve))?",r8="(?:"+rX+"(?:D|LL|M|RE|S|T|VE))?",r9="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\ud83c[\udffb-\udfff])?",r7="[\\ufe0e\\ufe0f]?",ie="(?:\\u200d(?:"+["[^"+rB+"]",r1,r2].join("|")+")"+r7+r9+")*",it="(?:"+["["+rG+"]",r1,r2].join("|")+")"+(r7+r9+ie),ir=RegExp([r3+"?"+rQ+"+"+r6+"(?="+[rK,r3,"$"].join("|")+")",r5+"+"+r8+"(?="+[rK,r3+r4,"$"].join("|")+")",r3+"?"+r4+"+"+r6,r3+"+"+r8,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",it].join("|"),"g");let ii=function(e,t,n){if(e=rq(e),void 0===(t=n?void 0:t)){var r;return(r=e,rW.test(r))?e.match(ir)||[]:e.match(rY)||[]}return e.match(t)||[]};var io=RegExp("['’]","g");let is=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o},ia=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:is(e,t,n)};var il=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");let iu=function(e){return il.test(e)};var ic="\ud800-\udfff",id="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ip="\ud83c[\udffb-\udfff]",ih="[^"+ic+"]",iy="(?:\ud83c[\udde6-\uddff]){2}",im="[\ud800-\udbff][\udc00-\udfff]",ig="(?:"+id+"|"+ip+")?",iv="[\\ufe0e\\ufe0f]?",ib="(?:\\u200d(?:"+[ih,iy,im].join("|")+")"+iv+ig+")*",ix=RegExp(ip+"(?="+ip+")|"+("(?:"+[ih+id+"?",id,iy,im,"["+ic+"]"].join("|"))+")"+(iv+ig+ib),"g");let iw=function(e){var t,n=iu(e=rq(e))?iu(t=e)?t.match(ix)||[]:t.split(""):void 0,r=n?n[0]:e.charAt(0),i=n?ia(n,1).join(""):e.slice(1);return r.toUpperCase()+i};var i_=(c=function(e,t,n){return e+(n?" ":"")+iw(t)},function(e){var t;return rb(ii(((t=rq(t=e))&&t.replace(rV,rx).replace(rF,"")).replace(io,"")),c,"")}),iE=n(69119);function ij(e){let t=function e(t){var n;return!!(n=t)&&("object"==typeof n||"function"==typeof n)&&("reference"===t.name||e(t.type))}(e)&&1===(e.to??[]).length?e.to[0].icon:void 0;return e.icon??e.type?.icon??t}function ik(e,t){return{query:"change query"===t.type?t.query:e.query,groups:"select group"===t.type?e.groups.map(e=>({...e,selected:t.name===e.name})):e.groups,views:"toggle view"===t.type?e.views.map(e=>({...e,selected:t.name===e.name})):e.views}}let iS="all-items",iI={gridTemplateColumns:"repeat(auto-fill, minmax(118px, 1fr))",alignItems:"start"};function iT(e){let t,n,r,i,o,s,a,l,u,c,d,p,y,g,v,b,x=(0,m.c)(54),w=void 0===e.showIcons||e.showIcons,_=void 0===e.filter||"auto"===e.filter?e.schemaTypes.length>5:e.filter;x[0]!==e.groups||x[1]!==e.labels?(t=e.groups?[{name:iS,title:e.labels["insert-menu.filter.all-items"],selected:!0},...e.groups.map(iA)]:[],x[0]=e.groups,x[1]=e.labels,x[2]=t):t=x[2],x[3]!==e.views?(n=e.views??[{name:"list"}],x[3]=e.views,x[4]=n):n=x[4],x[5]!==n?(r=n.map(i$),x[5]=n,x[6]=r):r=x[6],x[7]!==t||x[8]!==r?(i={query:"",groups:t,views:r},x[7]=t,x[8]=r,x[9]=i):i=x[9];let[E,j]=(0,h.useReducer)(ik,i);if(x[10]!==e||x[11]!==_||x[12]!==w||x[13]!==E.groups||x[14]!==E.query||x[15]!==E.views){var k,S,I;let t,n,r,i=(k=e.schemaTypes,S=E.query,I=E.groups,k.filter(e=>(function(e,t){let n=t.find(e=>e.selected);return!n||n.name===iS||n.of?.includes(e.name)})(e,I)&&function(e,t){let n=t.trim().toLowerCase();return e.title?e.title?.toLowerCase().includes(n):e.name.includes(n)}(e,S))),h=E.views.find(iM),m=_||E.views.length>1,g=E.groups&&E.groups.length>0,v=m||g;a=tG.W1,y=0,s=tG.so,c="column",d="fill",x[25]!==v?(t=v?{style:{borderBottom:"1px solid var(--card-border-color)"},paddingBottom:1}:{},x[25]=v,x[26]=t):t=x[26],x[27]!==e.labels||x[28]!==_||x[29]!==m||x[30]!==E.query||x[31]!==E.views?(n=m?(0,f.jsxs)(tG.so,{flex:"none",align:"center",paddingTop:1,paddingX:1,gap:1,children:[_?(0,f.jsx)(tG.az,{flex:1,children:(0,f.jsx)(tG.ks,{autoFocus:!0,border:!1,fontSize:1,icon:rv.WIv,onChange:e=>{j({type:"change query",query:e.target.value})},placeholder:e.labels["insert-menu.search.placeholder"],value:E.query})}):null,E.views.length>1?(0,f.jsx)(tG.az,{flex:"none",children:(0,f.jsx)(iR,{views:E.views,onToggle:e=>{j({type:"toggle view",name:e})},labels:e.labels})}):null]}):null,x[27]=e.labels,x[28]=_,x[29]=m,x[30]=E.query,x[31]=E.views,x[32]=n):n=x[32],x[33]!==g||x[34]!==E.groups?(r=g?(0,f.jsx)(tG.az,{paddingTop:1,paddingX:1,children:(0,f.jsx)(tG.wb,{space:1,children:E.groups.map(e=>(0,f.jsx)(tG.oz,{id:`${e.name}-tab`,"aria-controls":`${e.name}-panel`,label:e.title??i_(e.name),selected:e.selected,onClick:()=>{j({type:"select group",name:e.name})}},e.name))})}):null,x[33]=g,x[34]=E.groups,x[35]=r):r=x[35],x[36]!==t||x[37]!==n||x[38]!==r?(p=(0,f.jsxs)(tG.az,{...t,children:[n,r]}),x[36]=t,x[37]=n,x[38]=r,x[39]=p):p=x[39],o=tG.az,l=1,u=0===i.length?(0,f.jsx)(tG.az,{padding:2,children:(0,f.jsx)(tG.EY,{muted:!0,size:1,children:e.labels["insert-menu.search.no-results"]})}):h?"grid"===h.name?(0,f.jsx)(tG.xA,{autoRows:"auto",flex:1,gap:1,style:iI,children:i.map(t=>(0,f.jsx)(iN,{icon:w?ij(t):void 0,onClick:()=>{e.onSelect(t)},previewImageUrl:h.previewImageUrl?.(t.name),schemaType:t}
3,t.name))}):(0,f.jsx)(tG.BJ,{flex:1,space:1,children:i.map(t=>(0,f.jsx)(tG.Dr,{icon:w?ij(t):void 0,onClick:()=>{e.onSelect(t)},text:t.title??i_(t.name)},t.name))}):null,x[10]=e,x[11]=_,x[12]=w,x[13]=E.groups,x[14]=E.query,x[15]=E.views,x[16]=o,x[17]=s,x[18]=a,x[19]=l,x[20]=u,x[21]=c,x[22]=d,x[23]=p,x[24]=y}else o=x[16],s=x[17],a=x[18],l=x[19],u=x[20],c=x[21],d=x[22],p=x[23],y=x[24];return x[40]!==o||x[41]!==l||x[42]!==u?(g=(0,f.jsx)(o,{padding:l,children:u}),x[40]=o,x[41]=l,x[42]=u,x[43]=g):g=x[43],x[44]!==s||x[45]!==g||x[46]!==c||x[47]!==d||x[48]!==p?(v=(0,f.jsxs)(s,{direction:c,height:d,children:[p,g]}),x[44]=s,x[45]=g,x[46]=c,x[47]=d,x[48]=p,x[49]=v):v=x[49],x[50]!==a||x[51]!==v||x[52]!==y?(b=(0,f.jsx)(a,{padding:y,children:v}),x[50]=a,x[51]=v,x[52]=y,x[53]=b):b=x[53],b}function iM(e){return e.selected}function i$(e,t){return{...e,selected:0===t}}function iA(e){return{...e,selected:!1}}let iC={grid:rv.jxC,list:rv.r$9},iO={grid:"insert-menu.toggle-grid-view.tooltip",list:"insert-menu.toggle-list-view.tooltip"};function iR(e){let t,n,r,i,o=(0,m.c)(11),s=e.views.findIndex(iP),a=e.views[s+1]??e.views[0],l=e.labels[iO[a.name]];o[0]!==l?(t=(0,f.jsx)(tG.EY,{size:1,children:l}),o[0]=l,o[1]=t):t=o[1];let u=iC[a.name];return o[2]!==a.name||o[3]!==e?(n=()=>{e.onToggle(a.name)},o[2]=a.name,o[3]=e,o[4]=n):n=o[4],o[5]!==u||o[6]!==n?(r=(0,f.jsx)(tG.$n,{mode:"bleed",icon:u,onClick:n}),o[5]=u,o[6]=n,o[7]=r):r=o[7],o[8]!==t||o[9]!==r?(i=(0,f.jsx)(tG.m_,{content:t,placement:"top",portal:!0,children:r}),o[8]=t,o[9]=r,o[10]=i):i=o[10],i}function iP(e){return e.selected}function iN(e){let t,n,r,i,o,s,a,l,u,c=(0,m.c)(19),[d,p]=(0,h.useState)(!1),y=e.icon;c[0]===Symbol.for("react.memo_cache_sentinel")?(t={overflow:"hidden"},c[0]=t):t=c[0],c[1]===Symbol.for("react.memo_cache_sentinel")?(n={backgroundColor:"var(--card-muted-bg-color)",paddingBottom:"66.6%",position:"relative"},c[1]=n):n=c[1],c[2]!==y?(r=(0,iE.isValidElementType)(y)?(0,f.jsx)(tG.so,{align:"center",justify:"center",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:(0,f.jsx)(tG.EY,{size:1,children:(0,f.jsx)(y,{})})}):null,c[2]=y,c[3]=r):r=c[3],c[4]!==d||c[5]!==e.previewImageUrl?(i=!e.previewImageUrl||d?null:(0,f.jsx)("img",{src:e.previewImageUrl,style:{objectFit:"contain",width:"100%",height:"100%",position:"absolute",inset:0},onError:()=>{p(!0)}}),c[4]=d,c[5]=e.previewImageUrl,c[6]=i):i=c[6],c[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,f.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxShadow:"inset 0 0 0 0.5px var(--card-fg-color)",opacity:.1}}),c[7]=o):o=c[7],c[8]!==r||c[9]!==i?(s=(0,f.jsxs)(tG.az,{flex:"none",style:n,children:[r,i,o]}),c[8]=r,c[9]=i,c[10]=s):s=c[10];let g=e.schemaType.title??e.schemaType.name;return c[11]!==g?(a=(0,f.jsx)(tG.az,{flex:"none",paddingX:2,paddingY:1,children:(0,f.jsx)(tG.EY,{size:1,weight:"medium",children:g})}),c[11]=g,c[12]=a):a=c[12],c[13]!==s||c[14]!==a?(l=(0,f.jsxs)(tG.so,{direction:"column",gap:1,padding:1,children:[s,a]}),c[13]=s,c[14]=a,c[15]=l):l=c[15],c[16]!==e.onClick||c[17]!==l?(u=(0,f.jsx)(tG.Dr,{padding:0,radius:2,onClick:e.onClick,style:t,children:l}),c[16]=e.onClick,c[17]=l,c[18]=u):u=c[18],u}function iz(e){if(!e)return(0,f.jsx)(rv.XRf,{});if("string"===e.type)return(0,f.jsx)(rv.H3M,{});if("number"===e.type)return(0,f.jsx)(rv.bZn,{});let{value:t}=e;if("icon"in e&&e.icon)return(0,f.jsx)("div",{dangerouslySetInnerHTML:{__html:e.icon}});let{type:n}=t;if("string"===n)return(0,f.jsx)(rv.H3M,{});if("boolean"===n)return(0,f.jsx)(rv.Dee,{});if("number"===n)return(0,f.jsx)(rv.bZn,{});if("array"===n||"union"===n)return(Array.isArray(t.of)?t.of:[t.of]).some(e=>"name"in e&&"block"===e.name)?(0,f.jsx)(rv.a1,{}):(0,f.jsx)(rv.Ss4,{});if("object"===n){if("image"===e.name)return(0,f.jsx)(rv.xfq,{});if("block"===e.name)return(0,f.jsx)(rv.H3M,{})}return(0,f.jsx)(rv.XRf,{})}let iL=(0,tJ.AH)`
4  overflow-y: scroll;
5  overscroll-behavior: contain;
6  -ms-overflow-style: none;
7  scrollbar-width: none;
8  
9  &:before {
10    content: '';
11    display: block;
12    height: calc(100% + 1px);
13    position: absolute;
14    top: 0;
15    width: 100%;
16    z-index: -1;
17  }
18`,iD=tJ.I4.div`
19  height: 100%;
20  inset: 0;
21  pointer-events: all;
22  position: fixed;
23  width: 100%;
24  display: flex;
25  justify-content: center;
26  align-items: center;
27
28  ${e=>e.$blockScroll&&iL}
29`,iU=tJ.I4.div`
30  background: transparent;
31  height: 100%;
32  inset: 0;
33  position: absolute;
34  width: 100%;
35`,iq=e=>{let t,n=(0,m.c)(2);return n[0]!==e?(t=(0,f.jsx)(tG.ZL,{children:(0,f.jsx)(iV,{...e})}),n[0]=e,n[1]=t):t=n[1],t},iV=e=>{let t,n,r=(0,m.c)(7),{children:i,onDismiss:o,setBoundaryElement:s,blockScroll:a}=e,l=void 0===a||a;return r[0]!==o?(t=(0,f.jsx)(iU,{onMouseDownCapture:()=>{o?.()}}),r[0]=o,r[1]=t):t=r[1],r[2]!==l||r[3]!==i||r[4]!==s||r[5]!==t?(n=(0,f.jsxs)(iD,{"data-sanity-overlay-element":!0,ref:s,onClick:iF,$blockScroll:l,children:[t,i]}),r[2]=l,r[3]=i,r[4]=s,r[5]=t,r[6]=n):n=r[6],n};function iF(e){e.stopPropagation()}function iY(e){return{type:"log",name:e.name,version:e.version,description:e.description,maxSampleRate:e.maxSampleRate,schema:void 0}}let iW={"Visual Editing Drag Sequence Completed":iY({name:"Visual Editing Drag Sequence Completed",description:"An array is successfully reordered using drag and drop.",version:1}),"Visual Editing Drag Minimap Enabled":iY({name:"Visual Editing Drag Minimap Enabled",description:"The zoomed-out minimap view is enabled during a drag sequence.",version:1}),"Visual Editing Context Menu Item Removed":iY({name:"Visual Editing Context Menu Item Removed",description:"An item is removed using the Context Menu.",version:1}),"Visual Editing Context Menu Item Duplicated":iY({name:"Visual Editing Context Menu Item Duplicated",description:"An item is duplicated using the Context Menu.",version:1}),"Visual Editing Context Menu Item Moved":iY({name:"Visual Editing Context Menu Item Moved",description:"An item is moved using the Context Menu.",version:1}),"Visual Editing Context Menu Item Inserted":iY({name:"Visual Editing Context Menu Item Inserted",description:"An item is inserted using the Context Menu.",version:1}),"Visual Editing Insert Menu Item Inserted":iY({name:"Visual Editing Insert Menu Item Inserted",description:"An item is inserted using the Insert Menu.",version:1}),"Visual Editing Overlay Clicked":iY({name:"Visual Editing Overlay Clicked",description:"An Overlay is clicked.",version:1})},iB=(0,h.createContext)(void 0);function iG(){let e=(0,h.useContext)(iB);if(!e)throw Error("Telemetry context is missing");return e}let iJ={"insert-menu.filter.all-items":"All","insert-menu.search.no-results":"No results","insert-menu.search.placeholder":"Filter types…","insert-menu.toggle-grid-view.tooltip":"Toggle grid view","insert-menu.toggle-list-view.tooltip":"Toggle list view"},iH=e=>{let t,n,r,i,o=(0,m.c)(11),{node:s,onSelect:a}=e;o[0]!==s.options?.insertMenu?(t=s.options?.insertMenu||{},o[0]=s.options?.insertMenu,o[1]=t):t=o[1];let l=t;o[2]!==l.views?(n=l.views?.map(iZ),o[2]=l.views,o[3]=n):n=o[3];let u=n;
35return o[4]!==s.of?(r=s.of.map(iX),o[4]=s.of,o[5]=r):r=o[5],o[6]!==l||o[7]!==a||o[8]!==r||o[9]!==u?(i=(0,f.jsx)(iT,{...l,labels:iJ,schemaTypes:r,onSelect:a,views:u}),o[6]=l,o[7]=a,o[8]=r,o[9]=u,o[10]=i):i=o[10],i};function iZ(e){return"grid"===e.name?{...e,previewImageUrl:t=>e.previewImageUrls?.[t]}:e}function iX(e){return{...e,icon:iz(e)}}let iK=e=>{let t,n,r,i,o,s=(0,m.c)(10);return s[0]!==e?({children:t,style:r,...n}=e,s[0]=e,s[1]=t,s[2]=n,s[3]=r):(t=s[1],n=s[2],r=s[3]),s[4]!==r?(i={...r,pointerEvents:"all"},s[4]=r,s[5]=i):i=s[5],s[6]!==t||s[7]!==n||s[8]!==i?(o=(0,f.jsx)("div",{style:i,"data-sanity-overlay-element":!0,...n,children:t}),s[6]=t,s[7]=n,s[8]=i,s[9]=o):o=s[9],o};var iQ=n(69683),i0=n(71119),i1=n(10648),i2=n(93306),i3=n(40589),i4=n(39222);let i5=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},i6=function(e){if(!i5(e))return!1;var t=rR(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var i8=rE["__core-js_shared__"],i9=function(){var e=/[^.]+$/.exec(i8&&i8.keys&&i8.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),i7=Function.prototype.toString;let oe=function(e){if(null!=e){try{return i7.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var ot=/^\[object .+?Constructor\]$/,on=Object.prototype,or=Function.prototype.toString,oi=on.hasOwnProperty,oo=RegExp("^"+or.call(oi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let os=function(e){return!!i5(e)&&(!i9||!(i9 in e))&&(i6(e)?oo:ot).test(oe(e))},oa=function(e,t){var n=null==e?void 0:e[t];return os(n)?n:void 0};var ol=function(){try{var e=oa(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let ou=function(e,t,n){"__proto__"==t&&ol?ol(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},oc=function(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r},od=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e},op=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},of=function(e){return rP(e)&&"[object Arguments]"==rR(e)};var oh=Object.prototype,oy=oh.hasOwnProperty,om=oh.propertyIsEnumerable,og=of(function(){return arguments}())?of:function(e){return rP(e)&&oy.call(e,"callee")&&!om.call(e,"callee")},ov="object"==typeof exports&&exports&&!exports.nodeType&&exports,ob=ov&&"object"==typeof module&&module&&!module.nodeType&&module,ox=ob&&ob.exports===ov?rE.Buffer:void 0;let ow=(ox?ox.isBuffer:void 0)||function(){return!1};var o_=/^(?:0|[1-9]\d*)$/;let oE=function(e,t){var n=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==n||"symbol"!=n&&o_.test(e))&&e>-1&&e%1==0&&e<t},oj=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff};var ok={};ok["[object Float32Array]"]=ok["[object Float64Array]"]=ok["[object Int8Array]"]=ok["[object Int16Array]"]=ok["[object Int32Array]"]=ok["[object Uint8Array]"]=ok["[object Uint8ClampedArray]"]=ok["[object Uint16Array]"]=ok["[object Uint32Array]"]=!0,ok["[object Arguments]"]=ok["[object Array]"]=ok["[object ArrayBuffer]"]=ok["[object Boolean]"]=ok["[object DataView]"]=ok["[object Date]"]=ok["[object Error]"]=ok["[object Function]"]=ok["[object Map]"]=ok["[object Number]"]=ok["[object Object]"]=ok["[object RegExp]"]=ok["[object Set]"]=ok["[object String]"]=ok["[object WeakMap]"]=!1;var oS="object"==typeof exports&&exports&&!exports.nodeType&&exports,oI=oS&&"object"==typeof module&&module&&!module.nodeType&&module,oT=oI&&oI.exports===oS&&rw.process,oM=function(){try{var e=oI&&oI.require&&oI.require("util").types;if(e)return e;return oT&&oT.binding&&oT.binding("util")}catch(e){}}(),o$=oM&&oM.isTypedArray,oA=o$?function(e){return o$(e)}:function(e){return rP(e)&&oj(e.length)&&!!ok[rR(e)]},oC=Object.prototype.hasOwnProperty;let oO=function(e,t){var n=rS(e),r=!n&&og(e),i=!n&&!r&&ow(e),o=!n&&!r&&!i&&oA(e),s=n||r||i||o,a=s?op(e.length,String):[],l=a.length;for(var u in e)(t||oC.call(e,u))&&!(s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||oE(u,l)))&&a.push(u);return a};var oR=Object.prototype;let oP=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||oR)};var oN=(d=Object.keys,p=Object,function(e){return d(p(e))}),oz=Object.prototype.hasOwnProperty;let oL=function(e){if(!oP(e))return oN(e);var t=[];for(var n in Object(e))oz.call(e,n)&&"constructor"!=n&&t.push(n);return t},oD=function(e){return null!=e&&oj(e.length)&&!i6(e)},oU=function(e){return oD(e)?oO(e):oL(e)};var oq=(s=function(e,t){return e&&od(e,t,oU)},function(e,t){if(null==e)return e;if(!oD(e))return s(e,t);for(var n=e.length,r=-1,i=Object(e);++r<n&&!1!==t(i[r],r,i););return e});let oV=function(e,t,n,r){return oq(e,function(e,i,o){t(r,e,n(e),o)}),r},oF=function(e,t){return e===t||e!=e&&t!=t},oY=function(e,t){for(var n=e.length;n--;)if(oF(e[n][0],t))return n;return -1};var oW=Array.prototype.splice;function oB(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}oB.prototype.clear=function(){this.__data__=[],this.size=0},oB.prototype.delete=function(e){var t=this.__data__,n=oY(t,e);return!(n<0)&&(n==t.length-1?t.pop():oW.call(t,n,1),--this.size,!0)},oB.prototype.get=function(e){var t=this.__data__,n=oY(t,e);return n<0?void 0:t[n][1]},oB.prototype.has=function(e){return oY(this.__data__,e)>-1},oB.prototype.set=function(e,t){var n=this.__data__,r=oY(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var oG=oa(rE,"Map"),oJ=oa(Object,"create"),oH=Object.prototype.hasOwnProperty,oZ=Object.prototype.hasOwnProperty;function oX(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}oX.prototype.clear=function(){this.__data__=oJ?oJ(null):{},this.size=0},oX.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},oX.prototype.get=function(e){var t=this.__data__;if(oJ){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return oH.call(t,e)?t[e]:void 0},oX.prototype.has=function(e){var t=this.__data__;return oJ?void 0!==t[e]:oZ.call(t,e)},oX.prototype.set=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=oJ&&void 0===t?"__lodash_hash_undefined__":t,this};let oK=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},oQ=function(e,t){var n=e.__data__;return oK(t)?n["string"==typeof t?"string":"hash"]:n.map};function o0(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function o1(e){var t=this.__data__=new oB(e);this.size=t.size}function o2(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new o0;++t<n;)this.add(e[t])}o0.prototype.clear=function(){this.size=0,this.__data__={hash:new oX,map:new(oG||oB),string:new oX}},o0.prototype.delete=function(e){var t=oQ(this,e).delete(e);return this.size-=!!t,t},o0.prototype.get=function(e){return oQ(this,e).get(e)},o0.prototype.has=function(e){return oQ(this,e).has(e)},o0.prototype.set=function(e,t){var n=oQ(this,e),r=n.size;return n.set(e,t),this.size+=+(n.size!=r),this},o1.prototype.clear=function(){this.__data__=new oB,this.size=0},o1.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},o1.prototype.get=function(e){return this.__data__.get(e)},o1.prototype.has=function(e){return this.__data__.has(e)},o1.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oB){var r=n.__data__;if(!oG||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new o0(r)}return n.set(e,t),this.size=n.size,this},o2.prototype.add=o2.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},o2.prototype.has=function(e){return this.__data__.has(e)};let o3=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},o4=function(e,t,n,r,i,o){var s=1&n,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,p=!0,f=2&n?new o2:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var h=e[d],y=t[d];if(r)var m=s?r(y,h,d,t,e,o):r(h,y,d,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(f){if(!o3(t,function(e,t){if(!f.has(t)&&(h===e||i(h,e,n,r,o)))return f.push(t)})){p=!1;break}}else if(!(h===y||i(h,y,n,r,o))){p=!1;break}}return o.delete(e),o.delete(t),p};var o5=rE.Uint8Array;let o6=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},o8=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n};var o9=rj?rj.prototype:void 0,o7=o9?o9.valueOf:void 0;let se=function(e,t,n,r,i,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!o(new o5(e),new o5(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return oF(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=o6;case"[object Set]":var l=1&r;if(a||(a=o8),e.size!=t.size&&!l)break;var u=s.get(e);if(u)return u==t;r|=2,s.set(e,t);var c=o4(a(e),a(t),r,i,o,s);return s.delete(e),c;case"[object Symbol]":if(o7)return o7.call(e)==o7.call(t)}return!1},st=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},sn=function(e,t,n){var r=t(e);return rS(e)?r:st(r,n(e))},sr=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o};var si=Object.prototype.propertyIsEnumerable,so=Object.getOwnPropertySymbols,ss=so?function(e){return null==e?[]:sr(so(e=Object(e)),function(t){return si.call(e,t)})}:function(){return[]};let sa=function(e){return sn(e,oU,ss)};var sl=Object.prototype.hasOwnProperty;let su=function(e,t,n,r,i,o){var s=1&n,a=sa(e),l=a.length;if(l!=sa(t).length&&!s)return!1;for(var u=l;u--;){var c=a[u];if(!(s?c in t:sl.call(t,c)))return!1}var d=o.get(e),p=o.get(t);if(d&&p)return d==t&&p==e;var f=!0;o.set(e,t),o.set(t,e);for(var h=s;++u<l;){var y=e[c=a[u]],m=t[c];if(r)var g=s?r(m,y,c,t,e,o):r(y,m,c,e,t,o);if(!(void 0===g?y===m||i(y,m,n,r,o):g)){f=!1;break}h||(h="constructor"==c)}if(f&&!h){var v=e.constructor,b=t.constructor;v!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(f=!1)}return o.delete(e),o.delete(t),f};var sc=oa(rE,"DataView"),sd=oa(rE,"Promise"),sp=oa(rE,"Set"),sf=oa(rE,"WeakMap"),sh="[object Map]",sy="[object Promise]",
35sm="[object Set]",sg="[object WeakMap]",sv="[object DataView]",sb=oe(sc),sx=oe(oG),sw=oe(sd),s_=oe(sp),sE=oe(sf),sj=rR;(sc&&sj(new sc(new ArrayBuffer(1)))!=sv||oG&&sj(new oG)!=sh||sd&&sj(sd.resolve())!=sy||sp&&sj(new sp)!=sm||sf&&sj(new sf)!=sg)&&(sj=function(e){var t=rR(e),n="[object Object]"==t?e.constructor:void 0,r=n?oe(n):"";if(r)switch(r){case sb:return sv;case sx:return sh;case sw:return sy;case s_:return sm;case sE:return sg}return t});let sk=sj;var sS="[object Arguments]",sI="[object Array]",sT="[object Object]",sM=Object.prototype.hasOwnProperty;let s$=function(e,t,n,r,i,o){var s=rS(e),a=rS(t),l=s?sI:sk(e),u=a?sI:sk(t);l=l==sS?sT:l,u=u==sS?sT:u;var c=l==sT,d=u==sT,p=l==u;if(p&&ow(e)){if(!ow(t))return!1;s=!0,c=!1}if(p&&!c)return o||(o=new o1),s||oA(e)?o4(e,t,n,r,i,o):se(e,t,l,n,r,i,o);if(!(1&n)){var f=c&&sM.call(e,"__wrapped__"),h=d&&sM.call(t,"__wrapped__");if(f||h){var y=f?e.value():e,m=h?t.value():t;return o||(o=new o1),i(y,m,n,r,o)}}return!!p&&(o||(o=new o1),su(e,t,n,r,i,o))},sA=function e(t,n,r,i,o){return t===n||(null!=t&&null!=n&&(rP(t)||rP(n))?s$(t,n,r,i,e,o):t!=t&&n!=n)},sC=function(e,t,n,r){var i=n.length,o=i,s=!r;if(null==e)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){var l=(a=n[i])[0],u=e[l],c=a[1];if(s&&a[2]){if(void 0===u&&!(l in e))return!1}else{var d=new o1;if(r)var p=r(u,c,l,e,t,d);if(!(void 0===p?sA(c,u,3,r,d):p))return!1}}return!0},sO=function(e){return e==e&&!i5(e)},sR=function(e){for(var t=oU(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,sO(i)]}return t},sP=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},sN=function(e){var t=sR(e);return 1==t.length&&t[0][2]?sP(t[0][0],t[0][1]):function(n){return n===e||sC(n,e,t)}};var sz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sL=/^\w*$/;let sD=function(e,t){if(rS(e))return!1;var n=typeof e;return!!("number"==n||"symbol"==n||"boolean"==n||null==e||rN(e))||sL.test(e)||!sz.test(e)||null!=t&&e in Object(t)};function sU(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(sU.Cache||o0),n}sU.Cache=o0;var sq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sV=/\\(\\)?/g,sF=function(e){var t=sU(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(sq,function(e,n,r,i){t.push(r?i.replace(sV,"$1"):n||e)}),t});let sY=function(e,t){return rS(e)?e:sD(e,t)?[e]:sF(rq(e))};var sW=1/0;let sB=function(e){if("string"==typeof e||rN(e))return e;var t=e+"";return"0"==t&&1/e==-sW?"-0":t},sG=function(e,t){t=sY(t,e);for(var n=0,r=t.length;null!=e&&n<r;)e=e[sB(t[n++])];return n&&n==r?e:void 0},sJ=function(e,t,n){var r=null==e?void 0:sG(e,t);return void 0===r?n:r},sH=function(e,t){return null!=e&&t in Object(e)},sZ=function(e,t,n){t=sY(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=sB(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&oj(i)&&oE(s,i)&&(rS(e)||og(e))},sX=function(e){return e},sK=function(e){var t;return sD(e)?(t=sB(e),function(e){return null==e?void 0:e[t]}):function(t){return sG(t,e)}},sQ=function(e){if("function"==typeof e)return e;if(null==e)return sX;if("object"==typeof e){var t,n;return rS(e)?(t=e[0],n=e[1],sD(t)&&sO(n)?sP(sB(t),n):function(e){var r=sJ(e,t);return void 0===r&&r===n?null!=e&&sZ(e,t,sH):sA(n,r,3)}):sN(e)}return sK(e)};var s0=Object.prototype.hasOwnProperty,s1=(l=function(e,t,n){s0.call(e,n)?e[n].push(t):ou(e,n,[t])},function(e,t){return(rS(e)?oc:oV)(e,l,sQ(t,2),{})}),s2=n(16258),s3=n(5624),s4=n(46323),s5=n(46578),s6=n(16631);function s8(e){if("patch"===e.type)return e.id;if("create"===e.type)return e.document._id;if("delete"===e.type)return e.id;if("createIfNotExists"===e.type||"createOrReplace"===e.type)return e.document._id;throw Error("Invalid mutation type")}let s9=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t};function s7(e){return"string"==typeof e?._key}function ae(e){return"object"==typeof e&&"_key"in e&&"string"==typeof e._key}function at(e){return"number"==typeof e||ae(e)}function an(e,t){if(0===e.length)return t;let n=t;for(let t of e){if(at(t)){if(!Array.isArray(n))return;if(ae(t)){n=n.find(e=>e._key===t._key);continue}n=n[t];continue}n=n[t]}return n}let ar=/^[a-z_$]+/;function ai(e){return e.map((e,t)=>{var n;return n=0===t,Array.isArray(e)?`[${e[0]}:${e[1]||""}]`:"number"==typeof e?`[${e}
35]`:ae(e)?`[_key==${JSON.stringify(e._key)}]`:"string"==typeof e&&ar.test(e)?n?e:`.${e}`:`['${e}']`}).join("")}function ao(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function as(e,t){if("number"==typeof t){var n=e.length,r=t;if(0===n&&(-1===r||0===r))return 0;let i=r<0?n+r:r;return i>=n||i<0?null:i}if(ae(t)){let n=e.findIndex(e=>(null!==e&&"object"==typeof e&&"string"==typeof e._key&&e._key||null)===t._key);return -1===n?null:n}throw Error(`Expected path segment to be addressing a single array item either by numeric index or by '_key'. Instead saw ${JSON.stringify(t)}`)}function aa(e,t,n,r){let i=e.slice();return i.splice(t,n,...r||[]),i}function al(e,t){var n;if(!Array.isArray(t))throw TypeError('Cannot apply "insert()" on non-array value');let r=as(t,e.referenceItem);if(null===r)throw Error(`Found no matching array element to insert ${e.position}`);return 0===t.length?e.items:aa(t,(n=e.position,"before"===n?r:r+1),0,e.items)}let au=Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);var ac=Object.freeze({__proto__:null,assign:function(e,t){if(!ao(t))throw TypeError('Cannot apply "assign()" on non-object value');return!function(e){for(let t in e)if(au(e,t))return!1;return!0}(e.value)?{...t,...e.value}:t},dec:function(e,t){if("number"!=typeof t)throw TypeError('Cannot apply "dec()" on non-numeric value');return t-e.amount},diffMatchPatch:function(e,t){if("string"!=typeof t)throw TypeError('Cannot apply "diffMatchPatch()" on non-string value');return(0,i4.$i)((0,i4.iz)(e.value),t)[0]},inc:function(e,t){if("number"!=typeof t)throw TypeError('Cannot apply "inc()" on non-numeric value');return t+e.amount},insert:al,remove:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "remove()" on non-array value');let n=as(t,e.referenceItem);if(null===n)throw Error("Found no matching array element to replace");return aa(t,n,1,[])},replace:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "replace()" on non-array value');let n=as(t,e.referenceItem);if(null===n)throw Error("Found no matching array element to replace");return aa(t,n,e.items.length,e.items)},set:function(e,t){return e.value},setIfMissing:function(e,t){return t??e.value},truncate:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "truncate()" on non-array value');return"number"==typeof e.endIndex?t.slice(0,e.startIndex).concat(t.slice(e.endIndex)):t.slice(0,e.startIndex)},unassign:function(e,t){if(!ao(t))throw TypeError('Cannot apply "unassign()" on non-object value');return 0===e.keys.length?t:function(e,t){let n={...e};for(let e of t)delete n[e];return n}(t,e.keys)},unset:function(e){},upsert:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "upsert()" on non-array value');
35if(0===e.items.length)return t;let n=[],r=[];if(e.items.forEach((e,i)=>{let o=t.findIndex(t=>t?._key===e._key);o>=0?n[o]=i:r.push(e)}),0===n.length&&0==r.length)return t;let i=[...t];for(let t of n)i[t]=e.items[n[t]];return al({type:"insert",items:r,referenceItem:e.referenceItem,position:e.position},i)}});function ad(e,t){return e.reduce((e,t)=>ap(t,e),t)}function ap(e,t){return function e(t,n,r){if(!(t.length>0)){if(!(n.type in ac))throw Error(`Invalid operation type: "${n.type}"`);return ac[n.type](n,r)}let[i,...o]=t;if(at(i)&&Array.isArray(r)){var s=i,a=o,l=n,u=r;let t=as(u,s);if(null===t||-1===t)return u;let c=u[t],d=e(a,l,c);return d===c?u:aa(u,t,1,[d])}if("string"==typeof i&&ao(r)){var c=i,d=o,p=n,f=r;let t=f[c];if(void 0===t&&d.length>0)return f;let s=e(d,p,t);return s===t?f:{...f,[c]:s}}throw Error(`Cannot apply operation of type "${n.type}" to path ${ai(t)} on ${typeof r} value`)}(e.path,e.op,t)}function af(e){return"_id"in e}function ah(e,t){return t.reduce((e,t)=>{let n=ay(e,t);if("error"===n.status)throw Error(n.message);return"noop"===n.status?e:n.after},e)}function ay(e,t){if("create"===t.type)return function(e,t){var n;if(e)return{status:"error",message:"Document already exist"};let r=(n=t.document,af(n)?n:{...n,_id:s9()});return{status:"created",id:r._id,after:r}}(e,t);if("createIfNotExists"===t.type){return n=e,af((r=t).document)?n?{status:"noop"}:{status:"created",id:r.document._id,after:r.document}:{status:"error",message:"Cannot createIfNotExists on document without _id"}}if("delete"===t.type){return i=e,o=t,i?o.id!==i._id?{status:"error",message:"Delete mutation targeted wrong document"}:{status:"deleted",id:o.id,before:i,after:void 0}:{status:"noop"}}if("createOrReplace"===t.type){return s=e,af((a=t).document)?s?{status:"updated",id:a.document._id,before:s,after:a.document}:{status:"created",id:a.document._id,after:a.document}:{status:"error",message:"Cannot createIfNotExists on document without _id"}}if("patch"===t.type){var n,r,i,o,s,a,l=e,u=t;if(!l)return{status:"error",message:"Cannot apply patch on nonexistent document"};let c=function(e,t){if(e.options?.ifRevision&&t._rev!==e.options.ifRevision)throw Error("Revision mismatch");if(e.id!==t._id)throw Error(`Document id mismatch. Refusing to apply mutation for document with id="${e.id}" on the given document with id="${t._id}"`);return ad(e.patches,t)}(u,l);return l===c?{status:"noop"}:{status:"updated",id:u.id,before:l,after:c}}throw Error(`Invalid mutation type: ${t.type}`)}function am(e,t,n){let r=[];for(let n of e.slice().reverse()){if(t(n))return r;r.push(n)}return r.reverse()}function ag(e,t){return ai(e)===ai(t)}function av(e,t){let n=e;return t.reduce((e,t)=>{let r=n;if(n=ap(t,n),"set"===t.op.type&&"string"==typeof t.op.value){let n=an(t.path,r);if("string"==typeof n){let r={...t,op:{type:"diffMatchPatch",value:(0,i4.w1)((0,i4.jW)(n,t.op.value))}};return e.flatMap(e=>ag(e.path,t.path)&&"diffMatchPatch"===e.op.type?[]:e).concat(r)}}return e.push(t),e},[])}function ab(e,t,n,r){let i=t,o=r.map(t=>{let n=t.mutations.flatMap(t=>{if(s8(t)!==e)return[];let n=i;return i=ah(i,[t]),n&&"patch"===t.type?{type:"dmpified",mutation:{...t,dmpPatches:av(n,t.patches),original:t.patches}}:t});return{...t,mutations:n}}),s=n;return o.map(t=>{let n=[];return t.mutations.forEach(t=>{if("dmpified"===t.type)try{s=ad(t.mutation.dmpPatches,s),n.push(t)}catch{console.warn("Failed to apply dmp patch, falling back to original");try{s=ad(t.mutation.original,s),n.push(t)}catch(t){throw Error(`Failed to apply patch for document "${e}": ${t.message}`)}}else s=ah(s,[t])})}),[r.map(t=>({...t,mutations:t.mutations.map(t=>"patch"!==t.type||s8(t)!==e?t:{...t,patches:t.patches.map(e=>"set"!==e.op.type?e:{...e,op:{...e.op,value:an(e.path,s)}})})})),s]}function ax(e){var t=e;if("create"===t.type||"createIfNotExists"===t.type||"createOrReplace"===t.type)return{[t.type]:t.document};
35if("delete"===t.type)return{delete:{id:t.id}};let n=t.options?.ifRevision;return t.patches.map(e=>({patch:{id:t.id,...n&&{ifRevisionID:n},...function(e){let{path:t,op:n}=e;if("unset"===n.type)return{unset:[ai(t)]};if("insert"===n.type)return{insert:{[n.position]:ai([...t,n.referenceItem]),items:n.items}};if("diffMatchPatch"===n.type)return{diffMatchPatch:{[ai(t)]:n.value}};if("inc"===n.type)return{inc:{[ai(t)]:n.amount}};if("dec"===n.type)return{dec:{[ai(t)]:n.amount}};if("set"===n.type||"setIfMissing"===n.type)return{[n.type]:{[ai(t)]:n.value}};if("truncate"===n.type){let e=[n.startIndex,"number"==typeof n.endIndex?n.endIndex:""].join(":");return{unset:[`${ai(t)}[${e}]`]}}if("upsert"===n.type)return{unset:n.items.map(e=>ai([...t,{_key:e._key}])),insert:{[n.position]:ai([...t,n.referenceItem]),items:n.items}};if("assign"===n.type)return{set:Object.fromEntries(Object.keys(n.value).map(e=>[ai(t.concat(e)),n.value[e]]))};if("unassign"===n.type)return{unset:n.keys.map(e=>ai(t.concat(e)))};if("replace"===n.type)return{insert:{replace:ai(t.concat(n.referenceItem)),items:n.items}};if("remove"===n.type)return{unset:[ai(t.concat(n.referenceItem))]};throw Error(`Unknown operation type ${n.type}`)}(e)}}))}function aw(e){let t=e.listen('*[!(_id in path("_.**"))]',{},{events:["welcome","mutation","reconnect"],includeResult:!1,includePreviousRevision:!1,visibility:"transaction",effectFormat:"mendoza",includeMutations:!1}).pipe((0,s3.u)({resetOnRefCountZero:!0})),n=t.pipe((0,ty.p)(e=>"reconnect"===e.type)),r=t.pipe((0,ty.p)(e=>"welcome"===e.type)),i=t.pipe((0,ty.p)(e=>"mutation"===e.type)),o=(0,i3.h)(r,n).pipe((0,s4.t)({bufferSize:1,refCount:!0})).pipe((0,ty.p)(e=>"welcome"===e.type));return(0,i3.h)(o,i,n)}let a_=tc({types:{},actions:{"assign error to context":eK({error:({event:e})=>e}),"clear error from context":eK({error:void 0}),"connect to server-sent events":eV({type:"connect"}),"listen to server-sent events":ee("server-sent events",{id:"listener",input:({context:e})=>({listener:e.sharedListener||aw(e.client),id:e.id})}),"stop listening to server-sent events":er("listener"),"buffer remote mutation events":eK({mutationEvents:({event:e,context:t})=>(tu(e,"mutation"),[...t.mutationEvents,e])}),"restore stashed changes":eK({stagedChanges:({event:e,context:t})=>(tu(e,"xstate.done.actor.submitTransactions"),t.stashedChanges),stashedChanges:[]}),"rebase fetched remote snapshot":to(({enqueue:e})=>{e.assign(({event:e,context:t})=>{tu(e,"xstate.done.actor.getDocument");let n=t.remote,r=e.output,i=!1;for(let e of t.mutationEvents)e.effects?.apply&&(e.previousRev||"appear"===e.transition)&&(i||e.previousRev!==r?._rev||(i=!0),i&&(r=aE(r,e.effects.apply,e.resultRev)));t.cache&&(!t.cache.has(t.id)||t.cache.get(t.id)._rev!==r?._rev)&&t.cache.set(t.id,r);let[o,s]=ab(t.id,null===n?void 0:n,null===r?void 0:r,t.stagedChanges);return{remote:r,local:s,stagedChanges:o,mutationEvents:[]}}),e.sendParent(({context:e})=>({type:"rebased.remote",id:e.id,document:e.remote}))}),"apply mendoza patch":eK(({event:e,context:t})=>{tu(e,"mutation");let n=t.remote;if(e.transactionId===n?._rev)return{};let r=aE(n,e.effects.apply,e.resultRev);t.cache&&(!t.cache.has(t.id)||t.cache.get(t.id)._rev!==r?._rev)&&t.cache.set(t.id,r);let[i,o]=ab(t.id,null===n?void 0:n,null===r?void 0:r,t.stagedChanges);return{remote:r,local:o,stagedChanges:i}}),"increment fetch attempts":eK({fetchRemoteSnapshotAttempts:({context:e})=>e.fetchRemoteSnapshotAttempts+1}),"reset fetch attempts":eK({fetchRemoteSnapshotAttempts:0}),"increment submit attempts":eK({submitTransactionsAttempts:({context:e})=>e.submitTransactionsAttempts+1}),"reset submit attempts":eK({submitTransactionsAttempts:0}),"stage mutation":eK({stagedChanges:({event:e,context:t})=>(tu(e,"mutate"),[...t.stagedChanges,{transaction:!1,mutations:e.mutations}])}),"stash mutation":eK({stashedChanges:({event:e,context:t})=>(tu(e,"mutate"),[...t.stashedChanges,{transaction:!1,mutations:e.mutations}])}),"rebase local snapshot":to(({enqueue:e})=>{e.assign({local:({event:e,context:t})=>{tu(e,"mutate");let n=new Map;
35return t.local&&n.set(t.id,t.local),function(e,t){e.forEach(e=>{("created"===e.status||"updated"===e.status)&&t.set(e.id,e.after),"deleted"===e.status&&t.delete(e.id)})}(function(e,t){let n=Object.create(null);for(let r of e){let e=s8(r);if(!e)throw Error("Unable to get document id from mutation");let i=n[e]?.after||t.get(e),o=ay(i,r);if("error"===o.status)throw Error(o.message);"noop"!==o.status&&("updated"===o.status||"created"===o.status||"deleted"===o.status)&&(e in n||(n[e]={before:i,after:void 0,muts:[]}),n[e].after=o.after)}return Object.entries(n).map(([e,{before:t,after:n,muts:r}])=>({id:e,status:n?t?"updated":"created":"deleted",mutations:r,before:t,after:n}))}(e.mutations,n),n),n.get(t.id)}}),e.sendParent(({context:e})=>({type:"rebased.local",id:e.id,document:e.local}))}),"send pristine event to parent":tr(({context:e})=>({type:"pristine",id:e.id})),"send sync event to parent":tr(({context:e})=>({type:"sync",id:e.id,document:e.remote})),"send mutation event to parent":tr(({context:e,event:t})=>(tu(t,"mutation"),{type:"mutation",id:e.id,previousRev:t.previousRev,resultRev:t.resultRev,effects:t.effects}))},actors:{"server-sent events":eW(({input:e})=>{let{listener:t,id:n}=e;return(0,td.v)(()=>t).pipe((0,ty.p)(e=>"welcome"===e.type||"reconnect"===e.type||"mutation"===e.type&&e.documentId===n),(0,s5.Q)(s6.$))}),"fetch remote snapshot":eH(async({input:e,signal:t})=>{let{client:n,id:r}=e;return await n.getDocument(r,{signal:t}).catch(e=>{if(!(e instanceof Error&&"AbortError"===e.name))throw e})}),"submit mutations as transactions":eH(async({input:e,signal:t})=>{let{client:n,transactions:r}=e;for(let e of r){if(t.aborted)return;await n.dataRequest("mutate",function(e){return{transactionId:e.id,mutations:e.mutations.flatMap(ax)}}(e),{visibility:"async",returnDocuments:!1,signal:t}).catch(e=>{if(!(e instanceof Error&&"AbortError"===e.name))throw e})}})},delays:{fetchRemoteSnapshotTimeout:({context:e})=>1e3*Math.pow(2,e.fetchRemoteSnapshotAttempts),submitTransactionsTimeout:({context:e})=>1e3*Math.pow(2,e.submitTransactionsAttempts)}}).createMachine({id:"document-mutator",context:({input:e})=>({client:e.client.withConfig({allowReconfigure:!1}),sharedListener:e.sharedListener,id:e.id,remote:void 0,local:void 0,mutationEvents:[],stagedChanges:[],stashedChanges:[],error:void 0,fetchRemoteSnapshotAttempts:0,submitTransactionsAttempts:0,cache:e.cache}),entry:["connect to server-sent events"],on:{mutate:{actions:["rebase local snapshot","stage mutation"]}},initial:"disconnected",states:{disconnected:{on:{connect:{target:"connecting",actions:["listen to server-sent events"]}}},connecting:{on:{welcome:"connected",reconnect:"reconnecting",error:"connectFailure"},tags:["busy"]},connectFailure:{on:{connect:{target:"connecting",actions:["listen to server-sent events"]}},entry:["stop listening to server-sent events","assign error to context"],exit:["clear error from context"],tags:["error"]},reconnecting:{on:{welcome:{target:"connected"},error:{target:"connectFailure"}},tags:["busy","error"]},connected:{on:{mutation:{actions:["buffer remote mutation events"]},reconnect:"reconnecting"},entry:["clear error from context"],initial:"loading",states:{loading:{invoke:{src:"fetch remote snapshot",id:"getDocument",input:({context:e})=>({client:e.client,id:e.id}),onError:{target:"loadFailure"},onDone:{target:"loaded",actions:["rebase fetched remote snapshot","reset fetch attempts"]}},tags:["busy"]},loaded:{entry:["send sync event to parent"],on:{mutation:{actions:["apply mendoza patch","send mutation event to parent"]}},initial:"pristine",states:{pristine:{on:{mutate:{actions:["rebase local snapshot","stage mutation"],target:"dirty"}},tags:["ready"]},dirty:{on:{submit:"submitting"},tags:["ready"]},submitting:{on:{mutate:{actions:["rebase local snapshot","stash mutation"]}},invoke:{src:"submit mutations as transactions",id:"submitTransactions",input:({context:e})=>{let t=new Map;return t.set(e.id,e.remote),{client:e.client,transactions:(function(e,t){let n=[],r=[];return e.forEach(e=>{t(e)?r.push(e):(r.length>0&&n.push(r),r=[],n.push([e]))}),r.length>0&&n.push(r),n})(e.stagedChanges,e=>!e.transaction).flatMap(e=>({...e[0],mutations:e.flatMap(e=>e.mutations)})).map(e=>({...e,mutations:Object.values(s1(e.mutations,s8)).flatMap(e=>{var t,n;return(0===(n=0===(t=e).length?t:t.reduce((e,t)=>
35"delete"===t.type?[t]:(e.push(t),e),[])).length?n:n.reduce((e,t)=>("createIfNotExists"!==t.type?e.push(t):am(e,e=>"delete"===e.type).find(e=>"createIfNotExists"===e.type)||e.push(t),e),[])).flat().reduce((e,t)=>{let n=e[e.length-1];return n&&"patch"!==n.type||"patch"!==t.type?e.concat(t):e.slice(0,-1).concat({...t,patches:(n?.patches||[]).concat(t.patches)})},[])})})).map(e=>({...e,mutations:e.mutations.map(e=>"patch"!==e.type?e:{...e,patches:e.patches.reduce((e,t)=>{if("unset"!==t.op.type)return e.push(t),e;let n=e.filter(e=>{var n,r;return n=t.path,r=e.path,!(n.length<=r.length&&n.every((e,t)=>{var n,i;return n=e,i=function(e,t){if(t<0||t>=e.length)throw Error("Index out of bounds");return e[t]}(r,t),s7(n)&&s7(i)?n._key===i._key:"number"==typeof n?Number(n)===Number(i):n===i}))});return n.push(t),n},[]).reduceRight((e,t)=>(e.find(e=>{var n,r;return n=e.op,("set"===(r=t.op).type||"unset"===r.type)&&("set"===n.type||"unset"===n.type)&&ag(e.path,t.path)})||e.unshift(t),e),[]).reduce((e,t)=>("setIfMissing"!==t.op.type?e.push(t):am(e,e=>"unset"===e.op.type).find(e=>"setIfMissing"===e.op.type&&ag(e.path,t.path))||e.push(t),e),[])})})).map(e=>{var n;return{...e,mutations:(n=t,e.mutations.map((e,t)=>{var r,i;return"patch"===e.type?(r=n.get(e.id),i=e,r?{...i,patches:av(r,i.patches)}:i):e}))}}).map(e=>e.transaction&&void 0!==e.id?{id:e.id,mutations:e.mutations}:{mutations:e.mutations})}},onError:{target:"submitFailure"},onDone:{target:"pristine",actions:["restore stashed changes","reset submit attempts","send pristine event to parent"]}},tags:["busy","ready"]},submitFailure:{exit:["clear error from context"],after:{submitTransactionsTimeout:{actions:["increment submit attempts"],target:"submitting"}},on:{retry:"submitting"},tags:["error","ready"]}}},loadFailure:{exit:["clear error from context"],after:{fetchRemoteSnapshotTimeout:{actions:["increment fetch attempts"],target:"loading"}},on:{retry:"loading"},tags:["error"]}}}}});function aE(e,t,n){let r=(0,s2.X)(function(e){if(!e)return null;let{_rev:t,...n}=e;return n}(e),t);return r?Object.assign(r,{_rev:n}):null}let aj=e=>{let t=eH(async({input:t,signal:n})=>{let{id:r}=t,{snapshot:i}=await e.fetch("visual-editing/fetch-snapshot",{documentId:r},{signal:n});return i}),n=eH(async({input:t})=>{let{transactions:n}=t;for(let t of n){let n=t9.encodeTransaction(t);return e.post("visual-editing/mutate",n)}});return a_.provide({actions:{"send sync event to parent":to(({enqueue:e})=>{e.sendParent(({context:e})=>({type:"sync",id:e.id,document:e.remote})),e.emit(({context:e})=>({type:"ready",snapshot:e.local}))})},actors:{"fetch remote snapshot":t,"submit mutations as transactions":n}})},ak=tc({types:{},actions:{"emit sync event":e8(({event:e})=>(tu(e,"sync"),e)),"emit mutation event":e8(({event:e})=>(tu(e,"mutation"),e)),"emit rebased event":e8(({event:e})=>(tu(e,["rebased.local","rebased.remote"]),e)),"emit pristine event":e8(({event:e})=>(tu(e,["pristine"]),e)),"add document actor":eK({documents:({context:e,event:t,spawn:n})=>{tu(t,"observe");let r=t.documentId;return e.documents[r]?e.documents:{...e.documents,[r]:n("documentMutatorMachine",{input
35:{id:r,client:e.client,sharedListener:e.sharedListener||aw(e.client)},id:r})}}}),"stop remote snapshot":er(({context:e,event:t})=>(tu(t,"unobserve"),e.documents[t.documentId])),"remove remote snapshot from context":eK({documents:({context:e,event:t})=>{if(tu(t,"unobserve"),!e.documents[t.documentId])return e.documents;let{[t.documentId]:n,...r}=e.documents;return r}})},actors:{documentMutatorMachine:a_}}).createMachine({id:"dataset-mutator",context:({input:e})=>({documents:{},client:e.client,sharedListener:e.sharedListener}),on:{sync:{actions:["emit sync event"]},mutation:{actions:["emit mutation event"]},"rebased.*":{actions:["emit rebased event"]},pristine:{actions:["emit pristine event"]},observe:{actions:["add document actor"]},unobserve:{actions:["stop remote snapshot","remove remote snapshot from context"]}},initial:"pristine",states:{pristine:{}}}),aS=e=>ak.provide({actors:{documentMutatorMachine:aj(e)}}),aI=e=>{let t,n,r,i,o=(0,m.c)(8),{comlink:s,history:a}=e;return o[0]!==s||o[1]!==a?(t=()=>s?.on("presentation/navigate",e=>{a?.update(e)}),n=[s,a],o[0]=s,o[1]=a,o[2]=t,o[3]=n):(t=o[2],n=o[3]),(0,h.useEffect)(t,n),o[4]!==s||o[5]!==a?(r=()=>{if(a)return a.subscribe(e=>{e.title=e.title||document.title,s?.post("visual-editing/navigate",e)})},i=[s,a],o[4]=s,o[5]=a,o[6]=r,o[7]=i):(r=o[6],i=o[7]),(0,h.useEffect)(r,i),null},aT=e=>{let t,n,r=(0,m.c)(3),{comlink:i}=e;return r[0]!==i?(t=()=>{let e=()=>{i.post("visual-editing/meta",{title:document.title})},t=new MutationObserver(t=>{let[n]=t;"TITLE"===n.target.nodeName&&e()});return t.observe(document.head,{subtree:!0,characterData:!0,childList:!0}),e(),()=>t.disconnect()},n=[i],r[0]=i,r[1]=t,r[2]=n):(t=r[1],n=r[2]),(0,h.useEffect)(t,n),null};function aM(e){let t=new CustomEvent("sanity/dragEnd",{detail:e,cancelable:!0});window.dispatchEvent(t)}let a$=(0,h.createContext)(null);function aA(){let e=(0,h.useContext)(a$);if(!e)throw Error("Schema context is missing");return e}function aC(e,t,n,r){if(!e.type)throw Error("Node type is missing");return()=>t.patch(()=>(function(e,t,n){let{path:r,key:i}=nj(e);return[nn(r,t7([{_type:t,_key:nE()}],n,{_key:i}))]})(e,n,r))}function aO(e){let{node:t,doc:n}=e;return n?[{type:"action",label:"Duplicate",icon:rv.TdU,action:function(e,t){if(!e.type)throw Error("Node type is missing");return()=>t.patch(async({getSnapshot:t})=>(function(e,t,n="after"){let{path:r,key:i}=nj(e);return[nn(r,t7({...np(t,e.path),_key:nE()},n,{_key:i}))]})(e,await t()))}(t,n),telemetryEvent:"Visual Editing Context Menu Item Duplicated"}]:[]}function aR(e){let{node:t,doc:n}=e;return n?[{type:"action",label:"Remove",icon:rv.YPx,action:function(e,t){if(!e.type)throw Error("Node type is missing");return()=>t.patch(async({getSnapshot:t})=>(function(e,t){let{path:n,key:r}=nj(e),i=np(t,n).findIndex(e=>e._key===r);return[nn(n,ne(i,i+1))]})(e,await t()))}(t,n),telemetryEvent:"Visual Editing Context Menu Item Removed"}]:[]}async function aP(e,t=!0){let{node:n,doc:r}=e;if(!r)return[];let i=[],o=[],[s,a,l,u]=await Promise.all([nk(n,r,"previous"),nk(n,r,"next"),nk(n,r,"first"),nk(n,r,"last")]);return l.length&&o.push({type:"action",label:"To top",icon:rv.VQ$,action:()=>r.patch(l),telemetryEvent:"Visual Editing Context Menu Item Moved"}),s.length&&o.push({type:"action",label:"Up",icon:rv.Kpk,action:()=>r.patch(s),telemetryEvent:"Visual Editing Context Menu Item Moved"}),a.length&&o.push({type:"action",label:"Down",icon:rv.ZLN,action:()=>r.patch(a),telemetryEvent:"Visual Editing Context Menu Item Moved"}),u.length&&o.push({type:"action",label:"To bottom",icon:rv.wvk,action:()=>r.patch(u),telemetryEvent:"Visual Editing Context Menu Item Moved"}),o.length&&(i.push({type:"group",label:"Move",icon:rv.ycB,items:o}),t&&i.push({type:"divider"})),i}async function aN(e){let{node:t,field:n,doc:r}=e,i=[];return i.push(...aO(e)),i.push(...aR(e)),i.push(...await aP(e)),i.push({type:"action",label:"Insert before",icon:rv.SKY,action:aC(t,r,n.name,"before"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}),i.push({type:"action",label:"Insert after",icon:rv.amD,action:aC(t,r,n.name,"after"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}),i}let az=e=>{let t,n,r,i,o,s=(0,m.c)(12),{label:a,parent:l,width:u,onSelect:c,boundaryElement:d}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=["left-start","right","left","right-end","left-end","bottom","top"],s[0]=t):t=s[0],s[1]===Symbol.for("react.memo_cache_sentinel")?(n=[4,4,4,4],s[1]=n):n=s[1],s[2]!==d||s[3]!==u?(r={arrow:!1,constrainSize:!0,floatingBoundary:d,padding:0,placement:"right-start",fallbackPlacements:t,preventOverflow:!0,width:u,__unstable_margins:n},s[2]=d,s[3]=u,s[4]=r):r=s[4],s[5]!==c||s[6]!==l?(i=(0,f.jsx)(iH,{node:l,onSelect:c}
35),s[5]=c,s[6]=l,s[7]=i):i=s[7],s[8]!==a||s[9]!==r||s[10]!==i?(o=(0,f.jsx)(tG.rX,{fontSize:1,icon:rv.amD,padding:2,popover:r,space:2,text:a,children:i}),s[8]=a,s[9]=r,s[10]=i,s[11]=o):o=s[11],o};async function aL(e){let{doc:t,node:n,parent:r}=e,i=[];if(i.push(...aO(e)),i.push(...aR(e)),i.push(...await aP(e)),r.options?.insertMenu){let e=(r.options.insertMenu||{}).views?.some(e=>"grid"===e.name)?0:void 0;i.push({type:"custom",component:({boundaryElement:i,sendTelemetry:o})=>(0,f.jsx)(az,{label:"Insert before",onSelect:e=>{aC(n,t,e.name,"before")(),o("Visual Editing Context Menu Item Inserted",null)},parent:r,width:e,boundaryElement:i})}),i.push({type:"custom",component:({boundaryElement:i,sendTelemetry:o})=>(0,f.jsx)(az,{label:"Insert after",onSelect:e=>{aC(n,t,e.name,"after")(),o("Visual Editing Context Menu Item Inserted",null)},parent:r,width:e,boundaryElement:i})})}else i.push({type:"group",label:"Insert before",icon:rv.SKY,items:r.of.filter(e=>"unionOption"===e.type).map(e=>({type:"action",icon:iz(e),label:"block"===e.name?"Paragraph":e.title||e.name,action:aC(n,t,e.name,"before"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}))}),i.push({type:"group",label:"Insert after",icon:rv.amD,items:r.of.filter(e=>"unionOption"===e.type).map(e=>({type:"action",label:"block"===e.name?"Paragraph":e.title||e.name,icon:iz(e),action:aC(n,t,e.name,"after"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}))});return i}let aD=[-4,4,-4,4];function aU(e){let t,n=(0,m.c)(27),{node:r,onDismiss:i,boundaryElement:o}=e,s=iG();n[0]!==r||n[1]!==i||n[2]!==s?(t=()=>{"action"===r.type&&(r.action?.(),i?.(),r.telemetryEvent&&s(r.telemetryEvent,null))},n[0]=r,n[1]=i,n[2]=s,n[3]=t):t=n[3];let a=t;if("divider"===r.type){let e;return n[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,f.jsx)(tG.Nj,{}),n[4]=e):e=n[4],e}if("action"===r.type){let e,t=!r.action;return n[5]!==r.hotkeys||n[6]!==r.icon||n[7]!==r.label||n[8]!==a||n[9]!==t?(e=(0,f.jsx)(tG.Dr,{fontSize:1,hotkeys:r.hotkeys,icon:r.icon,padding:2,space:2,text:r.label,disabled:t,onClick:a}),n[5]=r.hotkeys,n[6]=r.icon,n[7]=r.label,n[8]=a,n[9]=t,n[10]=e):e=n[10],e}if("group"===r.type){let e,t,s,a=r.icon;n[11]===Symbol.for("react.memo_cache_sentinel")?(e={arrow:!1,constrainSize:!0,placement:"right-start",fallbackPlacements:["left-start","right","left","right-end","left-end","bottom","top"],preventOverflow:!0,__unstable_margins:aD},n[11]=e):e=n[11];let l=r.label;if(n[12]!==o||n[13]!==r.items||n[14]!==i){let e;n[16]!==o||n[17]!==i?(e=(e,t)=>(0,f.jsx)(aU,{node:e,onDismiss:i,boundaryElement:o},t),n[16]=o,n[17]=i,n[18]=e):e=n[18],t=r.items.map(e),n[12]=o,n[13]=r.items,n[14]=i,n[15]=t}else t=n[15];return n[19]!==r.icon||n[20]!==r.label||n[21]!==t?(s=(0,f.jsx)(tG.rX,{fontSize:1,icon:a,padding:2,popover:e,space:2,text:l,children:t}),n[19]=r.icon,n[20]=r.label,n[21]=t,n[22]=s):s=n[22],s}if("custom"===r.type){let e,{component:t}=r;return n[23]!==t||n[24]!==o||n[25]!==s?(e=(0,f.jsx)(t,{boundaryElement:o,sendTelemetry:s}),n[23]=t,n[24]=o,n[25]=s,n[26]=e):e=n[26],e}return null}let aq=e=>{let t,n,r,i,o,s,a,l,u,c,d,p,y,g,v,b=(0,m.c)(43),{node:x,onDismiss:w,position:_}=e,{x:E,y:j}=_,[k,S]=(0,h.useState)(null),{getField:I}=aA(),{getDocument:T}=nw();b[0]!==I||b[1]!==x?(t=I(x),b[0]=I,b[1]=x,b[2]=t):t=b[2];let{field:M,parent:$}=t,A=M?.title||M?.name||"Unknown type",[C,O]=(0,h.useState)(void 0);b[3]!==M||b[4]!==T||b[5]!==x||b[6]!==$?(n=()=>{(async()=>{let e=T(x.id);e&&O(await function(e){let{node:t,field:n,parent:r,doc:i}=e;return n?.type==="arrayItem"?aN({node:t,field:n,doc:i}):r?.type==="union"?aL({node:t,parent:r,doc:i}):Promise.resolve([])}({node:x,field:M,parent:$,doc:e}))})()},r=[M,x,$,T],b[3]=M,b[4]=T,b[5]=x,b[6]=$,b[7]=n,b[8]=r):(n=b[7],r=b[8]),(0,h.useEffect)(n,r),b[9]!==E||b[10]!==j?(i={getBoundingClientRect:()=>({bottom:j,left:E,right:E,top:j,width:0,height:0})},b[9]=E,b[10]=j,b[11]=i):i=b[11];let R=i;b[12]!==M?(o=iz(M),b[12]=M,b[13]=o):o=b[13];let P=o;b[14]===Symbol.for("react.memo_cache_sentinel")?(s={minWidth:120,maxWidth:160},b[14]=s):s=b[14],b[15]!==P||b[16]!==C?(a=(0,f.jsx)(tG.az,{flex:"none",children:C?(0,f.jsx)(tG.EY,{size:1,children:P}):(0,f.jsx)(tG.y$,{size:1})}),b[15]=P,b[16]=C,b[17]=a):a=b[17];let N=C?A:"Loading...";b[18]!==N?(l=(0,f.jsx)(tG.BJ,{flex:1,space:2,children:(0,f.jsx)(tG.EY,{size:1,weight:"semibold",children:N})}),b[18]=N,b[19]=l):l=b[19],b[20]!==a||b[21]!==l?(u=(0,f.jsxs)(tG.so,{gap:2,padding:2,children:[a,l]}),b[20]=a,b[21]=l,b[22]=u):u=b[22],b[23]!==k||b[24]!==C||b[25]!==w?(c=C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(tG.Nj,{}),C.map((e,t)=>(0,f.jsx)(aU,{node:e,onDismiss:w,boundaryElement:k},t))]}),b[23]=k,b[24]=C,b[25]=w,b[26]=c):c=b[26],b[27]!==u||b[28]!==c?(d=(0,f.jsxs)(tG.W1,{style:s,children:[u,c]}),b[27]=u,b[28]=c,b[29]=d):d=b[29];let z=`${E}-${j}`;return b[30]!==E||b[31]!==j?(p={position:"absolute",left:E,top:j},b[30]=E,b[31]=j,b[32]=p):p=b[32],b[33]!==z||b[34]!==p?(y=(0,f.jsx)("div",{style:p},z),b[33]=z,b[34]=p,b[35]=y):y=b[35],b[36]!==R||b[37]!==d||b[38]!==y?(g=(0,f.jsx)(tG.AM,{__unstable_margins:aD,arrow:!1,open:!0,placement:"right-start",referenceElement:R,c
35ontent:d,children:y}),b[36]=R,b[37]=d,b[38]=y,b[39]=g):g=b[39],b[40]!==w||b[41]!==g?(v=(0,f.jsx)(iq,{setBoundaryElement:S,onDismiss:w,children:g}),b[40]=w,b[41]=g,b[42]=v):v=b[42],v},aV=(0,h.createContext)(null),aF=e=>(0,h.isValidElement)(e),aY=(0,tJ.I4)(tG.Zp)`
36  background-color: var(--overlay-bg);
37  border-radius: 3px;
38  pointer-events: none;
39  position: absolute;
40  will-change: transform;
41  box-shadow: var(--overlay-box-shadow);
42  transition: none;
43
44  --overlay-bg: transparent;
45  --overlay-box-shadow: inset 0 0 0 1px transparent;
46
47  [data-overlays] & {
48    --overlay-bg: color-mix(in srgb, transparent 95%, var(--card-focus-ring-color));
49    --overlay-box-shadow: inset 0 0 0 2px
50      color-mix(in srgb, transparent 50%, var(--card-focus-ring-color));
51  }
52
53  [data-fading-out] & {
54    transition:
55      box-shadow 1550ms,
56      background-color 1550ms;
57
58    --overlay-bg: rgba(0, 0, 255, 0);
59    --overlay-box-shadow: inset 0 0 0 1px transparent;
60  }
61
62  &[data-focused] {
63    --overlay-box-shadow: inset 0 0 0 1px var(--card-focus-ring-color);
64  }
65
66  &[data-hovered]:not([data-focused]) {
67    transition: none;
68    --overlay-box-shadow: inset 0 0 0 2px var(--card-focus-ring-color);
69  }
70
71  /* [data-unmounted] & {
72    --overlay-box-shadow: inset 0 0 0 1px var(--card-focus-ring-color);
73  } */
74
75  :link {
76    text-decoration: none;
77  }
78`,aW=(0,tJ.I4)(tG.so)`
79  bottom: 100%;
80  cursor: pointer;
81  pointer-events: none;
82  position: absolute;
83  right: 0;
84
85  [data-hovered]:not([data-menu-open]) & {
86    pointer-events: all;
87  }
88
89  [data-flipped] & {
90    bottom: auto;
91    top: 100%;
92  }
93`,aB=(0,tJ.I4)(tG.so)`
94  top: 100%;
95  cursor: pointer;
96  pointer-events: none;
97  position: absolute;
98  left: 0;
99
100  gap: 4px;
101  padding: 4px 0;
102  flex-wrap: wrap;
103
104  [data-hovered]:not([data-menu-open]) & {
105    pointer-events: all;
106  }
107
108  [data-flipped] & {
109    top: calc(100% + 2rem);
110  }
111`,aG=(0,tJ.I4)(tG.so)`
112  margin: -0.5rem;
113
114  [data-hovered]:not([data-menu-open]) & {
115    pointer-events: all;
116  }
117`,aJ=(0,tJ.I4)(tG.so)`
118  bottom: 100%;
119  cursor: pointer;
120  pointer-events: none;
121  position: absolute;
122  left: 0;
123
124  [data-hovered]:not([data-menu-open]) & {
125    pointer-events: all;
126  }
127
128  [data-flipped] & {
129    bottom: auto;
130    top: 100%;
131  }
132`,aH=(0,tJ.I4)(tG.Zp)`
133  cursor: pointer;
134  background-color: var(--card-focus-ring-color);
135  right: 0;
136  border-radius: 3px;
137
138  & [data-ui='Text'] {
139    color: #fff;
140    white-space: nowrap;
141  }
142`,aZ=(0,tJ.I4)(tG.so)`
143  display: flex;
144  align-items: center;
145  background-color: var(--card-focus-ring-color);
146  right: 0;
147  border-radius: 3px;
148  & [data-ui='Text'],
149  & [data-sanity-icon] {
150    color: #fff;
151    white-space: nowrap;
152  }
153`,aX=tJ.I4.div`
154  position: absolute;
155  inset: 0;
156  pointer-events: all;
157`,aK=e=>{let t,n,r,i,o,s,a,l,u,c,d,p,y,g,v,b,x,w=(0,m.c)(60),{id:_,element:E,focused:j,componentResolver:k,node:S,showActions:I,draggable:T,targets:M,elementType:$,comlink:A,onActivateExclusivePlugin:C,onMenuOpenChange:O,inFrame:R}=e,{getField:P,getType:N}=aA();w[0]!==N||w[1]!==S?(t=N(S),w[0]=N,w[1]=S,w[2]=t):t=w[2];let z=t;w[3]!==S?(n="path"in S?function(e){let{id:t,type:n,path:r,baseUrl:i,tool:o,workspace:s,perspective:a}=e,[l,u]=(0,tB.iz)({baseUrl:i,workspace:s,tool:o,type:n,id:t,path:r?function(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}(tB.C.fromString(r)):[]}).split("?"),c=new URLSearchParams(u),d=a||c.get("perspective");return"drafts"===d?c.delete("perspective"):d&&c.set("perspective",d),`${l}?${c}`}(S):S.href,w[3]=S,w[4]=n):n=w[4];let L=n,D=function(){let e=(0,h.useContext)(aV);if(!e)throw Error("Preview Snapshots context is missing");return e}();t:{let e;if(!("path"in S)){r=void 0;break t}w[5]!==S||w[6]!==D?(e=D.find(e=>e._id===S.id)?.title,w[5]=S,w[6]=D,w[7]=e):e=w[7],r=e}let U=r;w[8]!==E||w[9]!==j||w[10]!==P||w[11]!==N?(i=function(e,t){let n=N(e),{field:r,parent:i}=P(e);if(!("id"in e)||!r||!n)return;let o=r.value.type;return{document:n,element:E,targetElement:t||E,field:r,focused:!!j,node:e,parent:i,type:o}},w[8]=E,w[9]=j,w[10]=P,w[11]=N,w[12]=i):i=w[12];let q=i;if(w[13]!==$||w[14]!==q||w[15]!==S?(o="element"===$?q(S):void 0,w[13]=$,w[14]=q,w[15]=S,w[16]=o):o=w[16],w[17]!==q||w[18]!==M){let e;w[20]!==q?(e=e=>q(e.sanity,e.element),w[20]=q,w[21]=e):e=w[21],s=M.map(e).filter(a2),w[17]=q,w[18]=M,w[19]=s}else s=w[19];w[22]!==o||w[23]!==s?(a={legacyComponentContext:o,pluginContexts:s},w[22]=o,w[23]=s,w[24]=a):a=w[24];let V=a,F=function(e,t){let n,r=(0,m.c)(3);if(r[0]!==e||r[1]!==t){t:{if(!e){n=void 0;break t}let r=t?.(e);if(!r){n=void 0;break t}if(aF(r)){n=r;break t}n=(Array.isArray(r)?r:[r]).map(a0)}r[0]=e,r[1]=t,r[2]=n}else n=r[2];return n}(V.legacyComponentContext,k),Y=function(e,t){let n,r=(0,m.c)(5);if(r[0]!==e||r[1]!==t){let i;r[3]!==t?(i=e=>{let n={id:nG(),context:e,hud:[],exclusive:[]};return t?.forEach(t=>{t.guard?.(e)&&("hud"===t.type&&n.hud.push(t),"exclusive"===t.type&&n.exclusive.push(t))}),n},r[3]=t,r[4]=i):i=r[4],n=e.map(i),r[0]=e,r[1]=t,r[2]=n}else n=r[2];return n}(V.pluginContexts,e.plugins);w[25]!==z?(l=z?.icon?(0,f.jsx)("div",{dangerouslySetInnerHTML:{__html:z.icon}}):(0,f.jsx)(rv.pyG,{}),w[25]=z,w[26]=l):l=w[26];let W=l,B=(0,h.useId)();w[27]!==Y?(u=Y?.some(a3),w[27]=Y,w[28]=u):u=w[28];let G=u||Y?.length>1;w[29]!==_?(c=()=>{window.dispatchEvent(new CustomEvent("sanity-overlay/label-click",{detail:{id:_}}))},w[29]=_,w[30]=c):c=w[30];let J=c;return w[31]!==L||w[32]!==R||w[33]!==I?(d=I?(0,f.jsx)(aW,{gap:1,paddingY:1,children:(0,f.jsx)(a1,{inFrame:R,href:L})}):null,w[31]=L,w[32]=R,w[33]=I,w[34]=d):d=w[34],w[35]!==A||w[36]!==T||w[37]!==J||w[38]!==W||w[39]!==B||w[40]!==Y||w[41]!==C||w[42]!==O||w[43]!==G||w[44]!==U?(p=(U||G)&&(0,f.jsx)(aJ,{gap:1,paddingY:1,onClick:J,children:(0,f.jsxs)(aZ,{gap:2,padding:2,children:[T&&(0,f.jsx)(tG.az,{marginRight:1,children:(0,f.jsx)(tG.EY,{className:"drag-handle",size:0,children:(0,f.jsx)(rv.GG1,{})})}),(0,f.jsx)(tG.EY,{size:0,children:W}),U&&(0,f.jsx)(tG.EY,{size:1,weight:"medium",children:U}),G&&(0,f.jsx)(tG.az,{paddingLeft:2,onClick:a4,children:(0,f.jsx)(aG,{children:(0,f.jsx)(iQ.IU,{id:B,popover:{animate:!0,placement:"bottom-start",constrainSize:!0,tone:"default"},onOpen:()=>{O?.(!0)},onClose:()=>{O?.(!1)},button:(0,f.jsx)(tG.$n,{icon:rv.Lz$,tone:"primary",padding:2}),menu:(0,f.jsx)(tG.W1,{paddingY:0,children:(0,f.jsx)(iK,{children:Y?.map((e,t)=>(0,f.jsxs)(h.Fragment,{children:[(0,f.jsxs)(tG.BJ,{role:"group",paddingY:1,space:0,children:[(0,f.jsx)(tG.Dr,{paddingY:2,text:(0,f.jsx)(tG.az,{paddingY:2,children:(0,f.jsx)(tG.EY,{muted:!0,size:1,style:{textTransform:"capitalize"},children:`${e.context.document.name}: ${e.context.field?.name}`})}),onClick:()=>{e.context.node&&A?.post("visual-editing/focus",e.context.node)}}),e.exclusive.map(t=>
157t.component?(0,f.jsx)(tG.Dr,{paddingY:2,icon:t.icon||(0,f.jsx)(rv.gP2,{}),text:(0,f.jsx)(tG.az,{paddingY:2,children:(0,f.jsx)(tG.EY,{size:1,children:t.title||t.name})}),onClick:()=>C?.(t,e.context)},t.name):null)]}),t<Y.length-1&&(0,f.jsx)(tG.Nj,{})]},e.id))})})})})})]})}),w[35]=A,w[36]=T,w[37]=J,w[38]=W,w[39]=B,w[40]=Y,w[41]=C,w[42]=O,w[43]=G,w[44]=U,w[45]=p):p=w[45],w[46]!==Y?(y=Y?.map(a5),w[46]=Y,w[47]=y):y=w[47],w[48]!==y?(g=(0,f.jsx)(aB,{children:y}),w[48]=y,w[49]=g):g=w[49],w[50]!==d||w[51]!==p||w[52]!==g?(v=(0,f.jsxs)(iK,{children:[d,p,g]}),w[50]=d,w[51]=p,w[52]=g,w[53]=v):v=w[53],w[54]!==F||w[55]!==V.legacyComponentContext?(b=Array.isArray(F)?F.map((e,t)=>{let{component:n,props:r}=e;return(0,f.jsx)(n,{PointerEvents:iK,...V.legacyComponentContext,...r},t)}):F,w[54]=F,w[55]=V.legacyComponentContext,w[56]=b):b=w[56],w[57]!==v||w[58]!==b?(x=(0,f.jsxs)(f.Fragment,{children:[v,b]}),w[57]=v,w[58]=b,w[59]=x):x=w[59],x},aQ=(0,h.memo)(function(e){let t,n,r,i,o,s,a,l,u,c,d,p,y,g=(0,m.c)(39),{draggable:v,focused:b,hovered:x,rect:w,wasMaybeCollapsed:_,enableScrollIntoView:E,inFrame:j}=e,k=(0,h.useRef)(null),S=(0,h.useRef)(!1),I=`${w.w}px`,T=`${w.h}px`,M=`translate(${w.x}px, ${w.y}px)`;g[0]!==I||g[1]!==T||g[2]!==M?(t={width:I,height:T,transform:M},g[0]=I,g[1]=T,g[2]=M,g[3]=t):t=g[3];let $=t;g[4]!==E||g[5]!==b||g[6]!==_?(n=()=>{if(!S.current&&!_&&!0===b&&k.current&&E){let e=k.current;(0,i0.A)(k.current,{behavior:t=>{0!==t.length&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},scrollMode:"if-needed",block:"center",inline:"nearest"})}S.current=!0===b},r=[b,_,E],g[4]=E,g[5]=b,g[6]=_,g[7]=n,g[8]=r):(n=g[7],r=g[8]),(0,h.useEffect)(n,r);let[A,C]=(0,h.useState)(!1);g[9]!==x?(i=()=>{if(!k.current||!x)return;let e=new IntersectionObserver(e=>{let[t]=e;C(t.boundingClientRect.top<0)},{threshold:1});return e.observe(k.current),()=>e.disconnect()},g[9]=x,g[10]=i):i=g[10],g[11]!==x||g[12]!==A?(o=[x,A],g[11]=x,g[12]=A,g[13]=o):o=g[13],(0,h.useEffect)(i,o);let[O,R]=(0,h.useState)(null);g[14]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{R(null),window.dispatchEvent(new CustomEvent("sanity-overlay/exclusive-plugin-closed"))},g[14]=s):s=g[14];let P=s;g[15]===Symbol.for("react.memo_cache_sentinel")?(a=(e,t)=>{R({plugin:e,context:t})},g[15]=a):a=g[15];let N=a,z=O?.plugin.component,[L,D]=(0,h.useState)(!1);g[16]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{(0,h.startTransition)(()=>D(!1))},g[16]=l):l=g[16],g[17]!==x?(u=[x],g[17]=x,g[18]=u):u=g[18],(0,h.useEffect)(l,u),g[19]!==z||g[20]!==L?(c=L||z?(0,f.jsx)(iV,{onDismiss:P,blockScroll:L}):null,g[19]=z,g[20]=L,g[21]=c):c=g[21];let U=b?"":void 0,q=x?"":void 0,V=A?"":void 0,F=v?"":void 0,Y=L?"":void 0;return g[22]!==z||g[23]!==O||g[24]!==x||g[25]!==j||g[26]!==e?(d=z?(0,f.jsx)(aX,{"data-sanity-overlay-element":!0,onClick:a6,children:(0,f.jsx)(z,{...O.context,closeExclusiveView:P})}):x?(0,f.jsx)(aK,{...e,inFrame:j,onActivateExclusivePlugin:N,onMenuOpenChange:D}):null,g[22]=z,g[23]=O,g[24]=x,g[25]=j,g[26]=e,g[27]=d):d=g[27],g[28]!==$||g[29]!==U||g[30]!==q||g[31]!==V||g[32]!==F||g[33]!==Y||g[34]!==d?(p=(0,f.jsx)(aY,{"data-focused":U,"data-hovered":q,"data-flipped":V,"data-draggable":F,"data-menu-open":Y,ref:k,style:$,children:d}),g[28]=$,g[29]=U,g[30]=q,g[31]=V,g[32]=F,g[33]=Y,g[34]=d,g[35]=p):p=g[35],g[36]!==c||g[37]!==p?(y=(0,f.jsxs)(f.Fragment,{children:[c,p]}),g[36]=c,g[37]=p,g[38]=y):y=g[38],y});function a0(e){return"object"==typeof e&&"component"in e?e:{component:e,props:{}}}let a1=(0,h.memo)(function(e){let t,n,r,i=(0,m.c)(8),{inFrame:o}=e,s=(0,h.useSyncExternalStore)(a8,a9);i[0]!==e.href||i[1]!==s?(t=function e(t,n){try{let r=new URL(t,typeof location>"u"?void 0:location.origin);if(r.hash){let t=new URL(e(r.hash.slice(1),n));return`${r.origin}${r.pathname}${r.search}#${t.pathname}${t.search}`}return r.searchParams.set("preview",n),r.toString()}catch{return t}}(e.href,s),i[0]=e.href,i[1]=s,i[2]=t):t=i[2];let a=t,l=o?void 0:"_blank",u=o?"noopener":"noopener noreferrer";return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,f.jsx)(aH,{padding:2,children:(0,f.jsx)(tG.EY,{size:1,weight:"medium",children:"Open in Studio"})}),i[3]=n):n=i[3],i[4]!==a||i[5]!==l||i[6]!==u?(r=(0,f.jsx)(tG.az,{as:"a",href:a,target:l,rel:u,children:n}),i[4]=a,i[5]=l,i[6]=u,i[7]=r):r=i[7],r});function a2(e){return void 0!==e}function a3(e){return e.exclusive.length>0}function a4(e){e.stopPropagation()}function a5(e){return(0,f.jsx)(h.Fragment,{children:e.hud.map(t=>{let n=t.component;return n?(0,f.jsx)(n,{...e.context},t.name):null})},e.id)}function a6(e){e.stopPropagation()}function a8(e){let t=()=>e();return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)}function a9(){return window.location.href}let a7=e=>{let t,n=(0,m.c)(5),{dragGroupRect:r}
157=e,i=`${r.y}px`,o=`${r.x}px`,s=`${r.w-1}px`,a=`${r.h-1}px`;return n[0]!==i||n[1]!==o||n[2]!==s||n[3]!==a?(t=(0,f.jsx)("div",{style:{position:"absolute",top:i,left:o,width:s,height:a,border:"1px dashed #f0709b",pointerEvents:"none"}}),n[0]=i,n[1]=o,n[2]=s,n[3]=a,n[4]=t):t=n[4],t},le=e=>{let t,n=(0,m.c)(4),{dragInsertPosition:r}=e;if(null===r)return;let i=r?.left||r?.right?"horizontal":"vertical",o=0,s=0,a=0,l=0;if("horizontal"===i){let{left:e,right:t}=r;if(a=6,t&&e){let n=e.rect.x+e.rect.w,r=t.rect.x,i=.0125*Math.min(t.rect.h,e.rect.h);o=.5*n+.5*r-3,s=e.rect.y+i,l=Math.min(t.rect.h,e.rect.h)-2*i}else if(t&&!e){let e=.0125*t.rect.h;o=t.rect.x-3,s=t.rect.y+e,l=t.rect.h-2*e}else if(e&&!t){let t=.0125*e.rect.h;o=e.rect.x+e.rect.w-3,s=e.rect.y+t,l=e.rect.h-2*t}}else{let{bottom:e,top:t}=r;if(e&&t){let n=Math.min(t.rect.x,e.rect.x),r=t.rect.y+t.rect.h,i=e.rect.y,u=.0125*Math.min(e.rect.w,t.rect.w);l=6,o=n+u,s=.5*r+.5*i-3,a=Math.max(e.rect.w,t.rect.w)-2*u}else if(e&&!t){let t=.0125*e.rect.w;o=e.rect.x+t,s=e.rect.y-3,a=e.rect.w-2*t,l=6}else if(t&&!e){let e=.0125*t.rect.w;o=t.rect.x+e,s=t.rect.y+t.rect.h-3,a=t.rect.w-2*e,l=6}}let u=`${a}px`,c=`${l}px`,d=`translate(${o}px, ${s}px)`;return n[0]!==u||n[1]!==c||n[2]!==d?(t=(0,f.jsx)("div",{style:{position:"absolute",width:u,height:c,transform:d,background:"#556bfc",border:"2px solid white",borderRadius:"999px",zIndex:"999999"}}),n[0]=u,n[1]=c,n[2]=d,n[3]=t):t=n[3],t},lt=tJ.I4.div`
158  --drag-preview-opacity: 0.98;
159  --drag-preview-skeleton-stroke: #ffffff;
160
161  @media (prefers-color-scheme: dark) {
162    --drag-preview-skeleton-stroke: #383d51;
163  }
164
165  position: fixed;
166  display: grid;
167  transform: ${({$scaleFactor:e,$width:t,$height:n})=>`translate(calc(var(--drag-preview-x) - ${t/2}px), calc(var(--drag-preview-y) - ${n/2}px)) scale(${e})`};
168  width: ${({$width:e})=>`${e}px`};
169  height: ${({$height:e})=>`${e}px`};
170  z-index: 9999999;
171  opacity: var(--drag-preview-opacity);
172  cursor: move;
173
174  .drag-preview-content-wrapper {
175    position: relative;
176    width: 100%;
177    height: 100%;
178    container-type: inline-size;
179  }
180
181  [data-ui='card'] {
182    position: relative;
183    width: 100%;
184    height: 100%;
185  }
186
187  .drag-preview-skeleton {
188    position: absolute;
189    inset: 0;
190
191    rect {
192      stroke: var(--drag-preview-skeleton-stroke);
193    }
194  }
195
196  .drag-preview-handle {
197    position: absolute;
198    top: 4cqmin;
199    left: 4cqmin;
200    width: 6cqmin;
201    fill: var(--drag-preview-handle-fill);
202  }
203`,ln=e=>{let t,n,r,i,o,s,a,l,u,c,d,p,h,y,g,v,b,x,w,_,E,j=(0,m.c)(50),{skeleton:k}=e,S=Math.min(k.maxWidth,window.innerWidth/2),I=k.w>S?S/k.w:1,T=k.offsetX*I,M=k.offsetY*I,$=(0,tG.Xy)(),A=(0,tG.M4)(),C=A.radius[~~function(e,t,n,r,i){var o;return o=(e-0)*(i-1)/1920+1,o<r?r:o>i?i:o}(k.w,0,0,1,A.radius.length-2)];if(j[0]!==T||j[1]!==M||j[2]!==$||j[3]!==C||j[4]!==I||j[5]!==k.childRects||j[6]!==k.h||j[7]!==k.w){let e=k.childRects.filter(lr),f=k.childRects.filter(li);n=lt,i=k.w,o=k.h,s=T,a=M,l=I,t=tG.Zp,p=C,h=4,y="hidden",g="transparent",v=$?"dark":"light",d="drag-preview-content-wrapper",u="drag-preview-skeleton",c=`0 0 ${k.w} ${k.h}`,r=[...e,...f],j[0]=T,j[1]=M,j[2]=$,j[3]=C,j[4]=I,j[5]=k.childRects,j[6]=k.h,j[7]=k.w,j[8]=t,j[9]=n,j[10]=r,j[11]=i,j[12]=o,j[13]=s,j[14]=a,j[15]=l,j[16]=u,j[17]=c,j[18]=d,j[19]=p,j[20]=h,j[21]=y,j[22]=g,j[23]=v}else t=j[8],n=j[9],r=j[10],i=j[11],o=j[12],s=j[13],a=j[14],l=j[15],u=j[16],c=j[17],d=j[18],p=j[19],h=j[20],y=j[21],g=j[22],v=j[23];return j[24]!==r||j[25]!==A.color?(b=r.map((e,t)=>(0,f.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:A.color.skeleton.from},t)),j[24]=r,j[25]=A.color,j[26]=b):b=j[26],j[27]!==b||j[28]!==u||j[29]!==c?(x=(0,f.jsx)("svg",{className:u,viewBox:c,children:b}),j[27]=b,j[28]=u,j[29]=c,j[30]=x):x=j[30],j[31]!==x||j[32]!==d?(w=(0,f.jsx)("div",{className:d,children:x}),j[31]=x,j[32]=d,j[33]=w):w=j[33],j[34]!==t||j[35]!==w||j[36]!==p||j[37]!==h||j[38]!==y||j[39]!==g||j[40]!==v?(_=(0,f.jsx)(t,{radius:p,shadow:h,overflow:y,tone:g,scheme:v,children:w}),j[34]=t,j[35]=w,j[36]=p,j[37]=h,j[38]=y,j[39]=g,j[40]=v,j[41]=_):_=j[41],j[42]!==n||j[43]!==i||j[44]!==o||j[45]!==s||j[46]!==a||j[47]!==l||j[48]!==_?(E=(0,f.jsx)(n,{$width:i,$height:o,$offsetX:s,$offsetY:a,$scaleFactor:l,children:_}),j[42]=n,j[43]=i,j[44]=o,j[45]=s,j[46]=a,j[47]=l,j[48]=_,j[49]=E):E=j[49],E};function lr(e){return"IMG"===e.tagName}function li(e){return"IMG"!==e.tagName}let lo=(0,tJ.I4)(tG.Zp)`
204  position: fixed;
205  bottom: 2rem;
206  left: 2rem;
207`,ls=()=>{let e,t,n=(0,m.c)(2);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e={zIndex:"999999"},n[0]=e):e=n[0],n[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,f.jsx)(lo,{padding:2,shadow:2,radius:2,style:e,children:(0,f.jsxs)(tG.so,{align:"center",gap:2,children:[(0,f.jsx)(tG.qW,{keys:["Shift"]}),(0,f.jsx)(tG.EY,{size:1,children:"Zoom Out"}),(0,f.jsx)(rv.mSu,{})]})}),n[1]=t):t=n[1],t},la=(e,t)=>{let{type:n}=t;switch(n){case"element/register":return e.find(e=>e.id===t.id)?e:[...e,{id:t.id,activated:!1,element:t.element,focused:!1,hovered:!1,rect:t.rect,sanity:t.sanity,dragDisabled:t.dragDisabled,targets:t.targets,elementType:t.elementType}];case"element/activate":return e.map(e=>e.id===t.id?{...e,activated:!0}:e);case"element/update":return e.map(e=>e.id===t.id?{...e,sanity:t.sanity,rect:t.rect,targets:t.targets,elementType:t.elementType}:e);case"element/unregister":return e.filter(e=>e.id!==t.id);case"element/deactivate":return e.map(e=>e.id===t.id?{...e,activated:!1,hovered:!1}:e);case"element/mouseenter":return e.map(e=>e.id===t.id?{...e,rect:t.rect,hovered:!0}:{...e,hovered:!1});case"element/mouseleave":return e.map(e=>e.id===t.id?{...e,hovered:!1}:e);case"element/updateRect":return e.map(e=>e.id===t.id?{...e,rect:t.rect}:e);case"element/click":return e.map(e=>({...e,focused:e.id===t.id&&"clicked"}));case"overlay/reset-mouse-state":return e.map(e=>({...e,focused:!1,hovered:!1}));case"overlay/blur":return e.map(e=>({...e,focused:!1}));case"presentation/blur":return e.map(e=>({...e,focused:!1}));case"presentation/focus":{let n=e.find(e=>"clicked"===e.focused);return e.map(e=>
207{let r="path"in e.sanity&&e.sanity.id===t.data.id&&e.sanity.path===t.data.path;return n&&e===n&&r?e:{...e,focused:r&&n?"duplicate":r}})}default:return e}};function ll(e,t){let{type:n}=t,{contextMenu:r,focusPath:i,perspective:o,isDragging:s,dragInsertPosition:a,dragShowMinimap:l,dragShowMinimapPrompt:u,dragSkeleton:c,dragMinimapTransition:d,dragGroupRect:p}=e,f=!1;if("presentation/focus"===n){let n=e.focusPath;n!==(i=t.data.path)&&(f=n.slice(i.length).startsWith("["))}return"presentation/perspective"===n&&(o=t.data.perspective),"element/contextmenu"===n&&(r="sanity"in t?{node:t.sanity,position:t.position}:null),("element/click"===n||"element/mouseleave"===n||"overlay/blur"===n||"presentation/blur"===n||"presentation/focus"===n)&&(r=null),"overlay/dragUpdateInsertPosition"===n&&(a=t.insertPosition),"overlay/dragStart"===n&&(s=!0),"overlay/dragUpdateSkeleton"===t.type&&(c=t.skeleton),"overlay/dragEnd"===n&&(s=!1),"overlay/dragToggleMinimapPrompt"===t.type&&(u=t.display),"overlay/dragStartMinimapTransition"===n&&(d=!0),"overlay/dragEndMinimapTransition"===n&&(d=!1),"overlay/dragUpdateGroupRect"===n&&(p=t.groupRect),"overlay/dragToggleMinimap"===n&&(l=t.display),{...e,contextMenu:r,elements:la(e.elements,t),dragInsertPosition:a,dragSkeleton:c,dragGroupRect:p,isDragging:s,focusPath:i,perspective:o,wasMaybeCollapsed:f,dragShowMinimap:l,dragShowMinimapPrompt:u,dragMinimapTransition:d}}let lu=function(e){let t,n,r,i,o,s,a,l=(0,m.c)(13),{comlink:u,children:c}=e;l[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],l[0]=t):t=l[0];let[d,p]=(0,h.useState)(t);l[1]!==u?(n=async e=>{if(u)try{let t=await u.fetch("visual-editing/preview-snapshots",void 0,{signal:e,suppressWarnings:!0});p(t.snapshots)}catch{}},l[1]=u,l[2]=n):n=l[2];let y=n;return l[3]!==u||l[4]!==y?(r=()=>{if(!u)return;let e=new AbortController,t=u.onStatus(()=>{y(e.signal)},"connected");return()=>{e.abort(),t()}},i=[u,y],l[3]=u,l[4]=y,l[5]=r,l[6]=i):(r=l[5],i=l[6]),(0,h.useEffect)(r,i),l[7]!==u?(o=()=>u?.on("presentation/preview-snapshots",e=>{p(e.snapshots)}),s=[u],l[7]=u,l[8]=o,l[9]=s):(o=l[8],s=l[9]),(0,h.useEffect)(o,s),l[10]!==c||l[11]!==d?(a=(0,f.jsx)(aV.Provider,{value:d,children:c}),l[10]=c,l[11]=d,l[12]=a):a=l[12],a};function lc(e){return"document"===e.type}function ld(e){return"type"===e.type}let lp=function(e){let t,n,r,i,o,s,a,l,u,c,d,p=(0,m.c)(22),{comlink:y,children:g,elements:v}=e;p[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Map,p[0]=t):t=p[0];let[b,x]=(0,h.useState)(t),[w,_]=(0,h.useState)(null);p[1]!==y?(n=()=>{if(!y)return;let e=async function(e){if(y)try{let t=await y.fetch("visual-editing/schema",void 0,{signal:e,suppressWarnings:!0});_(t.schema)}catch{}},t=new AbortController,n=y.onStatus(()=>{e(t.signal)},"connected");return()=>{t.abort(),n()}},r=[y],p[1]=y,p[2]=n,p[3]=r):(n=p[2],r=p[3]),(0,h.useEffect)(n,r),p[4]===Symbol.for("react.memo_cache_sentinel")?(i=[],p[4]=i):i=p[4];let E=(0,h.useRef)(i),j=(0,h.useDeferredValue)(v);p[5]!==j?(o=j.reduce((e,t)=>{let{sanity:n}=t;if(!("id"in n)||!n.path.includes("[_key=="))return e;let r=n.path.split(".").toReversed().reduce((e,t)=>e.length?[t,...e]:t.includes("[_key==")?[t]:[],[]).join(".");return e.find(e=>e.id===n.id&&e.path===r)||e.push({id:n.id,path:r}),e},[]),p[5]=j,p[6]=o):o=p[6];let k=o,S=(0,h.useRef)(null);p[7]!==y||p[8]!==k?(s=()=>{if(!k.length||!y)return;let e=async(e,t)=>{let n=E.current;try{E.current=e;let n=await y.fetch("visual-editing/schema-union-types",{paths:e},{signal:t,suppressWarnings:!0});if(t.aborted)return;x(n.types),S.current=null}catch{}t.aborted&&(E.current=n)};k.some(e=>!E.current.find(t=>{let{id:n,path:r}=t;return n===e.id&&r===e.path}))&&(S.current?.abort(),S.current=new AbortController,e(k,S.current.signal))},a=[y,k],p[7]=y,p[8]=k,p[9]=s,p[10]=a):(s=p[9],a=p[10]),(0,h.useEffect)(s,a),p[11]!==w?(l=(e,t)=>{if(!w||"string"!=typeof e&&(!("path"in e)||!Array.isArray(w)))return;let n="string"==typeof e?e:e.type;return w.filter("document"===(t||"document")?lc:ld).find(e=>e.name===n)},p[11]=w,p[12]=l):l=p[12];let I=l;p[13]!==I||p[14]!==b?(u=e=>{if(!("path"in e))return{field:void 0,parent:void 0};let t=I(e);if(!t)return{field:void 0,parent:void 0};let n=e.path.split(".").flatMap(lf);try{return function t(n,r,i,o){let s=void 0===o?[]:o;if(!n)return{field:void 0,parent:void 0};let[a,...l]=r;if("fields"in n){let e=n.fields[a];if(!e&&"rest"in n)return t(n.rest,r,n,s);if(!l.length)return{field:e,parent:i};if(!e)throw Error(`[@sanity/visual-editing] No field could be resolved at path: "${[...s,...r].join(".")}"`);return t(e.value,l,n,[...s,a])}if("array"===n.type)return t(n.of,r,n,s);if("arrayItem"===n.type)return l.length?t(n.value,l,n,[...s,a]):{field:n,parent:i};if("union"===n.type){let r=a.startsWith("[_key==")?b?.get(e.id)?.get([s.join("."),a].filter(
207Boolean).join("")):a;return t(n.of.find(e=>"unionOption"===e.type?e.name===r:e),l,n,[...s,a])}if("unionOption"===n.type)return a?t(n.value,r,n,s):{field:n,parent:i};if("inline"===n.type)return t(I(n.name,"type").value,r,n,s);throw Error(`[@sanity/visual-editing] No field could be resolved at path: "${[...s,...r].join(".")}"`)}(t,n,void 0)}catch(e){return e instanceof Error&&console.warn(e.message),{field:void 0,parent:void 0}}},p[13]=I,p[14]=b,p[15]=u):u=p[15];let T=u;p[16]!==T||p[17]!==I?(c={getField:T,getType:I},p[16]=T,p[17]=I,p[18]=c):c=p[18];let M=c;return p[19]!==g||p[20]!==M?(d=(0,f.jsx)(a$.Provider,{value:M,children:g}),p[19]=g,p[20]=M,p[21]=d):d=p[21],d};function lf(e){return e.includes("[")?e.split(/(\[.+\])/,2):[e]}let lh=(e=>{let t=e,n=new Set;return{getState:()=>t,setState:e=>{t=e(t),n.forEach(e=>e())},subscribe:e=>(n.add(e),()=>n.delete(e))}})({}),ly=e=>{let t,n,r,i,o,s,a=(0,m.c)(11),{comlink:l,children:u}=e;a[0]!==l?(t=()=>l?.on("presentation/shared-state",lm),n=[l],a[0]=l,a[1]=t,a[2]=n):(t=a[1],n=a[2]),(0,h.useEffect)(t,n),a[3]!==l?(r=()=>{(async function(){let e=await l?.fetch("visual-editing/shared-state",void 0,{suppressWarnings:!0});e&&lh.setState(()=>e.state)})().catch(lg)},i=[l],a[3]=l,a[4]=r,a[5]=i):(r=a[4],i=a[5]),(0,h.useEffect)(r,i),a[6]!==l?(o={comlink:l,store:lh},a[6]=l,a[7]=o):o=a[7];let c=o;return a[8]!==u||a[9]!==c?(s=(0,f.jsx)(rg.Provider,{value:c,children:u}),a[8]=u,a[9]=c,a[10]=s):s=a[10],s};function lm(e){"value"in e?lh.setState(t=>({...t,[e.key]:e.value})):lh.setState(t=>Object.fromEntries(Object.entries(t).filter(t=>{let[n]=t;return n!==e.key})))}function lg(e){console.debug(e),console.warn("[@sanity/visual-editing]: Failed to fetch shared state. Check your version of `sanity` is up-to-date")}let lv=e=>{let t,n,r=(0,m.c)(5),{children:i,comlink:o}=e;r[0]!==o?(t=(e,t)=>{if(!o)return;let n=iW[e];if(n)o.post("visual-editing/telemetry-log",{event:n,data:t});else throw Error(`Telemetry event: ${e} does not exist`)},r[0]=o,r[1]=t):t=r[1];let s=t;return r[2]!==i||r[3]!==s?(n=(0,f.jsx)(iB.Provider,{value:s,children:i}),r[2]=i,r[3]=s,r[4]=n):n=r[4],n};function lb(){}function lx(e){return e.id}function lw(e){return!!e}function l_(e){let{sanity:t}=e;return t&&"id"in t?t:null}let lE=tJ.I4.div`
208  background-color: transparent;
209  direction: ltr;
210  inset: 0;
211  pointer-events: none;
212  position: absolute;
213  width: 100%;
214  height: 100%;
215  z-index: ${({$zIndex:e})=>e??"9999999"};
216`;function lj(e){let t,n;return t=requestAnimationFrame(()=>{n=requestAnimationFrame(e)}),()=>{void 0!==t&&cancelAnimationFrame(t),void 0!==n&&cancelAnimationFrame(n)}}let lk=e=>{let t,n,r,i,o,s=(0,m.c)(8),{documentIds:a}=e;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],s[0]=t):t=s[0];let[l,u]=(0,h.useState)(t);s[1]!==a?(n=()=>{(0,h.startTransition)(()=>u(e=>{let t=Array.from(new Set(a));return e.length===t.length&&e.reduce(lD,t)?.length===0?e:t}))},r=[a],s[1]=a,s[2]=n,s[3]=r):(n=s[2],r=s[3]),(0,h.useEffect)(n,r);let c=nh();return s[4]!==c||s[5]!==l?(i=()=>{for(let e of l)c.send({type:"observe",documentId:(0,tB.T4)(e)}),c.send({type:"observe",documentId:(0,tB.IM)(e)});return()=>{for(let e of l)c.send({type:"unobserve",documentId:(0,tB.T4)(e)}),c.send({type:"unobserve",documentId:(0,tB.IM)(e)})}},o=[c,l],s[4]=c,s[5]=l,s[6]=i,s[7]=o):(i=s[6],o=s[7]),(0,h.useEffect)(i,o),null},lS=e=>{let t,n,r,i=(0,m.c)(12),{comlink:o,dispatch:s,inFrame:a,inPopUp:l,onDrag:u,overlayEnabled:c,rootElement:d}=e,{dispatchDragEndEvent:p}=function(){let e,t,n,r=(0,m.c)(4),{getDocument:i}=nw();return r[0]!==i?(e=()=>{let e=e=>{let{insertPosition:t,target:n,preventInsertDefault:r}=e.detail;if(r)return;let o=function(e){if(e){let{top:t,right:n,bottom:r,left:i}=e;if(i||t)return{node:(i??t).sanity,position:"after"};if(n||r)return{node:(n??r).sanity,position:"before"}}}(t);if(o){let e=i(n.id),{node:t,position:r}=o,{key:s,hasExplicitKey:a}=nj(n),{path:l,key:u}=nj(t);l&&u&&u!==s&&e.patch(async e=>{let{getSnapshot:t}=e,i=np(await t(),n.path);return a?[nn(l,nt({_key:s})),nn(l,t7(i,r,{_key:u}))]:[nn(l,nt(~~s)),nn(l,t7(i,r,u>s?~~u-1:~~u))]})}};return window.addEventListener("sanity/dragEnd",e),()=>{window.removeEventListener("sanity/dragEnd",e)}},t=[i],r[0]=i,r[1]=e,r[2]=t):(e=r[1],t=r[2]),(0,h.useEffect)(e,t),r[3]===Symbol.for("react.memo_cache_sentinel")?(n={dispatchDragEndEvent:aM},r[3]=n):n=r[3],n}(),f=iG();i[0]!==o||i[1]!==s||i[2]!==p||i[3]!==u||i[4]!==f?(t=e=>{if("element/click"===e.type){let{sanity:t}=e;o?.post("visual-editing/focus",t),f("Visual Editing Overlay Clicked",null)}else if("overlay/activate"===e.type)o?.post("visual-editing/toggle",{enabled:!0});else if("overlay/deactivate"===e.type)o?.post("visual-editing/toggle",{enabled:!1});else if("overlay/dragEnd"===e.type){let{insertPosition:t,target:n,dragGroup:r,flow:i,preventInsertDefault:o}=e;p({insertPosition:t,target:n,dragGroup:r,flow:i,preventInsertDefault:o}),t&&f("Visual Editing Drag Sequence Completed",null)}else if("overlay/dragUpdateCursorPosition"===e.type)return void u(e.x,e.y);else if("overlay/dragToggleMinimap"===e.type&&!0===e.display)f("Visual Editing Drag Minimap Enabled",null);else if("overlay/setCursor"===e.type){let{element:t,cursor:n}=e;n?t.style.cursor=n:t.style.removeProperty("cursor")}s(e)},i[0]=o,i[1]=s,i[2]=p,i[3]=u,i[4]=f,i[5]=t):t=i[5];let y=function(e,t,n,r){let i,o,s=(0,m.c)(7),a=(0,h.useRef)(void 0),l=nv();return s[0]!==e||s[1]!==t||s[2]!==n||s[3]!==r||s[4]!==l?(i=()=>
216{if(e)return a.current=function({handler:e,overlayElement:t,inFrame:n,inPopUp:r,optimisticActorReady:i}){let o=!1,s=new Map,a=new WeakMap,l=new Set,u=new WeakMap,c=new WeakMap,d,p,f,h=!1,y=[],m=()=>y[y.length-1];function g(e,t){e.removeEventListener("click",t.click,{capture:!0}),e.removeEventListener("contextmenu",t.contextmenu,{capture:!0}),e.removeEventListener("mousemove",t.mousemove,{capture:!0}),e.removeEventListener("mousedown",t.mousedown,{capture:!0}),e.removeEventListener("mouseenter",t.mouseenter),e.removeEventListener("mouseleave",t.mouseleave)}function v({id:t,elements:n,handlers:r}){let{element:i,measureElement:o}=n;i.addEventListener("click",r.click,{capture:!0}),i.addEventListener("contextmenu",r.contextmenu,{capture:!0}),i.addEventListener("mousemove",r.mousemove,{once:!0,capture:!0}),i.addEventListener("mousedown",r.mousedown,{capture:!0}),d.observe(o),e({type:"element/activate",id:t})}function b({id:t,elements:n,handlers:r}){let{element:i,measureElement:o}=n;g(i,r),d.unobserve(o),y=y.filter(e=>e!==i),e({type:"element/deactivate",id:t})}function x(t){if(!(!n&&!r||!i))for(let n of y){if(t===n){let n=a.get(t)?.sanity;if(!n||!rd(n))return;if(rm(t,n,l,a)){let n=t.style.cursor;n&&c.set(t,n),e({type:"overlay/setCursor",element:t,cursor:"move"});continue}}w(n)}}function w(t){let n=c.get(t);e({type:"overlay/setCursor",element:t,cursor:n})}function _(c){for(let d of function e(t){let n=[];function r(e,t,n,r){let i=function(e){if("object"==typeof e&&null!==e)return nP(e);try{let t=JSON.parse(e);return nP(t)}catch{let t=e.split(";").reduce((e,t)=>{let[n,r]=t.split("=");if(!n||t.includes("=")&&!r)return e;switch(n){case"id":e.id=r;break;case"type":e.type=r;break;case"path":e.path=tB.C.toString(function(e){let t=[];for(let n of e.split(".")){let e=n$.exec(n);if(e){t.push(e[1],Number(e[2]));continue}let r=nA.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}let i=nC.exec(n);if(i){t.push(i[1],{_key:i[2]});continue}t.push(n)}return t}(r));break;case"base":e.baseUrl=decodeURIComponent(r);break;case"perspective":e.perspective=r;break;case"tool":e.tool=r;break;case"workspace":e.workspace=r;break;case"projectId":e.projectId=r;break;case"dataset":e.dataset=r}return e},{});if((0,nS.is)(nM,t))return t;return}}(t);if(!i)return;let o=function e(t){let{display:n}=window.getComputedStyle(t);if("inline"!==n)return t;let r=t.parentElement;return r?e(r):null}(e);if(o)return{elements:{element:e,measureElement:o},sanity:i,reason:n,preventGrouping:r}}if(t)for(let i of t.childNodes)!function t(i,o){let s=function(t){let{nodeType:n,parentElement:i,textContent:o}=t;if(ra(t)&&t.dataset?.sanityEditTarget!==void 0){let n=rp(e(t).map(e=>"element"===e.type?e.commonSanity:void 0).filter(e=>void 0!==e));if(n)return{reason:"edit-target",elements:{element:t,measureElement:t},sanity:n}}else if(n===Node.TEXT_NODE&&i&&o){let e=rs(o);return e?r(i,e,"stega-text",!0):void 0}else if(ra(t)){if("SCRIPT"===t.tagName||"SANITY-VISUAL-EDITING"===t.tagName)return;if(t.dataset?.sanity)return r(t,t.dataset.sanity,"data-attribute",!!(t.textContent&&ro(t.textContent)));if(t.dataset?.sanityEditInfo)return r(t,t.dataset.sanityEditInfo,"data-attribute",!!(t.textContent&&ro(t.textContent)));if(rl(t)){let e=rs(t.alt,!0);return e?r(t,e,"stega-attribute"):void 0}if(ru(t)){let e=rs(t.dateTime,!0);return e?r(t,e,"stega-attribute"):void 0}if(rc(t)){if(!t.ariaLabel)return;let e=rs(t.ariaLabel,!0);return e?r(t,e,"stega-attribute"):void 0}}}(i),a=o;if(ra(i)&&i.dataset?.sanityEditGroup!==void 0&&(a={type:"group",elements:{element:i,measureElement:i},targets:[]},n.push(a)),s){let e={elements:s.elements,sanity:s.sanity,reason:s.reason};a&&!s.preventGrouping?a.targets.push(e):n.push({elements:s.elements,type:"element",targets:[e]})}if(ra(i)&&!rl(i)&&"SCRIPT"!==i.tagName&&"SANITY-VISUAL-EDITING"!==i.tagName)for(let e of i.childNodes)t(e,a)}(i,void 0);return n.map(e=>{if(0===e.targets.length&&"group"===e.type)return{...e,commonSanity:void 0};let t=1===e.targets.length?e.targets[0].sanity:rp(e.targets.map(({sanity:e})=>e).filter(e=>void 0!==e))||e.targets[0].sanity;return t?{...e,commonSanity:t}:null}).filter(e=>null!==e)}(c)){if("group"===d.type){for(let e of d.targets){let t=a.get(e.elements.element);t&&"element"===t.type&&E(e.elements.element)}0===d.targets.length&&E(d.elements.element)}if(!d.commonSanity)continue;let{element:c}=d.elements;a.has(c)?function(t){let{element:n}=t.elements,r=a.get(n);r&&(a.set(n,{...r,sanity:t.commonSanity}),e({type:"element/update",elementType:r.type,id:r.id,rect:nJ(n),sanity:t.commonSanity,targets:t.targets.map(e=>({sanity:e.sanity,element:e.elements.element}))}))}(d):function({type:c,elements:d,commonSanity:f,targets:g}){let{element:b,measureElement:_}=d,E={click(t){let r=t.target;if(b===m()&&b.contains(r)){n&&(t.preventDefault(),t.stopPropagation());let r=a.get(b)?.sanity;r&&!h&&e({type:"element/click",id:j,sanity:r})}},contextmenu(t){if(!("path"in f)||!n&&!r||!i||!f.path.split(".").pop()?.includes("[_key=="))return;let o=t.target;b===m()&&b.contains(o)&&((n||r)&&(t.preventDefault(),t.stopPropagation()),e({type:"element/contextmenu",id:j,position:{x:t.clientX,y:t.clientY},sanity:f}))},mousedown(t){if(t.preventDefault(),t.currentTarget!==y.at(-1)||b.getAttribute("data-sanity-drag-disable")||!n&&!r||!i)return;let o=a.get(b)?.sanity;if(!o||!rd(o)||!rf(o.path))return;let s=rm(b,f,l,a);s&&function(e){var t;let{mouseEvent:n,element:r,overlayGroup:i,handler:o,target:s,onSequenceStart:a,onSequenceEnd:l}=e;if(0!==n.button)return;window.focus();let u=i.map(e=>nJ(e.elements.element)),c=r.getAttribute("data-sanity-drag-flow")||((t=u).some(e=>t.filter(t=>!nZ(e,t)).some(t=>e.y===t.y))?"horizontal":"vertical"),d=r.getAttribute("data-sanity-drag-group"),p=!!r.getAttribute("data-sanity-drag-minima
216p-disable"),f=!!r.getAttribute("data-sanity-drag-prevent-default"),h=r.getAttribute("data-unstable_sanity-drag-document-height"),y=r.getAttribute("data-unstable_sanity-drag-group-height"),m=null,g=n3(n),v=document.body,{minYScaled:b,scaleFactor:x}=function(e,t){let n=t||n0(e).height,r=(n+=200)>window.innerHeight?window.innerHeight/n:1,{min:i}=n0(e.map(e=>nQ(e,r,{x:window.innerWidth/2,y:0})));return{scaleFactor:r,minYScaled:i-100*r}}(u,y?~~y:null),w=!1,_=!1,E=!0;n9||(rn={body:{overflow:window.getComputedStyle(document.body).overflow,height:window.getComputedStyle(document.body).height},documentElement:{overflow:window.getComputedStyle(document.documentElement).overflow,height:window.getComputedStyle(document.documentElement).height}},rt=h?~~h:document.documentElement.scrollHeight);let j=setInterval(()=>{u=i.map(e=>nJ(e.elements.element))},150),k=()=>{x>=1||(o({type:"overlay/dragUpdateSkeleton",skeleton:n4(re,r,x)}),o({type:"overlay/dragToggleMinimapPrompt",display:!1}),n5(v,x,b,o,150).then(()=>{setTimeout(()=>{o({type:"overlay/dragUpdateGroupRect",groupRect:n6(u)})},300)}))},S=e=>{Math.abs(e.deltaY)>=10&&x<1&&!n9&&!_&&!p&&E&&(o({type:"overlay/dragToggleMinimapPrompt",display:!0}),_=!0),!e.shiftKey||n9||p||(window.dispatchEvent(new CustomEvent("unstable_sanity/dragApplyMinimap")),n9=!0,setTimeout(()=>{k()},50))},I=e=>{if(e.preventDefault(),n7=function(e){let t=document.body,n=window.getComputedStyle(t).transform;if("none"===n)return{x:e.x,y:e.y};let r=new DOMMatrix(n).inverse(),i=new DOMPoint(e.x,e.y).matrixTransform(r);return{x:i.x,y:i.y}}(re=n3(e)),4>Math.abs(nX(re,g)))return;if(!w){let e=n6(u),t=n4(re,r,1);o({type:"overlay/dragStart",flow:c}),o({type:"overlay/dragUpdateSkeleton",skeleton:t}),o({type:"overlay/dragUpdateGroupRect",groupRect:e}),w=!0,a()}o({type:"overlay/dragUpdateCursorPosition",x:re.x,y:re.y}),!e.shiftKey||n9||p||(window.dispatchEvent(new CustomEvent("unstable_sanity/dragApplyMinimap")),n9=!0,setTimeout(()=>{k()},50));let t=function(e,t,n){if("horizontal"===n){let r={x1:e.x,y1:e.y,x2:e.x-1e8,y2:e.y},i={x1:e.x,y1:e.y,x2:e.x+1e8,y2:e.y};return{left:nK(r,t,n),right:nK(i,t,n)}}{let r={x1:e.x,y1:e.y,x2:e.x,y2:e.y-1e8},i={x1:e.x,y1:e.y,x2:e.x,y2:e.y+1e8};return{top:nK(r,t,n),bottom:nK(i,t,n)}}}(re,u,c);JSON.stringify(m)!==JSON.stringify(t)&&o({type:"overlay/dragUpdateInsertPosition",insertPosition:n2(i,m=t,c)})},T=()=>{E=!1,o({type:"overlay/dragEnd",target:s,insertPosition:m?n2(i,m,c):null,dragGroup:d,flow:c,preventInsertDefault:f}),_&&o({type:"overlay/dragToggleMinimapPrompt",display:!1}),n9||(clearInterval(j),l(),O(),C()),A()},M=e=>{"Shift"===e.key&&n9&&(n9=!1,o({type:"overlay/dragUpdateSkeleton",skeleton:n4(re,r,1/x)}),window.dispatchEvent(new CustomEvent("unstable_sanity/dragResetMinimap")),setTimeout(()=>{n8(n7.y,v,rt,o,150,rn)},50),o({type:"overlay/dragUpdateGroupRect",groupRect:null}),E||(clearInterval(j),A(),O(),C(),l()))},$=()=>{o({type:"overlay/dragUpdateGroupRect",groupRect:null}),window.dispatchEvent(new CustomEvent("unstable_sanity/dragResetMinimap")),setTimeout(()=>{n8(n7.y,v,rt,o,150,rn).then(()=>{n9=!1})},50),clearInterval(j),A(),O(),C(),l()},A=()=>{window.removeEventListener("mousemove",I),window.removeEventListener("wheel",S),window.removeEventListener("mouseup",T)},C=()=>{window.removeEventListener("keyup",M)},O=()=>{window.removeEventListener("blur",$)};window.addEventListener("blur",$),window.addEventListener("keyup",M),window.addEventListener("wheel",S),window.addEventListener("mousemove",I),window.addEventListener("mouseup",T)}({element:b,handler:e,mouseEvent:t,overlayGroup:s,target:o,onSequenceStart:()=>{h=!0},onSequenceEnd:()=>{setTimeout(()=>{h=!1},250)}})},mousemove(e){E.mouseenter(e);let t=e.currentTarget;t&&(t.addEventListener("mouseenter",E.mouseenter),t.addEventListener("mouseleave",E.mouseleave))},mouseenter(){document.querySelector("vercel-live-feedback")&&b.closest("[data-vercel-edit-info]")||b.closest("[data-vercel-edit-target]")||(y.push(b),e({type:"element/mouseenter",id:j,rect:nJ(b)}),x(b))},mouseleave(n){function r(){y.pop();let t=m();if(e({type:"element/mouseleave",id:j}),t){x(t);let n=a.get(t);n&&e({type:"element/mouseenter",id:n.id,rect:nJ(t)})}w(b)}let{relatedTarget:i}=n,o=ri(i),s=t.contains(o);if(rr(o)&&s)return function e(t){let n=i=>{let{relatedTarget:o}=i;ri(o)?o&&rr(o)&&(t.removeEventListener("mouseleave",n),e(o)):(t.removeEventListener("mouseleave",n),r())};t.addEventListener("mouseleave",n)}(o);r()}},j=nG(),k={type:c,id:j,elements:d,sanity:f,handlers:E};l.add(b),u.set(_,b),s.set(j,b),a.set(b,k),p?.observe(b),e({type:"element/register",elementType:c,id:j,element:b,rect:nJ(b),sanity:f,dragDisabled:!!b.getAttribute("data-sanity-drag-disable"),targets:g.map(e=>({sanity:e.sanity,element:e.elements.element}))}),o&&v(k)}(d)}}function E(t){let n=a.get(t);if(n){let{id:r,handlers:i}=n;g(t,i),d.unobserve(t),a.delete(t),l.delete(t),s.delete(r),e({type:"element/unregister",id:r})}}function j(t){let n=a.get(t);n&&e({type:"element/updateRect",id:n.id,rect:nJ(t)})}function k(e){if(o)for(let t of e){let{target:e}=t,n=rr(e)&&a.get(e);n&&(t.isIntersecting?v(n):b(n))}}function S(t){let n=ri(t.target);if(n){"capture"===n.dataset.sanityOverlayElement&&(t.preventDefault(),t.stopPropagation());return}y=[],e({type:"overlay/blur"})}function I(){y=[],e({type:"overlay/reset-mouse-state"})}function T(){for(let e of l)j(e)}function M(t){"Escape"===t.key&&(y=[],e({type:"overlay/blur"}))}function $(e){let{target:t}=e;if(!(t===window.document||!rr(t)))for(let e of l)t.contains(e)&&j(e)}function A(){o||(p=new IntersectionObserver(k,{threshold:.3}
216),l.forEach(e=>p.observe(e)),e({type:"overlay/activate"}),o=!0)}function C(){o&&(p?.disconnect(),l.forEach(e=>{let t=a.get(e);t&&b(t)}),e({type:"overlay/deactivate"}),o=!1)}function O(t){let{id:n}=t.detail,r=s.get(n);if(!r)return;let i=a.get(r)?.sanity;i&&e({type:"element/click",id:n,sanity:i})}return window.document.fonts.ready.then(()=>{for(let e of l)j(e)}),window.addEventListener("click",S),window.addEventListener("contextmenu",S),window.addEventListener("sanity-overlay/exclusive-plugin-closed",I),window.addEventListener("sanity-overlay/label-click",O),window.addEventListener("keydown",M),window.addEventListener("resize",T),window.addEventListener("scroll",$,{capture:!0,passive:!0}),d=new ResizeObserver(function(e){for(let t of e){let e=t.target;if(rr(e)){let t=u.get(e);if(!t)return;j(t)}}}),(f=new MutationObserver(function(e){let n=!1;for(let r of e){let{target:e,type:i}=r,o="characterData"===i?e.parentElement:e;if(!(o===t||t.contains(o))&&(n=!0,rr(o))){let e=o.parentElement?.closest("[data-sanity-edit-group]")||null;_({childNodes:[rr(e)?e:o]})}}if(n)for(let e of l)e.isConnected||E(e),a.get(e)?.type!=="group"||e.hasAttribute("data-sanity-edit-group")||E(e)})).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),_(document.body),A(),{activate:A,deactivate:C,destroy:function(){window.removeEventListener("click",S),window.removeEventListener("contextmenu",S),window.removeEventListener("sanity-overlay/exclusive-plugin-closed",I),window.removeEventListener("sanity-overlay/label-click",O),window.removeEventListener("keydown",M),window.removeEventListener("resize",T),window.removeEventListener("scroll",$),f.disconnect(),d.disconnect(),l.forEach(e=>{E(e)}),s.clear(),l.clear(),y=[],C()}}}({handler:t,overlayElement:e,inFrame:n,inPopUp:r,optimisticActorReady:l}),()=>{a.current?.destroy(),a.current=void 0}},o=[e,t,n,r,l],s[0]=e,s[1]=t,s[2]=n,s[3]=r,s[4]=l,s[5]=i,s[6]=o):(i=s[5],o=s[6]),(0,h.useEffect)(i,o),a}(d,t,a,l);return i[6]!==y.current||i[7]!==c?(n=()=>{c?y.current?.activate():y.current?.deactivate()},i[6]=y.current,i[7]=c,i[8]=n):n=i[8],i[9]!==y||i[10]!==c?(r=[y,c],i[9]=y,i[10]=c,i[11]=r):r=i[11],(0,h.useEffect)(n,r),null};function lI(e){let t,n,r,i,o,s,a,l,u,c,d,p,y,g,v,b,x,w,_,E,j,k,S,I,T,M=(0,m.c)(81),{comlink:$,comlinkStatus:A,componentResolver:C,inFrame:O,inPopUp:R,zIndex:P,onPerspectiveChange:N}=e,z=(0,tG.Xy)();M[0]===Symbol.for("react.memo_cache_sentinel")?(t={contextMenu:null,dragInsertPosition:null,dragShowMinimap:!1,dragShowMinimapPrompt:!1,dragSkeleton:null,elements:[],focusPath:"",isDragging:!1,perspective:"published",wasMaybeCollapsed:!1,dragMinimapTransition:!1,dragGroupRect:null},M[0]=t):t=M[0];let[L,D]=(0,h.useReducer)(ll,t),{contextMenu:U,dragInsertPosition:q,dragShowMinimap:V,dragShowMinimapPrompt:F,dragSkeleton:Y,elements:W,isDragging:B,perspective:G,wasMaybeCollapsed:J,dragMinimapTransition:H,dragGroupRect:Z}=L,[X,K]=(0,h.useState)(null),[Q,ee]=(0,h.useState)(!0);M[1]!==$?(n=()=>{let e=[$?.on("presentation/focus",e=>{D({type:"presentation/focus",data:e})}),$?.on("presentation/blur",e=>{D({type:"presentation/blur",data:e})}),$?.on("presentation/toggle-overlay",()=>{ee(lN)})].filter(Boolean);return()=>e.forEach(lP)},r=[$],M[1]=$,M[2]=n,M[3]=r):(n=M[2],r=M[3]),(0,h.useEffect)(n,r),function(e,t){let n,r,i=(0,m.c)(4);i[0]!==e||i[1]!==t?(n=()=>{let n=new AbortController;e?.fetch("visual-editing/fetch-perspective",void 0,{signal:n.signal,suppressWarnings:!0}).then(e=>{t({type:"presentation/perspective",data:e})}).catch(lb);let r=e?.on("presentation/perspective",e=>{t({type:"presentation/perspective",data:e})});return()=>{r?.(),n.abort()}},r=[e,t],i[0]=e,i[1]=t,i[2]=n,i[3]=r):(n=i[2],r=i[3]),(0,h.useEffect)(n,r)}($,D),M[4]!==N||M[5]!==G?(i=()=>{if(!N)return;let e=requestAnimationFrame(()=>(0,h.startTransition)(()=>N(G)));return()=>cancelAnimationFrame(e)},o=[N,G],M[4]=N,M[5]=G,M[6]=i,M[7]=o):(i=M[6],o=M[7]),(0,h.useEffect)(i,o),function(e,t,n){let r,i,o,s=(0,m.c)(7),a=(0,h.useRef)(void 0);s[0]!==e?(r=(t,n)=>{e?.post("visual-editing/documents",{documents:t,perspective:n})},s[0]=e,s[1]=r):r=s[1];let l=r;s[2]!==t||s[3]!==n||s[4]!==l?(i=()=>{let e=t.map(l_).filter(lw),r=new Set(e.map(lx));if(!a.current||!function(e,t){if(e===t)return!0;
216if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}(r,a.current.nodeIds)||n!==a.current.perspective){let t=Array.from(r).map(t=>{let{type:n,projectId:r,dataset:i}=e.find(e=>e.id===t);return r&&i?{_id:t,_type:n,_projectId:r,_dataset:i}:{_id:t,_type:n}});a.current={nodeIds:r,perspective:n},l(t,n)}},o=[t,n,l],s[2]=t,s[3]=n,s[4]=l,s[5]=i,s[6]=o):(i=s[5],o=s[6]),(0,h.useEffect)(i,o)}($,W,G),M[8]!==X?(s=(e,t)=>{X&&(X.style.setProperty("--drag-preview-x",`${e}px`),X.style.setProperty("--drag-preview-y",`${t-window.scrollY}px`))},M[8]=X,M[9]=s):s=M[9];let et=s;M[10]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{let e=!1,t=t=>{lL(t)&&e&&(e=!1,ee(lO))},n=t=>{var n,r;if(lL(t)){if(t.ctrlKey||t.metaKey||t.shiftKey)return;e||(e=!0,ee(lC))}n=["mod","\\"],r=t,n.every(e=>lz[e]?r[lz[e]]:r.key===e.toUpperCase())&&ee(lA)},r=()=>{e&&(e=!1,ee(l$))};return window.addEventListener("click",lR),window.addEventListener("keydown",n),window.addEventListener("keyup",t),window.addEventListener("blur",r),()=>{window.removeEventListener("click",lR),window.removeEventListener("keydown",n),window.removeEventListener("keyup",t),window.removeEventListener("blur",r)}},l=[ee],M[10]=a,M[11]=l):(a=M[10],l=M[11]),(0,h.useEffect)(a,l);let[en,er]=(0,h.useState)(!1),[ei,eo]=(0,h.useState)(!1),es=(0,h.useRef)(void 0);M[12]!==Q?(c=()=>{if(Q)return lj(()=>{er(!0),lj(()=>{eo(!0),es.current=setTimeout(()=>{eo(!1),er(!1)},1500)})});es.current&&(clearTimeout(es.current),(0,h.startTransition)(()=>{er(!1),eo(!1)}))},u=[Q],M[12]=Q,M[13]=u,M[14]=c):(u=M[13],c=M[14]),(0,h.useEffect)(c,u),M[15]!==W?(d=W.flatMap(lM),M[15]=W,M[16]=d):d=M[16];let ea=d;M[17]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{D({type:"overlay/blur"})},M[17]=p):p=M[17];let el=p,eu=nv(),ec=eu?C:void 0,[ed,ep]=(0,h.useState)(!1);!ed&&O&&"connected"===A&&ep(!0);t:{let t;if(B){let e;M[18]===Symbol.for("react.memo_cache_sentinel")?(e=[],M[18]=e):e=M[18],y=e;break t}M[19]!==$||M[20]!==ec||M[21]!==H||M[22]!==V||M[23]!==W||M[24]!==O||M[25]!==B||M[26]!==eu||M[27]!==e.plugins||M[28]!==ed||M[29]!==J?(t=W.filter(lT).map(t=>{let{id:n,element:r,focused:i,hovered:o,rect:s,sanity:a,dragDisabled:l,targets:u,elementType:c}=t,d=!l&&!!r.getAttribute("data-sanity")&&eu&&W.some(e=>"id"in e.sanity&&"id"in a&&ry(e.sanity,a)&&e.sanity.path!==a.path);return(0,f.jsx)(aQ,{comlink:$,componentResolver:ec,plugins:e.plugins,element:r,enableScrollIntoView:!B&&!H&&!V,id:n,focused:i,hovered:o,node:a,rect:s,showActions:!ed,draggable:d,isDragging:B||H,wasMaybeCollapsed:i&&J,targets:u,elementType:c,inFrame:O},n)}),M[19]=$,M[20]=ec,M[21]=H,M[22]=V,M[23]=W,M[24]=O,M[25]=B,M[26]=eu,M[27]=e.plugins,M[28]=ed,M[29]=J,M[30]=t):t=M[30],y=t}let ef=y,eh=z?"dark":"light",ey=ei?"":void 0,em=en?"":void 0;return M[31]!==ea||M[32]!==G?(g=(0,f.jsx)(lk,{documentIds:ea,perspective:G}),M[31]=ea,M[32]=G,M[33]=g):g=M[33],M[34]!==$||M[35]!==O||M[36]!==R||M[37]!==Q||M[38]!==X||M[39]!==et?(v=(0,f.jsx)(lS,{comlink:$,dispatch:D,inFrame:O,inPopUp:R,onDrag:et,overlayEnabled:Q,rootElement:X}),M[34]=$,M[35]=O,M[36]=R,M[37]=Q,M[38]=X,M[39]=et,M[40]=v):v=M[40],M[41]!==U?(b=U&&(0,f.jsx)(aq,{...U,onDismiss:el}),M[41]=U,M[42]=b):b=M[42],M[43]!==Z||M[44]!==q||M[45]!==H||M[46]!==F||M[47]!==B?(x=B&&!H&&(0,f.jsxs)(f.Fragment,{children:[q&&(0,f.jsx)(le,{dragInsertPosition:q}),F&&(0,f.jsx)(ls,{}),Z&&(0,f.jsx)(a7,{dragGroupRect:Z})]}),M[43]=Z,M[44]=q,M[45]=H,M[46]=F,M[47]=B,M[48]=x):x=M[48],M[49]!==Y||M[50]!==B?(w=B&&Y&&(0,f.jsx)(ln,{skeleton:Y}),M[49]=Y,M[50]=B,M[51]=w):w=M[51],M[52]!==ef||M[53]!==ey||M[54]!==em||M[55]!==g||M[56]!==v||M[57]!==b||M[58]!==x||M[59]!==w||M[60]!==P?(_=(0,f.jsxs)(lE,{"data-fading-out":ey,"data-overlays":em,ref:K,$zIndex:P,children:[g,v,b,ef,x,w]}),M[52]=ef,M[53]=ey,M[54]=em,M[55]=g,M[56]=v,M[57]=b,M[58]=x,M[59]=w,M[60]=P,M[61]=_):_=M[61],M[62]!==$||M[63]!==_?(E=(0,f.jsx)(ly,{comlink:$,children:_}),M[62]=$,M[63]=_,M[64]=E):E=M[64],M[65]!==$||M[66]!==E?(j=(0,f.jsx)(lu,{comlink:$,children:E}),M[65]=$,M[66]=E,M[67]=j):j=M[67],M[68]!==$||M[69]!==W||M[70]!==j?(k=(0,f.jsx)(lp,{comlink:$,elements:W,children:j}),M[68]=$,M[69]=W,M[70]=j,M[71]=k):k=M[71],M[72]!==X||M[73]!==k?(S=(0,f.jsx)(tG.XS,{children:(0,f.jsx)(tG.GD,{element:X,children:k})}),M[72]=X,M[73]=k,M[74]=S):S=M[74],M[75]!==eh||M[76]!==S?(I=(0,f.jsx)(tG.NP,{scheme:eh,theme:tG.Qx,tone:"transparent",children:S}),M[75]=eh,M[76]=S,M[77]=I):I=M[77],M[78]!==$||M[79]!==I?(T=(0,f.jsx)(lv,{comlink:$,children:I}),M[78]=$,M[79]=I,M[80]=T):T=M[80],T}function lT(e){return e.activated||e.focused}function lM(e){return"id"in e.sanity?[e.sanity.id]:[]}function l$(e){return!e}function lA(e){return!e}function lC(e){return!e}function lO(e){return!e}function lR(e){let t=e.target;if(((0,tG.nY)(t)||(0,tG.sb)(t)&&t.closest("a"))&&e.altKey){e.preventDefault(),e.stopPropagation();let t=new MouseEvent(e.type,{...e,altKey:!1,bubbles:!0,cancelable:!0});e.target?.dispatchEvent(t)}}function lP(e){return e()}function lN(e){return!e}let lz={alt:"altKey",ctrl:"ctrlKey",mod:"u">typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function lL(e){return"Alt"===e.key}function lD(e,t){return e.filter(e=>e!==t)}let lU=e=>{let t,n,r=(0,m.c)(4),{comlink:i,refresh:o}=e,s=(0,h.useRef)(0),a=(0,h.useRef)(0);return r[0]!==i||r[1]!==o?(t=()=>i.on("presentation/refresh",e=>{if("manual"===e.source){clearTimeout(s.current);
216let t=o(e);if(!1===t)return;i.post("visual-editing/refreshing",e);let n=!1;s.current=window.setTimeout(()=>{i.post("visual-editing/refreshed",e),n=!0},3e3),t?.finally?.(()=>{n||(clearTimeout(s.current),i.post("visual-editing/refreshed",e))})}else if("mutation"===e.source){clearTimeout(a.current);let t=o(e);if(!1===t)return;i.post("visual-editing/refreshing",e),a.current=window.setTimeout(()=>{let t=o(e);!1!==t&&(i.post("visual-editing/refreshing",e),t?.finally?.(()=>{i.post("visual-editing/refreshed",e)})||i.post("visual-editing/refreshed",e))},1e3),t?.finally?.(()=>{i.post("visual-editing/refreshed",e)})||i.post("visual-editing/refreshed",e)}}),n=[i,o],r[0]=i,r[1]=o,r[2]=t,r[3]=n):(t=r[2],n=r[3]),(0,h.useEffect)(t,n),null};function lq(e){let{data:t,origin:n}=e;t&&"object"==typeof t&&"domain"in t&&"sanity/channels"===t.domain&&"from"in t&&"presentation"===t.from&&"type"in t&&"presentation/status"===t.type&&window.parent.postMessage({domain:"sanity/channels",type:"visual-editing/status",data:{origin:location.origin}},n)}function lV(){console.warn("[@sanity/visual-editing] Package version mismatch detected: Please update your Sanity studio to prevent potential compatibility issues.")}function lF(){}let lY=e=>{let t,n,r,i,o,s,a,l,u=(0,m.c)(24),{components:c,plugins:d,history:p,portal:y,refresh:g,zIndex:v,onPerspectiveChange:b}=e,x=void 0===y||y,[w,_]=(0,h.useState)(null),[E,j]=(0,h.useState)(null);u[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{(0,h.startTransition)(()=>{_(tF()),j(tY())})},n=[],u[0]=t,u[1]=n):(t=u[0],n=u[1]),(0,h.useEffect)(t,n);let[k,S]=(0,h.useState)(null);u[2]!==x?(r=()=>{if(!1===x)return;let e=document.createElement("sanity-visual-editing");return document.documentElement.appendChild(e),(0,h.startTransition)(()=>S(e)),()=>{(0,h.startTransition)(()=>S(null)),document.documentElement.contains(e)&&document.documentElement.removeChild(e)}},i=[x],u[2]=x,u[3]=r,u[4]=i):(r=u[3],i=u[4]),(0,h.useEffect)(r,i);let[I,T]=function(e){let t,n,r,i,o,s=(0,m.c)(9),a=void 0===e||e,[l,u]=(0,h.useState)(),[c,d]=(0,h.useState)("idle");return s[0]!==a?(t=()=>{if(!a)return;let e=tN({name:"visual-editing",connectTo:"presentation"},tP().provide({actors:tV()})),t=e.onStatus(()=>d("connected"),"connected");(0,h.startTransition)(()=>u(e));let n=e.start();return()=>{t(),n(),(0,h.startTransition)(()=>u(void 0))}},n=[a],s[0]=a,s[1]=t,s[2]=n):(t=s[1],n=s[2]),(0,h.useEffect)(t,n),s[3]!==c?(r=()=>{if("connected"===c)return;let e=new AbortController;return window.addEventListener("message",lq,{signal:e.signal}),()=>{e.abort()}},i=[c],s[3]=c,s[4]=r,s[5]=i):(r=s[4],i=s[5]),(0,h.useEffect)(r,i),s[6]!==l||s[7]!==c?(o=[l,c],s[6]=l,s[7]=c,s[8]=o):o=s[8],o}(!0===w||!0===E);!function(e){let t,n,r=(0,m.c)(3);r[0]!==e?(t=()=>{if(!e)return;let t=function(e){let t=new i1.m(1),n=new i2.B;return e.fetch("visual-editing/snapshot-welcome",void 0,{suppressWarnings:!0}).then(e=>{t.next(e.event)}).catch(()=>{}
216),e.on("presentation/snapshot-event",e=>{"reconnect"===e.event.type&&t.next(e.event),"mutation"===e.event.type&&n.next(e.event)}),(0,i3.h)(t,n)}(e),n=J(aS(e),{input:{client:{withConfig:lF},sharedListener:t}});n.start();let r=new AbortController;return e.fetch("visual-editing/features",void 0,{signal:r.signal,suppressWarnings:!0}).then(e=>{e.features.optimistic&&function(e){for(let t of(ni=e,no))t()}(n)}).catch(lV),()=>{n.stop(),r.abort()}},n=[e],r[0]=e,r[1]=t,r[2]=n):(t=r[1],n=r[2]),(0,h.useEffect)(t,n)}("connected"===T?I:void 0),u[5]!==I||u[6]!==T||u[7]!==c||u[8]!==w||u[9]!==E||u[10]!==b||u[11]!==d||u[12]!==v?(o=null!==w&&null!==E&&(0,f.jsx)(lI,{comlink:I,comlinkStatus:T,componentResolver:c,onPerspectiveChange:b,plugins:d,inFrame:w,inPopUp:E,zIndex:v}),u[5]=I,u[6]=T,u[7]=c,u[8]=w,u[9]=E,u[10]=b,u[11]=d,u[12]=v,u[13]=o):o=u[13],u[14]!==I||u[15]!==p||u[16]!==g?(s=I&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(aI,{comlink:I,history:p}),(0,f.jsx)(aT,{comlink:I}),g&&(0,f.jsx)(lU,{comlink:I,refresh:g})]}),u[14]=I,u[15]=p,u[16]=g,u[17]=s):s=u[17],u[18]!==o||u[19]!==s?(a=(0,f.jsxs)(f.Fragment,{children:[o,s]}),u[18]=o,u[19]=s,u[20]=a):a=u[20];let M=a;return!1!==x&&k?(u[21]!==M||u[22]!==k?(l=(0,tW.createPortal)(M,k),u[21]=M,u[22]=k,u[23]=l):l=u[23],l):M};lY.displayName="VisualEditing";let lW=null,lB=null,lG=null;function lJ(e,{components:t,history:n,refresh:r,zIndex:i,plugins:o,onPerspectiveChange:s}){lG&&clearTimeout(lG),e.addEventListener("abort",()=>{lG=setTimeout(()=>{lB&&(lB.unmount(),lB=null),lW&&(lW.parentNode.removeChild(lW),lW=null)},1e3)}),lW||(lW=document.createElement("sanity-visual-editing"),document.body.parentNode.insertBefore(lW,document.body.nextSibling)),lB||(lB=(0,y.createRoot)(lW)),lB.render((0,f.jsx)(h.StrictMode,{children:(0,f.jsx)(lY,{components:t,plugins:o,history:n,refresh:r,zIndex:i,onPerspectiveChange:s,portal:!1})}))}},77616:(e,t,n)=>{e.exports=n(23190)}}]);

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.