@nice-code/commander 0.93.0 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/build/client/assets/index-7N0rwKz3.css +1 -0
- package/build/client/assets/index-RJ2tYN8w.js +23 -0
- package/build/client/assets/index-RJ2tYN8w.js.map +1 -0
- package/build/client/index.html +2 -2
- package/package.json +7 -6
- package/build/client/assets/index-BbXO3YnY.js +0 -23
- package/build/client/assets/index-BbXO3YnY.js.map +0 -1
- package/build/client/assets/index-DnkKT_BD.css +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var S={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function ne(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function re(e,t){return ne(e.type,t,e.props)}function ie(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ae(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var oe=/\/+/g;function se(e,t){return typeof e==`object`&&e&&e.key!=null?ae(``+e.key):t.toString(36)}function ce(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function w(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,w(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+se(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(oe,`$&/`)+`/`),w(o,r,i,``,function(e){return e})):o!=null&&(ie(o)&&(o=re(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(oe,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+se(a,u),c+=w(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+se(a,u++),c+=w(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return w(ce(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function T(e,t,n){if(e==null)return e;var r=[],i=0;return w(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function E(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},D={map:T,forEach:function(e,t,n){T(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return T(e,function(){t++}),t},toArray:function(e){return T(e,function(e){return e})||[]},only:function(e){if(!ie(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=D,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!C.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return ne(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)C.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return ne(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ie,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:E}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}},e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=c(u(),1),f=function(e){return e.context_unhydrated=`context_unhydrated`,e.hydrate_domain_mismatch=`hydrate_domain_mismatch`,e.from_context_empty=`from_context_empty`,e.handler_returned_promise_in_sync=`handler_returned_promise_in_sync`,e}({}),p;function m(e){p=e}function h(e,t){return p==null?Error(`[nice-error:${e}]${t==null?``:` ${JSON.stringify(t)}`}`):p(e,t)}function g(e){return e.def}function _(e,t=!0){if(e instanceof Error)return Object.assign(e,{message:e.message});let n=e?.message??(typeof e==`string`?e:`No error message found`);return t&&console.error(`An unknown and unstructured error was thrown: ${n}`,e),{...Error(n),...e}}var v={warn:(e,t)=>t===void 0?console.warn(e):console.warn(e,t),debug:(e,t)=>t===void 0?console.debug(e):console.debug(e,t),error:(e,t)=>t===void 0?console.error(e):console.error(e,t)};function y(){return v}var b=`NE_DUROBJ[[`,x=`]]NE_DUROBJ`,ee=`err_cast_not_nice`,te=function(e){return e.no_pack=`no_pack`,e.msg_pack=`msg_pack`,e.cause_pack=`cause_pack`,e}({}),S=e=>(e._packedState={cause:e.cause,packedAs:te.cause_pack},e.cause=`${b}${JSON.stringify(e.toJsonObject())}${x}`,e),C=e=>(e._packedState={message:e.cleanMessage,packedAs:te.msg_pack},e.message=`${b}${JSON.stringify(e.toJsonObject())}${x}`,e),ne=(e,t=`msg_pack`)=>t===`no_pack`?e:t===`msg_pack`?C(e):S(e),re=4;function ie(e){if(e instanceof Error)return!0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}function ae(e,t=re){if(e==null)return e;if(ie(e)){let n={name:e.name,message:e.message,stack:e.stack},r=e.errors;return Array.isArray(r)&&(n.errors=t>0?r.map(e=>ae(e,t-1)):[]),e.cause!=null&&t>0&&(n.cause=ae(e.cause,t-1)),n}try{return JSON.stringify(e),e}catch{return String(e)}}var oe=function(e){return e.serde_unset=`serde_unset`,e.unhydrated=`unhydrated`,e.hydrated=`hydrated`,e}({}),se=class extends Error{name=`NiceError`;def;ids;httpStatusCode;timeCreated;cleanMessage;originError;_packedState;_errorDataMap;constructor(e){let t=e.message,n=`[${e.def.domain}](${e.ids.join(`,`)}) ${t}`;super(n),this.cleanMessage=t,this.def=e.def,this.ids=e.ids,this._errorDataMap=e.errorData,this.httpStatusCode=e.httpStatusCode??500,e.originError!=null&&(this.originError=e.originError),this.timeCreated=e.timeCreated??Date.now()}get isUnhandled(){return this.def.domain===ee}hasId(e){return e in this._errorDataMap}hasOneOfIds(e){return e.some(e=>e in this._errorDataMap)}get hasMultiple(){return Object.keys(this._errorDataMap).length>1}getIds(){return Object.keys(this._errorDataMap)}getContext(e){let t=this._errorDataMap[e]?.contextState;if(t!=null){if(t.kind===`unhydrated`)throw h(f.context_unhydrated,{id:String(e)});return t.value}}getErrorDataForId(e){return this._errorDataMap[e]}withOriginError(e){return this.originError=_(e),this._packedState?.packedAs!==te.cause_pack&&(this.cause=this.originError),this}matches(e){let t=g(this),n=g(e);if(t.domain!==n.domain)return!1;let r=this.getIds().map(String).sort(),i=e.getIds().map(String).sort();return r.length===i.length?r.every((e,t)=>e===i[t]):!1}toJsonObject(){let e=this.originError?{name:this.originError.name,message:this.originError.cleanMessage??this.originError.message,stack:this.originError.stack,cause:ae(this.originError.cause),...Array.isArray(this.originError.errors)?{errors:this.originError.errors.map(e=>ae(e))}:{}}:void 0,t={domain:this.def.domain,allDomains:this.def.allDomains};this.def.defaultHttpStatusCode!=null&&(t.defaultHttpStatusCode=this.def.defaultHttpStatusCode),this.def.defaultMessage!=null&&(t.defaultMessage=this.def.defaultMessage);let n={};for(let e of Object.keys(this._errorDataMap)){let t=e,r=this._errorDataMap[t];if(r==null)continue;let i;i=r.contextState.kind===oe.hydrated?{kind:oe.unhydrated,serialized:r.contextState.serialized}:r.contextState,n[t]={contextState:i,message:r.message,httpStatusCode:r.httpStatusCode,timeAdded:r.timeAdded}}return{name:`NiceError`,def:t,ids:this.ids,errorData:n,isUnhandled:this.isUnhandled,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,timeCreated:this.timeCreated,...this.stack==null?{}:{stack:this.stack},originError:e}}toJSON(){return this.toJsonObject()}toWireJsonObject(){let{stack:e,originError:t,...n}=this.toJsonObject();return n}toStructuredLog(){return{domain:this.def.domain,ids:this.getIds().map(String),message:this.cleanMessage,httpStatusCode:this.httpStatusCode,isUnhandled:this.isUnhandled,timeCreated:this.timeCreated,...this.originError==null?{}:{originError:this.originError}}}toJsonString(){return JSON.stringify(this.toJsonObject())}toHttpResponse(){return new Response(this.toJsonString(),{status:this.httpStatusCode,headers:{"Content-Type":`application/json`}})}hydrate(e){return e.hydrate(this)}handleWithSync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise&&y().warn(h(f.handler_returned_promise_in_sync,{identifier:n.target.identifier}).message),n.isPromise?void 0:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}async handleWithAsync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise?await n.handlerPromise:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}get isPacked(){return this._packedState!=null}pack(e=`msg_pack`){return this.isPacked?this:ne(this,e)}unpack(){return this._packedState==null?this:(this._packedState.packedAs===te.msg_pack&&(this.message=this._packedState.message),this._packedState.packedAs===te.cause_pack&&(this.cause=this._packedState.cause),this._packedState=void 0,delete this._packedState,this)}},ce=class e extends se{def;niceErrorDefined;constructor(e){super(e),this.def=e.def,this.niceErrorDefined=e.niceErrorDefined}addContext(t){let n=Object.keys(t),r={};for(let e of n)r[e]=this.niceErrorDefined.reconcileErrorDataForId(e,t[e]);let i={...this._errorDataMap,...r},a=Array.from(new Set([...this.getIds(),...Object.keys(t)]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:a,errorData:i,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}addId(...t){let[n,r]=t,i=this.niceErrorDefined.reconcileErrorDataForId(n,r),a={};a[n]=i;let o={...this._errorDataMap,...a},s=Array.from(new Set([...this.getIds(),n]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:s,errorData:o,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}},w=new Set;function T(e){if(w.size!==0)for(let t of w)try{t(e)}catch{}}var E=class e{domain;allDomains;defaultHttpStatusCode;defaultMessage;_schema;_definedChildNiceErrors=[];_definedParentNiceError;_setPack;_packAsFn;constructor(e){this.domain=e.domain,this.allDomains=e.allDomains,this._schema=e.schema,e.packAs!=null&&(this._packAsFn=e.packAs),e.defaultHttpStatusCode!=null&&(this.defaultHttpStatusCode=e.defaultHttpStatusCode),e.defaultMessage!=null&&(this.defaultMessage=e.defaultMessage)}createChildDomain(t){let n=new e({domain:t.domain,allDomains:[t.domain,...this.allDomains],schema:t.schema,defaultHttpStatusCode:t.defaultHttpStatusCode,defaultMessage:t.defaultMessage});return this.addChildNiceErrorDomain(n),n.addParentNiceErrorDomain(this),t.packAs==null?this._setPack?n.packAs(this._setPack):this._packAsFn&&(n._packAsFn=this._packAsFn):n._packAsFn=t.packAs,n}addParentNiceErrorDomain(e){this._definedParentNiceError?.domain!==e.domain&&(this._definedParentNiceError={domain:e.domain,definedError:e})}addChildNiceErrorDomain(e){this._definedChildNiceErrors.some(t=>t.domain===e.domain)||(this._definedChildNiceErrors.push({domain:e.domain,definedError:e}),this._definedParentNiceError&&this._definedParentNiceError.definedError.addChildNiceErrorDomain(e))}packAs(e){return this._setPack=e,this}createError(e){let t=new ce(e);T(t);let n=this._setPack??this._packAsFn?.();return n!=null&&n!==`no_pack`?t.pack(n):t}hydrate(e){let t=g(e);if(t.domain!==this.domain)throw h(f.hydrate_domain_mismatch,{expected:this.domain,received:t.domain});let n=e instanceof se?e:new se(e),r={};for(let e of n.getIds()){let t=n.getErrorDataForId(e);if(t==null)continue;let i=t.contextState;if(i.kind===`unhydrated`){let t=this._schema[e]?.context?.serialization?.fromJsonSerializable;t!=null&&(i={kind:oe.hydrated,value:t(i.serialized),serialized:i.serialized})}r[e]={contextState:i,message:t.message,httpStatusCode:t.httpStatusCode,timeAdded:t.timeAdded}}return new ce({def:this._buildDef(),niceErrorDefined:this,ids:n.ids,errorData:r,message:n.cleanMessage??n.message,httpStatusCode:n.httpStatusCode,originError:n.originError,timeCreated:n.timeCreated})}fromId(...e){let[t,n]=e,r=this.reconcileErrorDataForId(t,n),i={};i[t]=r;let a=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:[t],errorData:i,message:r.message,httpStatusCode:r.httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(a,this.fromId),a}fromContext(e){let t=Object.keys(e);if(t.length===0)throw h(f.from_context_empty,void 0);let n={};for(let r of t)n[r]=this.reconcileErrorDataForId(r,e[r]);let r=t[0],i=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:t,errorData:n,message:n[r].message,httpStatusCode:n[r].httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(i,this.fromContext),i}isExact(e){return e instanceof se?g(e).domain===this.domain:!1}isThisOrChild(e){if(!(e instanceof se))return!1;let t=g(e);return t.domain===this.domain||this.allDomains.includes(t.domain)}isParentOf(e){let t=e instanceof se?g(e).allDomains:e.allDomains;return Array.isArray(t)&&t.includes(this.domain)}_buildDef(){return{domain:this.domain,allDomains:this.allDomains,schema:this._schema}}_resolveMessage(e,t){let n=this._schema[e];return typeof n?.message==`function`?n.message(t):typeof n?.message==`string`?n.message:this.defaultMessage??`[${this.domain}::${e}] An error occurred.`}_resolveHttpStatusCode(e,t){let n=this._schema[e],r;return typeof n?.httpStatusCode==`function`&&(r=n.httpStatusCode(t)),typeof n?.httpStatusCode==`number`&&(r=n.httpStatusCode),typeof r==`number`?r:this.defaultHttpStatusCode??500}reconcileErrorDataForId(e,t){let n=this._resolveMessage(e,t),r=this._resolveHttpStatusCode(e,t),i=this._schema[e],a;if(t!=null&&i?.context?.serialization!=null){let e=i.context.serialization.toJsonSerializable(t);a={kind:oe.hydrated,value:t,serialized:e}}else a={kind:oe.serde_unset,value:t};return{contextState:a,message:n,httpStatusCode:r,timeAdded:Date.now()}}},le=e=>new E({domain:e.domain,allDomains:[e.domain],schema:e.schema,...e.packAs==null?{}:{packAs:e.packAs}});function D(e){return e??{}}var ue=422,de=500,fe=le({domain:`err_nice`,schema:{}}),O=function(e){return e.js_error=`native_error`,e.js_error_like_object=`js_error_like_object`,e.nullish_value=`nullish_value`,e.js_data_type=`js_data_type`,e.js_other=`js_other`,e}({}),pe=fe.createChildDomain({domain:`err_cast_not_nice`,defaultHttpStatusCode:ue,schema:{native_error:D({context:{required:!0},message:({jsError:e})=>`A native JavaScript Error was encountered during casting: ${e.message}`,httpStatusCode:de}),js_error_like_object:D({context:{required:!0},message:({jsErrorObject:e})=>`An object resembling a JavaScript Error was encountered during casting: [${e.name}] ${e.message}`,httpStatusCode:de}),nullish_value:D({context:{required:!0},message:({value:e})=>`A nullish value [${e===null?`null`:`undefined`}] was encountered during casting`}),js_data_type:D({context:{required:!0},message:({jsDataType:e,jsDataValue:t})=>{let n;try{n=JSON.stringify(t)}catch{}return`A value of type [${e}] with value [${n??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}}),js_other:D({context:{required:!0},message:({jsDataValue:e})=>{let t;try{t=JSON.stringify(e)}catch{}return`An unhandled type [${typeof e}] with value [${t??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}})}});fe.createChildDomain({domain:`err_nice_handler`,schema:{}});var me=fe.createChildDomain({domain:`err_nice_error`,defaultHttpStatusCode:de,schema:{[f.context_unhydrated]:D({context:{required:!0},message:({id:e})=>`[NiceError.getContext] Context for id "${e}" is in the "unhydrated" state. The error was reconstructed from a serialized payload but has not been deserialized yet. Call \`niceErrorDomain.hydrate(error)\` to reconstruct the typed context.`}),[f.hydrate_domain_mismatch]:D({context:{required:!0},message:({expected:e,received:t})=>`[NiceErrorDomain.hydrate] Domain mismatch: this definition is "${e}" but the error belongs to "${t}". Call \`niceErrorDomain.isExact(error)\` before hydrating to ensure compatibility.`}),[f.from_context_empty]:D({message:`[NiceErrorDomain.fromContext] context object must contain at least one error id.`}),[f.handler_returned_promise_in_sync]:D({context:{required:!0},message:({identifier:e})=>`[NiceError.handleWithSync] Handler ${e} returned a Promise but was called via \`handleWithSync\` (synchronous). The Promise will not be awaited. Use \`handleWithAsync\` for async handlers.`})}});m((e,t)=>me.fromId(e,t));function he(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.name!==`NiceError`||typeof t.message!=`string`||typeof t.isUnhandled!=`boolean`||typeof t.httpStatusCode!=`number`)return!1;let n=t.def;if(typeof n!=`object`||!n)return!1;let r=n;if(typeof r.domain!=`string`||!Array.isArray(r.allDomains))return!1;let i=t.errorData;if(i!=null){if(typeof i!=`object`)return!1;for(let e of Object.values(i)){if(e==null)continue;if(typeof e!=`object`)return!1;let t=e.contextState;if(typeof t!=`object`||!t)return!1;let n=t.kind;if(n!==oe.serde_unset&&n!==oe.unhydrated)return!1}}return!0}function ge(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}var k=function(e){return e.nullish=`nullish`,e.niceErrorObject=`niceErrorObject`,e.niceError=`niceError`,e.jsError=`jsError`,e.jsErrorObject=`jsErrorObject`,e.jsDataType=`jsDataType`,e.jsOther=`jsOther`,e}({});function _e(e){let t;if(typeof e.message==`string`&&e.message.includes(`NE_DUROBJ[[`)&&e.message.includes(`]]NE_DUROBJ`)&&(t=e.message),typeof e.cause==`string`&&e.cause.includes(`NE_DUROBJ[[`)&&e.cause.includes(`]]NE_DUROBJ`)&&(t=e.cause),t!=null){let e=t.split(b)[1].split(x)[0];try{let t=JSON.parse(e);if(he(t))return{type:k.niceErrorObject,niceErrorObject:t}}catch{}}return null}var ve=e=>{if(e==null)return{type:k.nullish,value:e};if(typeof e==`number`)return{type:k.jsDataType,jsDataType:`number`,jsDataValue:e};if(typeof e==`boolean`)return{type:k.jsDataType,jsDataType:`boolean`,jsDataValue:e};let t=e;if(typeof e==`string`)if(e.includes(`{`)&&e.includes(`name`))try{t=JSON.parse(e)}catch{return{type:k.jsDataType,jsDataType:`string`,jsDataValue:e}}else return{type:k.jsDataType,jsDataType:`string`,jsDataValue:e};return typeof t!=`object`||!t?(y().warn(`Received a potential error that is a primitive data type other than string, number, or boolean. This is unexpected and may indicate an issue with error handling in the code.`,{potentialError:e}),{jsDataValue:e,type:k.jsOther}):t instanceof se?{type:k.niceError,niceError:t}:he(t)?{type:k.niceErrorObject,niceErrorObject:t}:t instanceof Error?_e(t)??{type:k.jsError,jsError:t}:ge(t)?_e(t)??{type:k.jsErrorObject,jsErrorObject:t}:{type:k.jsDataType,jsDataType:`object`,jsDataValue:t}},ye=e=>{let t=ve(e);switch(t.type){case k.niceError:return t.niceError;case k.niceErrorObject:{let e=t.niceErrorObject;return new se(e)}case k.jsError:return pe.fromContext({[O.js_error]:t}).withOriginError(t.jsError);case k.jsErrorObject:{let e=pe.fromContext({[O.js_error_like_object]:t});return e.cause=t.jsErrorObject,e}case k.nullish:return pe.fromContext({[O.nullish_value]:t});case k.jsDataType:return pe.fromContext({[O.js_data_type]:t});default:return pe.fromContext({[O.js_other]:t})}};async function be(e){try{return{ok:!0,output:await e()}}catch(e){return{ok:!1,error:ye(e)}}}var xe=function(e){return e.unsafe_css_value=`unsafe_css_value`,e.alpha_derivation_unsupported=`alpha_derivation_unsupported`,e.style_reference_unreadable=`style_reference_unreadable`,e.contrast_failed=`contrast_failed`,e}({}),Se=fe.createChildDomain({domain:`err_ui`,schema:{unsafe_css_value:D({message:({property:e,value:t})=>`nice-ui refused to emit ${e}: the value contains CSS-terminating characters (${JSON.stringify(t)}). A theme compiled from an untrusted document cannot be allowed to close a declaration and open its own.`}),alpha_derivation_unsupported:D({message:({value:e})=>`nice-ui cannot derive alpha from ${JSON.stringify(e)}: a 6-digit hex colour is required. Appending alpha to an rgb()/rgba() value produces a string that is not a colour at all, and the style silently drops.`}),style_reference_unreadable:D({message:({reason:e,line:t,column:n})=>`nice-ui could not read the style reference: ${e}`+(t==null?``:` (line ${t}${n==null?``:`, column ${n}`})`)}),contrast_failed:D({message:({pairs:e,scheme:t})=>`nice-ui: ${e.length} contrast pair(s) fail in the ${t} scheme with no ledger entry: ${e.slice(0,5).join(`, `)}${e.length>5?`, …`:``}.`})}}),Ce=`textEmphasis.textSecondary.textMuted.textFaint.semanticError.semanticSuccess.semanticSystem.semanticWarning.semanticMetadata.primary.onPrimary.errorSurface.onErrorSurface.surfaceVoid.surfaceBase.surfaceSelected.surfaceDetail.surfaceDetailHeader.surfaceSection.surfaceSectionAlt.borderPanel.borderDivider.dialogBackdrop.tooltipBackground.tooltipTitleBackground.tooltipTitleBorder.tooltipBorder.jsonKey.jsonString.jsonNumber.jsonKeyword.jsonPunctuation.scrollbarThumb.scrollbarThumbHover.focusRing`.split(`.`);new Set(Ce);var we=`data-nice-ui-scheme`,Te=`data-nice-ui-scheme-source`,Ee=`--nice-ui`;function De(e){return`${Ee}-${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function Oe(e){return`${Ee}-lane-accent-${e}`}var ke=/[;{}<>\\]|\/\*|\*\//;function Ae(e,t){if(ke.test(t))throw Se.fromId(xe.unsafe_css_value,{property:e,value:t});return`${e}: ${t};`}function je(e,t){let n=e.schemes[t],r=[];for(let e of Ce)r.push(Ae(De(e),n[e]));return n.laneAccents.forEach((e,t)=>{r.push(Ae(Oe(t),e))}),r.push(Ae(`${Ee}-lane-accent-count`,String(n.laneAccents.length))),r.push(Ae(`color-scheme`,t)),r}function Me(e,t){if(!Number.isFinite(t))throw Se.fromId(xe.unsafe_css_value,{property:e,value:String(t)});return`${e}: ${t}px;`}function Ne(e,t){return[e,...t].map(e=>/^[a-zA-Z][a-zA-Z0-9-]*$/.test(e)?e:`'${e.replace(/'/g,``)}'`).join(`, `)}function Pe(e){let t=[];for(let[n,r]of Object.entries(e.typography)){let e=`${Ee}-font-${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;t.push(Ae(`${e}-family`,Ne(r.fontFamily,r.fontFamilyFallbacks))),t.push(Me(`${e}-size`,r.fontSize)),t.push(Ae(`${e}-weight`,r.fontWeight)),t.push(Me(`${e}-line-height`,r.lineHeight)),r.letterSpacing!=null&&t.push(Me(`${e}-letter-spacing`,r.letterSpacing))}for(let[n,r]of Object.entries(e.rounded))t.push(Me(`${Ee}-rounded-${n}`,r));for(let[n,r]of Object.entries(e.spacing))t.push(Me(`${Ee}-space-${n}`,r));for(let[n,r]of Object.entries(e.elevation))t.push(Me(`${Ee}-elevation-${n}-offset-y`,r.offsetY)),t.push(Me(`${Ee}-elevation-${n}-blur`,r.blur)),t.push(Me(`${Ee}-elevation-${n}-spread`,r.spread));return t}function Fe(e,t){return`${e} {\n ${t.join(`
|
|
2
|
+
`)}\n}`}function Ie(e,t=``){let n=e=>`${t}[${we}="${e}"]`,r=Pe(e);return[Fe(`${n(`light`)}, ${n(`dark`)}, ${n(`system`)}`,r),Fe(n(`light`),je(e,`light`)),Fe(n(`dark`),je(e,`dark`)),Fe(n(`system`),[...je(e,`light`).filter(e=>!e.startsWith(`color-scheme`)),Ae(`color-scheme`,`light dark`)]),`@media (prefers-color-scheme: dark) {\n${Fe(n(`system`),je(e,`dark`).filter(e=>!e.startsWith(`color-scheme`))).split(`
|
|
3
|
+
`).map(e=>` ${e}`).join(`
|
|
4
|
+
`)}\n}`].join(`
|
|
5
|
+
|
|
6
|
+
`)}var Le=`ui-monospace`,Re=[`Cascadia Code`,`Source Code Pro`,`monospace`],ze=`ui-sans-serif`,Be=[`system-ui`,`sans-serif`],Ve={name:`nice-code`,schemes:{light:{textEmphasis:`#0f172a`,textSecondary:`#334155`,textMuted:`#4b5563`,textFaint:`#64748b`,semanticError:`#b91c1c`,semanticSuccess:`#3f6212`,semanticSystem:`#0369a1`,semanticWarning:`#9a3412`,semanticMetadata:`#52525b`,primary:`#0369a1`,onPrimary:`#ffffff`,errorSurface:`#fef2f2`,onErrorSurface:`#991b1b`,surfaceVoid:`#e2e8f0`,surfaceBase:`#ffffff`,surfaceSelected:`#dbeafe`,surfaceDetail:`#f8fafc`,surfaceDetailHeader:`#f1f5f9`,surfaceSection:`#f1f5f9`,surfaceSectionAlt:`#e9eef5`,borderPanel:`#cbd5e1`,borderDivider:`#475569`,dialogBackdrop:`rgba(15, 23, 42, 0.35)`,tooltipBackground:`#ffffff`,tooltipTitleBackground:`#f1f5f9`,tooltipTitleBorder:`#e2e8f0`,tooltipBorder:`#94a3b8`,jsonKey:`#4338ca`,jsonNumber:`#065f46`,jsonString:`#854d0e`,jsonKeyword:`#6d28d9`,jsonPunctuation:`#334155`,scrollbarThumb:`#64748b`,scrollbarThumbHover:`#334155`,focusRing:`#0369a1`,laneAccents:[`#6d28d9`,`#a16207`,`#0f766e`,`#be185d`,`#be123c`,`#4338ca`]},dark:{textEmphasis:`#f1f5f9`,textSecondary:`#cbd5e1`,textMuted:`#8b9bb4`,textFaint:`#334155`,semanticError:`#FF5C5C`,semanticSuccess:`#A3E635`,semanticSystem:`#38BDF8`,semanticWarning:`#FB923C`,semanticMetadata:`#A1A1AA`,primary:`#38BDF8`,onPrimary:`#0f172a`,errorSurface:`#1e0a0a`,onErrorSurface:`#FF5C5C`,surfaceVoid:`#05070d`,surfaceBase:`#0f172a`,surfaceSelected:`#1d2942`,surfaceDetail:`#0d1729`,surfaceDetailHeader:`#131f35`,surfaceSection:`#1e293b`,surfaceSectionAlt:`#0d131f`,borderPanel:`#1e293b`,borderDivider:`#64748b`,dialogBackdrop:`rgba(2, 6, 12, 0.65)`,tooltipBackground:`#0c1526`,tooltipTitleBackground:`#101b2e`,tooltipTitleBorder:`#211f5f`,tooltipBorder:`#312e81`,jsonKey:`#a5b4fc`,jsonString:`#fbbf24`,jsonNumber:`#34d399`,jsonKeyword:`#a78bfa`,jsonPunctuation:`#475569`,scrollbarThumb:`#6b7b93`,scrollbarThumbHover:`#94a3b8`,focusRing:`#38BDF8`,laneAccents:[`#a78bfa`,`#fbbf24`,`#2dd4bf`,`#f472b6`,`#fb7185`,`#818cf8`]}},defaultScheme:`dark`,typography:{headline:{fontFamily:Le,fontFamilyFallbacks:Re,fontSize:14,fontWeight:`600`,lineHeight:20},body:{fontFamily:ze,fontFamilyFallbacks:Be,fontSize:13,fontWeight:`400`,lineHeight:18},bodySmall:{fontFamily:ze,fontFamilyFallbacks:Be,fontSize:11,fontWeight:`400`,lineHeight:16},code:{fontFamily:Le,fontFamilyFallbacks:Re,fontSize:12,fontWeight:`500`,lineHeight:16},label:{fontFamily:Le,fontFamilyFallbacks:Re,fontSize:10,fontWeight:`700`,lineHeight:12,letterSpacing:.5},chrome:{fontFamily:Le,fontFamilyFallbacks:Re,fontSize:12,fontWeight:`500`,lineHeight:16}},rounded:{sm:2,base:4,md:6,lg:8,xl:12,full:9999},spacing:{xxs:2,xs:4,sm:8,md:12,lg:16},elevation:{raised:{offsetY:1,blur:2,spread:0},overlay:{offsetY:4,blur:12,spread:-2}}};function A(e){return`var(${De(e)})`}function He(e){return`var(${Oe(e)})`}var Ue=Ve.schemes.dark.laneAccents.length;function We(e=Ue){return Array.from({length:e},(e,t)=>He(t))}function Ge(e){return`var(--nice-ui-space-${e})`}function Ke(e){return`var(--nice-ui-rounded-${e})`}var qe={headline:`headline`,body:`body`,bodySmall:`body-small`,code:`code`,label:`label`,chrome:`chrome`};function Je(e){let t=`--nice-ui-font-${qe[e]}`;return{fontFamily:`var(${t}-family)`,fontSize:`var(${t}-size)`,fontWeight:`var(${t}-weight)`,lineHeight:`var(${t}-line-height)`,letterSpacing:`var(${t}-letter-spacing, normal)`}}var Ye=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Xe=o(((e,t)=>{t.exports=Ye()})),Ze=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),Qe=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ze()})),$e=Qe(),j=Xe();function et({anchor:e,config:t,id:n,ownerDocument:r,onPointerEnter:i,onPointerLeave:a,onFocusCapture:o,onBlurCapture:s}){let c=r??(typeof document>`u`?void 0:document),l=c?.defaultView??(typeof window>`u`?void 0:window);if(c==null||l==null)return(0,j.jsx)(j.Fragment,{});let u=t.maxWidth??400,d=e.top>=l.innerHeight-e.bottom,f=Math.round(d?e.top-6:e.bottom+6),p=Math.round(d?e.top-6-16:l.innerHeight-e.bottom-6-16),m,h,g;if(t.align!==`edge`){let t=u/2,n=Math.round(e.left+e.width/2);m=Math.max(t+16,Math.min(n,l.innerWidth-t-16)),g=d?`translateX(-50%) translateY(-100%)`:`translateX(-50%)`}else e.left+e.width/2<=l.innerWidth/2?m=Math.max(16,e.left):h=Math.max(16,l.innerWidth-e.right),g=d?`translateY(-100%)`:void 0;return(0,$e.createPortal)((0,j.jsxs)(`div`,{id:n,role:`tooltip`,onPointerEnter:i,onPointerLeave:a,onFocusCapture:o,onBlurCapture:s,style:{position:`fixed`,top:f,left:m,right:h,transform:g,maxWidth:u,maxHeight:p,overflow:`auto`,zIndex:2147483e3,background:A(`tooltipBackground`),border:`1px solid ${A(`tooltipBorder`)}`,borderRadius:Ke(`md`),color:A(`textSecondary`),pointerEvents:`auto`,...Je(`bodySmall`)},children:[t.title!=null&&(0,j.jsx)(`div`,{style:{background:A(`tooltipTitleBackground`),borderBottom:`1px solid ${A(`tooltipTitleBorder`)}`,padding:`${Ge(`xxs`)} ${Ge(`sm`)}`,color:A(`textEmphasis`),...Je(`label`)},children:t.title}),(0,j.jsx)(`div`,{style:{padding:`${Ge(`xs`)} ${Ge(`sm`)}`},children:t.content})]}),c.body)}function tt(e,t){let n=[e,t].flatMap(e=>e?.split(/\s+/)??[]).filter((e,t,n)=>e!==``&&n.indexOf(e)===t);return n.length===0?void 0:n.join(` `)}function nt(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function rt(e,t){return n=>{e?.(n),t(n)}}function it({config:e,children:t}){let n=(0,d.useId)(),r=d.Children.only(t),i=(0,d.useRef)(null),[a,o]=(0,d.useState)(null),s=(0,d.useRef)(!1),c=(0,d.useRef)(!1),l=(0,d.useRef)(!1),u=(0,d.useRef)(!1),f=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{f.current!=null&&(f.current.view.clearTimeout(f.current.id),f.current=null)},[]),m=(0,d.useCallback)(()=>{p();let e=i.current?.getBoundingClientRect();e!=null&&o(e)},[p]),h=(0,d.useCallback)(()=>{p();let e=i.current?.ownerDocument.defaultView??(typeof window>`u`?void 0:window);if(e==null)return;let t=e.setTimeout(()=>{f.current=null,!(s.current||c.current||l.current||u.current)&&o(null)},0);f.current={view:e,id:t}},[p]);(0,d.useEffect)(()=>p,[p]),(0,d.useEffect)(()=>{if(a==null)return;let e=i.current?.ownerDocument;if(e==null)return;let t=e=>{e.key===`Escape`&&o(null)};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[a]);let g=r.props,_=g.ref,v=(0,d.useMemo)(()=>e=>{i.current=e,nt(_,e)},[_]),y=a!=null;return(0,j.jsxs)(j.Fragment,{children:[(0,d.cloneElement)(r,{ref:v,"aria-describedby":tt(g[`aria-describedby`],y?n:void 0),onPointerEnter:rt(g.onPointerEnter,()=>{s.current=!0,m()}),onPointerLeave:rt(g.onPointerLeave,()=>{s.current=!1,h()}),onFocus:rt(g.onFocus,()=>{l.current=!0,m()}),onBlur:rt(g.onBlur,e=>{e.currentTarget.contains(e.relatedTarget)||(l.current=!1,h())})}),a!=null&&(0,j.jsx)(et,{anchor:a,config:e,id:n,ownerDocument:i.current?.ownerDocument,onPointerEnter:()=>{c.current=!0,p()},onPointerLeave:()=>{c.current=!1,h()},onFocusCapture:()=>{u.current=!0,p()},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(u.current=!1,h())}})]})}var at=`data-nice-ui-style-nonce`,ot=globalThis,st=Symbol.for(`@nice-code/ui/style-nonce-owners`);ot[st]=ot[st]??new WeakMap;var ct=Symbol.for(`@nice-code/ui/style-owners`),lt=ot[ct]??new WeakMap;ot[ct]=lt;function ut(e){let t=lt.get(e);return t??(t=new Map,lt.set(e,t)),t}function dt(e){let t=e.documentElement?.getAttribute(at);return t==null||t===``?void 0:t}function ft({id:e,css:t,nonce:n,document:r,attributes:i={}},a){let o=r??(typeof document>`u`?void 0:document);if(o==null)return null;let s=ut(o),c=s.get(e),l=c?.element,u=l!=null&&o.getElementById(e)===l?l:o.getElementById(e);if(u!=null&&u.tagName!==`STYLE`)throw Error(`nice-ui: style id ${JSON.stringify(e)} is owned by a non-style element`);let d=c==null&&u!=null,f=u,p=n??dt(o)??f?.nonce??f?.getAttribute(`nonce`)??void 0,m=Object.entries(i).every(([e,t])=>f?.getAttribute(e)===t),h=p==null||f?.nonce===p,g=f;if(g==null||g.textContent!==t||!m||!h){g=o.createElement(`style`),g.id=e;for(let[e,t]of Object.entries(i))g.setAttribute(e,t);p!=null&&(g.setAttribute(`nonce`,p),g.nonce=p),g.textContent=t,f==null?o.head?.appendChild(g):f.replaceWith(g)}return c==null?(c={element:g,owners:new Set,persistent:a||d},s.set(e,c)):(c.element=g,a&&(c.persistent=!0)),{element:g,ownership:c,document:o}}function pt(e){return ft(e,!0)?.element??null}function mt(e){let t=ft(e,!1);if(t==null)return()=>{};let n={};return t.ownership.owners.add(n),()=>{let r=t.document,i=lt.get(r),a=i?.get(e.id);a!=null&&(a.owners.delete(n),!(a.owners.size>0||a.persistent)&&(a.element.remove(),i?.delete(e.id)))}}function ht(e={}){return{id:`nice-ui-dialog-styles`,nonce:e.nonce,document:e.document,css:`
|
|
7
|
+
dialog[data-nice-ui-dialog]::backdrop { background: ${A(`dialogBackdrop`)}; }
|
|
8
|
+
dialog[data-nice-ui-dialog] { border: none; padding: 0; background: transparent; }
|
|
9
|
+
`}}function gt(e={}){return mt(ht(e))}function _t({open:e,onClose:t,title:n,description:r,nonce:i,children:a,maxWidth:o=440}){let s=(0,d.useRef)(null),c=(0,d.useRef)(null),l=(0,d.useId)(),u=`${l}-title`,f=`${l}-description`;return(0,d.useEffect)(()=>{let t=s.current;if(t==null)return;let n;if(e&&!t.open)n=gt({nonce:i,document:t.ownerDocument}),c.current=t.ownerDocument.activeElement,t.showModal(),(t.querySelector(`input, select, textarea, button, [href], [tabindex]:not([tabindex='-1'])`)??t).focus();else if(!e&&t.open){t.close();let e=c.current;e instanceof HTMLElement&&e.focus()}return n},[e,i]),(0,j.jsx)(`dialog`,{ref:s,"data-nice-ui-dialog":``,"aria-labelledby":u,...r==null?{}:{"aria-describedby":f},onCancel:e=>{e.preventDefault(),t()},onClick:e=>{e.target===s.current&&t()},style:{background:A(`surfaceDetail`),color:A(`textSecondary`),border:`1px solid ${A(`borderDivider`)}`,borderRadius:Ke(`md`),padding:0,width:`min(${o}px, calc(100vw - 40px))`,...Je(`chrome`)},children:(0,j.jsxs)(`div`,{style:{padding:Ge(`lg`),display:`grid`,gap:Ge(`md`)},children:[(0,j.jsx)(`h2`,{id:u,style:{margin:0,color:A(`textEmphasis`),...Je(`headline`)},children:n}),r==null?null:(0,j.jsx)(`p`,{id:f,style:{margin:0,...Je(`body`)},children:r}),a]})})}(0,d.createContext)(null);var vt=`data-nice-ui-theme-style`,yt=`data-nice-ui-theme-name`,bt=`data-nice-ui-theme-scope`;function xt(e,t){return t===``?`nice-ui-theme-${e}`:`nice-ui-theme-scoped-${encodeURIComponent(JSON.stringify([e,t]))}`}function St(e,t,n,r){for(let r of e.head?.querySelectorAll(`style[${vt}]`)??[])if(r.getAttribute(yt)===t&&r.getAttribute(bt)===n)return r;let i=e.getElementById(r);return i?.tagName===`STYLE`?i:null}function Ct(e,t={}){let n=wt(e,t);n!=null&&pt(n)}function wt(e,t){let n=t.document??(typeof document>`u`?void 0:document);if(n==null)return null;let r=t.scopeSelector??``,i=xt(e.name,r),a=Ie(e,r),o=St(n,e.name,r,i);return o!=null&&o.id!==i&&n.getElementById(i)==null&&(o.id=i),{id:i,css:a,nonce:t.nonce,document:n,attributes:{[vt]:``,[yt]:e.name,[bt]:r}}}var Tt=Symbol.for(`@nice-code/ui/theme-attribute-owners`),Et=globalThis;Et[Tt]=Et[Tt]??new WeakMap;function Dt(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function Ot(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function kt(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var At=(e,t)=>Math.abs(e-t)<1.01,jt=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Mt,Nt=()=>{if(Mt!==void 0)return Mt;if(typeof navigator>`u`)return Mt=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Mt=!0;let e=navigator.maxTouchPoints;return Mt=navigator.platform===`MacIntel`&&e!==void 0&&e>0},Pt=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Ft=e=>e,It=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},Lt=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Pt(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(Pt(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},Rt={passive:!0},zt=typeof window>`u`?!0:`onscrollend`in window,Bt=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&zt,o=0,s=a?null:jt(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,Rt),a&&r.addEventListener(`scrollend`,u,Rt),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},Vt=(e,t)=>Bt(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Ht=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Ut=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},Wt=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ft,rangeExtractor:It,onChange:()=>{},measureElement:Ht,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=Ot(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!Nt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,Rt),e.addEventListener(`touchend`,n,Rt),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(Nt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=Ot(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=Ot(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=this.options.gap,a=e*2,o=this._flatMeasurements;if(!o||o.length<a){let e=new Float64Array(a);o&&l>0&&e.set(o.subarray(0,l*2)),o=e,this._flatMeasurements=o}let s;if(l===0)s=t+n;else{let e=l-1;s=o[e*2]+o[e*2+1]+i}for(let t=l;t<e;t++){let e=r(t),n=c.get(e),a=typeof n==`number`?n:this.options.estimateSize(t);o[t*2]=s,o[t*2+1]=a,s+=a+i}let u=Dt(e,o,r);return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,l),d=Array(a).fill(void 0);for(let e=0;e<l;e++){let t=u[e];t&&(d[t.lane]=e)}for(let i=l;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,l,f=o===`estimate`||c.has(e);if(a!==void 0&&this.options.lanes>1){s=a;let e=d[s],r=e===void 0?void 0:u[e];l=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?u[i-1]:this.getFurthestMeasurement(u,i);l=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,s)}let p=c.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=l+m;u[i]={index:i,start:l,size:m,end:h,key:e,lane:s},d[s]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ot(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=qt(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ot(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=Ot(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return kt(t[Gt(0,t.length-1,r?e=>n[e*2]:e=>kt(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(Nt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&At(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},Gt=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Kt(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function qt(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=Kt(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=Gt(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Jt=typeof document<`u`?d.useLayoutEffect:d.useEffect;function Yt({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=d.useReducer(e=>e+1,0)[1],a=d.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,$e.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=d.useState(()=>{let e=new Wt(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),Jt(()=>c._didMount(),[]),Jt(()=>c._willUpdate()),Jt(()=>{o(c)}),c}function Xt(e){return Yt({observeElementRect:Lt,observeElementOffset:Vt,scrollToFn:Ut,...e})}var Zt=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,ie());else{var t=n(l);t!==null&&se(x,t.startTime-e)}}var ee=!1,te=-1,S=5,C=-1;function ne(){return g?!0:!(e.unstable_now()-C<S)}function re(){if(g=!1,ee){var t=e.unstable_now();C=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():ee=!1}}}var ie;if(typeof y==`function`)ie=function(){y(re)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=re,ie=function(){oe.postMessage(null)}}else ie=function(){_(re,0)};function se(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):S=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,se(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ie()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Qt=o(((e,t)=>{t.exports=Zt()})),$t=o((e=>{var t=Qt(),n=u(),r=Qe();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),S=Symbol.for(`react.suspense_list`),C=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),ie=Symbol.for(`react.memo_cache_sentinel`),ae=Symbol.iterator;function oe(e){return typeof e!=`object`||!e?null:(e=ae&&e[ae]||e[`@@iterator`],typeof e==`function`?e:null)}var se=Symbol.for(`react.client.reference`);function ce(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case te:return`Suspense`;case S:return`SuspenseList`;case re:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case C:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}var w=Array.isArray,T=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},D=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=D[ue],D[ue]=null,ue--)}function O(e,t){ue++,D[ue]=e.current,e.current=t}var pe=de(null),me=de(null),he=de(null),ge=de(null);function k(e,t){switch(O(he,t),O(me,e),O(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(pe),O(pe,e)}function _e(){fe(pe),fe(me),fe(he)}function ve(e){e.memoizedState!==null&&O(ge,e);var t=pe.current,n=Gd(t,e.type);t!==n&&(O(me,e),O(pe,n))}function ye(e){me.current===e&&(fe(pe),fe(me)),ge.current===e&&(fe(ge),tp._currentValue=le)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
10
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
11
|
+
`+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
12
|
+
`),l=s.split(`
|
|
13
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
14
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Se(n):``}function Te(e,t){switch(e.tag){case 26:case 27:case 5:return Se(e.type);case 16:return Se(`Lazy`);case 13:return e.child!==t&&t!==null?Se(`Suspense Fallback`):Se(`Suspense`);case 19:return Se(`SuspenseList`);case 0:case 15:return we(e.type,!1);case 11:return we(e.type.render,!1);case 1:return we(e.type,!0);case 31:return Se(`Activity`);default:return``}}function Ee(e){try{var t=``,n=null;do t+=Te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
15
|
+
Error generating stack: `+e.message+`
|
|
16
|
+
`+e.stack}}var De=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,ke=t.unstable_cancelCallback,Ae=t.unstable_shouldYield,je=t.unstable_requestPaint,Me=t.unstable_now,Ne=t.unstable_getCurrentPriorityLevel,Pe=t.unstable_ImmediatePriority,Fe=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Re=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ve=null,A=null;function He(e){if(typeof ze==`function`&&Be(e),A&&typeof A.setStrictMode==`function`)try{A.setStrictMode(Ve,e)}catch{}}var Ue=Math.clz32?Math.clz32:Ke,We=Math.log,Ge=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(We(e)/Ge|0)|0}var qe=256,Je=262144,Ye=4194304;function Xe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Xe(n))):i=Xe(o):i=Xe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Xe(n))):i=Xe(o)):i=Xe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function $e(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function j(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function et(){var e=Ye;return Ye<<=1,!(Ye&62914560)&&(Ye=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ue(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&it(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function it(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ue(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function at(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ue(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ot(e,t){var n=t&-t;return n=n&42?1:st(n),(n&(e.suspendedLanes|t))===0?n:0}function st(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function lt(){var e=E.p;return e===0?(e=window.event,e===void 0?32:_p(e.type)):e}function ut(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var dt=Math.random().toString(36).slice(2),ft=`__reactFiber$`+dt,pt=`__reactProps$`+dt,mt=`__reactContainer$`+dt,ht=`__reactEvents$`+dt,gt=`__reactListeners$`+dt,_t=`__reactHandles$`+dt,vt=`__reactResources$`+dt,yt=`__reactMarker$`+dt;function bt(e){delete e[ft],delete e[pt],delete e[ht],delete e[gt],delete e[_t]}function xt(e){var t=e[ft];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mf(e);e!==null;){if(n=e[ft])return n;e=mf(e)}return t}e=n,n=e.parentNode}return null}function St(e){if(e=e[ft]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function wt(e){var t=e[vt];return t||=e[vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Tt(e){e[yt]=!0}var Et=new Set,Dt={};function Ot(e,t){kt(e,t),kt(e+`Capture`,t)}function kt(e,t){for(Dt[e]=t,e=0;e<t.length;e++)Et.add(t[e])}var At=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),jt={},Mt={};function Nt(e){return De.call(Mt,e)?!0:De.call(jt,e)?!1:At.test(e)?Mt[e]=!0:(jt[e]=!0,!1)}function Pt(e,t,n){if(Nt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ft(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function It(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Lt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Rt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function zt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bt(e){if(!e._valueTracker){var t=Rt(e)?`checked`:`value`;e._valueTracker=zt(e,t,``+e[t])}}function Vt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Rt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ht(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ut=/[\n"\\]/g;function Wt(e){return e.replace(Ut,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Gt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Lt(t)):e.value!==``+Lt(t)&&(e.value=``+Lt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):qt(e,o,Lt(n)):qt(e,o,Lt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Lt(s):e.removeAttribute(`name`)}function Kt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Bt(e);return}n=n==null?``:``+Lt(n),t=t==null?n:``+Lt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Bt(e)}function qt(e,t,n){t===`number`&&Ht(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Jt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Lt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Yt(e,t,n){if(t!=null&&(t=``+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Lt(n)}function Xt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(w(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Lt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Bt(e)}function Zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $t=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function en(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||$t.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function tn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&en(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&en(e,o,t[o])}function M(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var nn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),rn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function an(e){return rn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function on(){}var sn=null;function cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ln=null,un=null;function dn(e){var t=St(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Gt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Wt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[pt]||null;if(!a)throw Error(i(90));Gt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Vt(r)}break a;case`textarea`:Yt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Jt(e,!!n.multiple,t,!1)}}}var fn=!1;function pn(e,t,n){if(fn)return e(t,n);fn=!0;try{return e(t)}finally{if(fn=!1,(ln!==null||un!==null)&&(xu(),ln&&(t=ln,e=un,un=ln=null,dn(t),e)))for(t=0;t<e.length;t++)dn(e[t])}}function mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var hn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,"passive",{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return p(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=p({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=p({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(p({},Nn,{dataTransfer:0})),In=Tn(p({},On,{relatedTarget:0})),Ln=Tn(p({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(p({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(p({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(p({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(p({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(p({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=Tn(p({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=Tn(p({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Xn=Tn(p({},En,{newState:0,oldState:0})),Zn=[9,13,27,32],Qn=hn&&`CompositionEvent`in window,$n=null;hn&&`documentMode`in document&&($n=document.documentMode);var er=hn&&`TextEvent`in window&&!$n,tr=hn&&(!Qn||$n&&8<$n&&11>=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=xn(),bn=yn=vn=null,or=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){ln?un?un.push(r):un=[r]:ln=r,t=Od(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){xd(e,0)}function hr(e){if(Vt(Ct(e)))return e}function gr(e,t){if(e===`change`)return t}var _r=!1;if(hn){var vr;if(hn){var yr=`oninput`in document;if(!yr){var br=document.createElement(`div`);br.setAttribute(`oninput`,`return;`),yr=typeof br.oninput==`function`}vr=yr}else vr=!1;_r=vr&&(!document.documentMode||9<document.documentMode)}function xr(){fr&&(fr.detachEvent(`onpropertychange`,Sr),pr=fr=null)}function Sr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,cn(e)),pn(mr,t)}}function Cr(e,t,n){e===`focusin`?(xr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,Sr)):e===`focusout`&&xr()}function wr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Tr(e,t){if(e===`click`)return hr(t)}function Er(e,t){if(e===`input`||e===`change`)return hr(t)}function Dr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Or=typeof Object.is==`function`?Object.is:Dr;function kr(e,t){if(Or(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!De.call(t,i)||!Or(e[i],t[i]))return!1}return!0}function Ar(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jr(e,t){var n=Ar(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Fr=hn&&`documentMode`in document&&11>=document.documentMode,Ir=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||Ir==null||Ir!==Ht(r)||(r=Ir,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=Od(Lr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ir)))}function Vr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Hr={animationend:Vr(`Animation`,`AnimationEnd`),animationiteration:Vr(`Animation`,`AnimationIteration`),animationstart:Vr(`Animation`,`AnimationStart`),transitionrun:Vr(`Transition`,`TransitionRun`),transitionstart:Vr(`Transition`,`TransitionStart`),transitioncancel:Vr(`Transition`,`TransitionCancel`),transitionend:Vr(`Transition`,`TransitionEnd`)},Ur={},Wr={};hn&&(Wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Hr.animationend.animation,delete Hr.animationiteration.animation,delete Hr.animationstart.animation),`TransitionEvent`in window||delete Hr.transitionend.transition);function Gr(e){if(Ur[e])return Ur[e];if(!Hr[e])return e;var t=Hr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wr)return Ur[e]=t[n];return e}var Kr=Gr(`animationend`),qr=Gr(`animationiteration`),Jr=Gr(`animationstart`),Yr=Gr(`transitionrun`),Xr=Gr(`transitionstart`),Zr=Gr(`transitioncancel`),Qr=Gr(`transitionend`),$r=new Map,ei=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);ei.push(`scrollEnd`);function ti(e,t){$r.set(e,t),Ot(t,[e])}var ni=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ri=[],ii=0,ai=0;function oi(){for(var e=ii,t=ai=ii=0;t<e;){var n=ri[t];ri[t++]=null;var r=ri[t];ri[t++]=null;var i=ri[t];ri[t++]=null;var a=ri[t];if(ri[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ui(n,i,a)}}function si(e,t,n,r){ri[ii++]=e,ri[ii++]=t,ri[ii++]=n,ri[ii++]=r,ai|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ci(e,t,n,r){return si(e,t,n,r),di(e)}function li(e,t){return si(e,null,null,t),di(e)}function ui(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ue(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function di(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var fi={};function pi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mi(e,t,n,r){return new pi(e,t,n,r)}function hi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gi(e,t){var n=e.alternate;return n===null?(n=mi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function _i(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function vi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)hi(e)&&(s=1);else if(typeof e==`string`)s=Kf(e,n,pe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case re:return e=mi(31,n,t,a),e.elementType=re,e.lanes=o,e;case _:return yi(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=mi(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case te:return e=mi(13,n,t,a),e.elementType=te,e.lanes=o,e;case S:return e=mi(19,n,t,a),e.elementType=S,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case ee:s=11;break a;case C:s=14;break a;case ne:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function yi(e,t,n,r){return e=mi(7,e,r,t),e.lanes=n,e}function bi(e,t,n){return e=mi(6,e,null,t),e.lanes=n,e}function xi(e){var t=mi(18,null,null,0);return t.stateNode=e,t}function Si(e,t,n){return t=mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ci=new WeakMap;function wi(e,t){if(typeof e==`object`&&e){var n=Ci.get(e);return n===void 0?(t={value:e,source:t,stack:Ee(t)},Ci.set(e,t),t):n}return{value:e,source:t,stack:Ee(t)}}var Ti=[],Ei=0,Di=null,Oi=0,ki=[],Ai=0,ji=null,Mi=1,Ni=``;function Pi(e,t){Ti[Ei++]=Oi,Ti[Ei++]=Di,Di=e,Oi=t}function Fi(e,t,n){ki[Ai++]=Mi,ki[Ai++]=Ni,ki[Ai++]=ji,ji=e;var r=Mi;e=Ni;var i=32-Ue(r)-1;r&=~(1<<i),n+=1;var a=32-Ue(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Mi=1<<32-Ue(t)+i|n<<i|r,Ni=a+e}else Mi=1<<a|n<<i|r,Ni=e}function Ii(e){e.return!==null&&(Pi(e,1),Fi(e,1,0))}function Li(e){for(;e===Di;)Di=Ti[--Ei],Ti[Ei]=null,Oi=Ti[--Ei],Ti[Ei]=null;for(;e===ji;)ji=ki[--Ai],ki[Ai]=null,Ni=ki[--Ai],ki[Ai]=null,Mi=ki[--Ai],ki[Ai]=null}function Ri(e,t){ki[Ai++]=Mi,ki[Ai++]=Ni,ki[Ai++]=ji,Mi=t.id,Ni=t.overflow,ji=e}var zi=null,Bi=null,N=!1,Vi=null,Hi=!1,Ui=Error(i(519));function Wi(e){throw Xi(wi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ui}function Gi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ft]=e,t[pt]=r,n){case`dialog`:X(`cancel`,t),X(`close`,t);break;case`iframe`:case`object`:case`embed`:X(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)X(yd[n],t);break;case`source`:X(`error`,t);break;case`img`:case`image`:case`link`:X(`error`,t),X(`load`,t);break;case`details`:X(`toggle`,t);break;case`input`:X(`invalid`,t),Kt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:X(`invalid`,t);break;case`textarea`:X(`invalid`,t),Xt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Pd(t.textContent,n)?(r.popover!=null&&(X(`beforetoggle`,t),X(`toggle`,t)),r.onScroll!=null&&X(`scroll`,t),r.onScrollEnd!=null&&X(`scrollend`,t),r.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||Wi(e,!0)}function Ki(e){for(zi=e.return;zi;)switch(zi.tag){case 5:case 31:case 13:Hi=!1;return;case 27:case 3:Hi=!0;return;default:zi=zi.return}}function qi(e){if(e!==zi)return!1;if(!N)return Ki(e),N=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Kd(e.type,e.memoizedProps)),n=!n),n&&Bi&&Wi(e),Ki(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Bi=pf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Bi=pf(e)}else t===27?(t=Bi,ef(e.type)?(e=ff,ff=null,Bi=e):Bi=t):Bi=zi?df(e.stateNode.nextSibling):null;return!0}function Ji(){Bi=zi=null,N=!1}function Yi(){var e=Vi;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),Vi=null),e}function Xi(e){Vi===null?Vi=[e]:Vi.push(e)}var Zi=de(null),Qi=null,$i=null;function ea(e,t,n){O(Zi,t._currentValue),t._currentValue=n}function ta(e){e._currentValue=Zi.current,fe(Zi)}function na(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ra(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),na(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),na(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ia(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Or(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ge.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[tp]:e.push(tp))}a=a.return}e!==null&&ra(t,e,n,r),t.flags|=262144}function aa(e){for(e=e.firstContext;e!==null;){if(!Or(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oa(e){Qi=e,$i=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function sa(e){return la(Qi,e)}function ca(e,t){return Qi===null&&oa(e),la(e,t)}function la(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},$i===null){if(e===null)throw Error(i(308));$i=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else $i=$i.next=t;return n}var ua=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},da=t.unstable_scheduleCallback,fa=t.unstable_NormalPriority,pa={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ma(){return{controller:new ua,data:new Map,refCount:0}}function ha(e){e.refCount--,e.refCount===0&&da(fa,function(){e.controller.abort()})}var ga=null,_a=0,va=0,ya=null;function ba(e,t){if(ga===null){var n=ga=[];_a=0,va=pd(),ya={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return _a++,t.then(xa,xa),t}function xa(){if(--_a===0&&ga!==null){ya!==null&&(ya.status=`fulfilled`);var e=ga;ga=null,va=0,ya=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ca=T.S;T.S=function(e,t){tu=Me(),typeof t==`object`&&t&&typeof t.then==`function`&&ba(e,t),Ca!==null&&Ca(e,t)};var wa=de(null);function Ta(){var e=wa.current;return e===null?Bl.pooledCache:e}function Ea(e,t){t===null?O(wa,wa.current):O(wa,t.pool)}function Da(){var e=Ta();return e===null?null:{parent:pa._currentValue,pool:e}}var Oa=Error(i(460)),ka=Error(i(474)),Aa=Error(i(542)),ja={then:function(){}};function Ma(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Na(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(on,on),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,La(e),e;default:if(typeof t.status==`string`)t.then(on,on);else{if(e=Bl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,La(e),e}throw Fa=t,Oa}}function Pa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Fa=e,Oa):e}}var Fa=null;function Ia(){if(Fa===null)throw Error(i(459));var e=Fa;return Fa=null,e}function La(e){if(e===Oa||e===Aa)throw Error(i(483))}var Ra=null,za=0;function Ba(e){var t=za;return za+=1,Ra===null&&(Ra=[]),Na(Ra,e,t)}function Va(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ha(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ua(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=gi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=bi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ne&&Pa(i)===t.type)?(t=a(t,n.props),Va(t,n),t.return=e,t):(t=vi(n.type,n.key,n.props,null,e.mode,r),Va(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Si(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=yi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=bi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=vi(t.type,t.key,t.props,null,e.mode,n),Va(n,t),n.return=e,n;case g:return t=Si(t,e.mode,n),t.return=e,t;case ne:return t=Pa(t),f(e,t,n)}if(w(t)||oe(t))return t=yi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ba(t),n);if(t.$$typeof===x)return f(e,ca(e,t),n);Ha(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case ne:return n=Pa(n),p(e,t,n,r)}if(w(n)||oe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ba(n),r);if(n.$$typeof===x)return p(e,t,ca(e,n),r);Ha(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ne:return r=Pa(r),m(e,t,n,r,i)}if(w(r)||oe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ba(r),i);if(r.$$typeof===x)return m(e,t,n,ca(t,r),i);Ha(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),N&&Pi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return N&&Pi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),N&&Pi(i,h),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),N&&Pi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return N&&Pi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),N&&Pi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ne&&Pa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Va(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=yi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=vi(o.type,o.key,o.props,null,e.mode,c),Va(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=Si(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=Pa(o),b(e,r,o,c)}if(w(o))return v(e,r,o,c);if(oe(o)){if(l=oe(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ba(o),c);if(o.$$typeof===x)return b(e,r,ca(e,o),c);Ha(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=bi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{za=0;var i=b(e,t,n,r);return Ra=null,i}catch(t){if(t===Oa||t===Aa)throw t;var a=mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Wa=Ua(!0),Ga=Ua(!1),Ka=!1;function qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ya(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=di(e),ui(e,null,n),t}return si(e,r,t,n),di(e)}function Za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function Qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var $a=!1;function eo(){if($a){var e=ya;if(e!==null)throw e}}function to(e,t,n,r){$a=!1;var i=e.updateQueue;Ka=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(q&f)===f:(r&f)===f){f!==0&&f===va&&($a=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Ka=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function no(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function ro(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)no(n[e],t)}var io=de(null),ao=de(0);function oo(e,t){e=Gl,O(ao,e),O(io,t),Gl=e|t.baseLanes}function so(){O(ao,Gl),O(io,io.current)}function co(){Gl=ao.current,fe(io),fe(ao)}var P=de(null),lo=null;function F(e){var t=e.alternate;O(L,L.current&1),O(P,e),lo===null&&(t===null||io.current!==null||t.memoizedState!==null)&&(lo=e)}function uo(e){O(L,L.current),O(P,e),lo===null&&(lo=e)}function fo(e){e.tag===22?(O(L,L.current),O(P,e),lo===null&&(lo=e)):po(e)}function po(){O(L,L.current),O(P,P.current)}function I(e){fe(P),lo===e&&(lo=null),fe(L)}var L=de(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||cf(n)||lf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=0,R=null,z=null,go=null,_o=!1,B=!1,vo=!1,yo=0,bo=0,xo=null,So=0;function Co(){throw Error(i(321))}function wo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Or(e[n],t[n]))return!1;return!0}function To(e,t,n,r,i,a){return ho=a,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Bs:Vs,vo=!1,a=n(r,i),vo=!1,B&&(a=Do(t,n,r,i)),Eo(e),a}function Eo(e){T.H=zs;var t=z!==null&&z.next!==null;if(ho=0,go=z=R=null,_o=!1,bo=0,xo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&aa(e)&&(ic=!0))}function Do(e,t,n,r){R=e;var a=0;do{if(B&&(xo=null),bo=0,B=!1,25<=a)throw Error(i(301));if(a+=1,go=z=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}T.H=Hs,o=t(n,r)}while(B);return o}function Oo(){var e=T.H,t=e.useState()[0];return t=typeof t.then==`function`?Fo(t):t,e=e.useState()[0],(z===null?null:z.memoizedState)!==e&&(R.flags|=1024),t}function ko(){var e=yo!==0;return yo=0,e}function Ao(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function jo(e){if(_o){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_o=!1}ho=0,go=z=R=null,B=!1,bo=yo=0,xo=null}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return go===null?R.memoizedState=go=e:go=go.next=e,go}function No(){if(z===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=z.next;var t=go===null?R.memoizedState:go.next;if(t!==null)go=t,z=e;else{if(e===null)throw R.alternate===null?Error(i(467)):Error(i(310));z=e,e={memoizedState:z.memoizedState,baseState:z.baseState,baseQueue:z.baseQueue,queue:z.queue,next:null},go===null?R.memoizedState=go=e:go=go.next=e}return go}function Po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fo(e){var t=bo;return bo+=1,xo===null&&(xo=[]),e=Na(xo,e,t),t=R,(go===null?t.memoizedState:go.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Bs:Vs),e}function Io(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Fo(e);if(e.$$typeof===x)return sa(e)}throw Error(i(438,String(e)))}function Lo(e){var t=null,n=R.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=R.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Po(),R.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ie;return t.index++,n}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){return Bo(No(),z,e)}function Bo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ho&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===va&&(d=!0);else if((ho&p)===p){u=u.next,p===va&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,R.lanes|=p,Kl|=p;f=u.action,vo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,R.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Or(o,e.memoizedState)&&(ic=!0,d&&(n=ya,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Vo(e){var t=No(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Or(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ho(e,t,n){var r=R,a=No(),o=N;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Or((z||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,fs(Go.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||go!==null&&go.memoizedState.tag&1){if(r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,a,n,t),null),Bl===null)throw Error(i(349));o||ho&127||Uo(r,t,n)}return n}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t=Po(),R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function qo(e){var t=li(e,2);t!==null&&gu(t,e,2)}function Jo(e){var t=Mo();if(typeof e==`function`){var n=e;if(e=n(),vo){He(!0);try{n()}finally{He(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t}function Yo(e,t,n,r){return e.baseState=n,Bo(e,z,typeof r==`function`?r:Ro)}function Xo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};T.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=T.T,o={};T.T=o;try{var s=n(i,r),c=T.S;c!==null&&c(o,s),Qo(e,t,s)}catch(n){es(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),T.T=a}}else try{a=n(i,r),Qo(e,t,a)}catch(n){es(e,t,n)}}function Qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$o(e,t,n)},function(n){return es(e,t,n)}):$o(e,t,n)}function $o(e,t,n){t.status=`fulfilled`,t.value=n,ts(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zo(e,n)))}function es(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ts(t),t=t.next;while(t!==r)}e.action=null}function ts(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ns(e,t){return t}function rs(e,t){if(N){var n=Bl.formState;if(n!==null){a:{var r=R;if(N){if(Bi){b:{for(var i=Bi,a=Hi;i.nodeType!==8;){if(!a){i=null;break b}if(i=df(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Bi=df(i.nextSibling),r=i.data===`F!`;break a}}Wi(r)}r=!1}r&&(t=n[0])}}return n=Mo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:t},n.queue=r,n=Ns.bind(null,R,r),r.dispatch=n,r=Jo(!1),a=Fs.bind(null,R,!1,r.queue),r=Mo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xo.bind(null,R,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function is(e){return as(No(),z,e)}function as(e,t,n){if(t=Bo(e,t,ns)[0],e=zo(Ro)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Fo(t)}catch(e){throw e===Oa?Aa:e}else r=t;t=No();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(R.flags|=2048,cs(9,{destroy:void 0},os.bind(null,i,n),null)),[r,a,e]}function os(e,t){e.action=t}function ss(e){var t=No(),n=z;if(n!==null)return as(t,n,e);No(),t=t.memoizedState,n=No();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=R.updateQueue,t===null&&(t=Po(),R.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ls(){return No().memoizedState}function us(e,t,n,r){var i=Mo();R.flags|=e,i.memoizedState=cs(1|t,{destroy:void 0},n,r===void 0?null:r)}function V(e,t,n,r){var i=No();r=r===void 0?null:r;var a=i.memoizedState.inst;z!==null&&r!==null&&wo(r,z.memoizedState.deps)?i.memoizedState=cs(t,a,n,r):(R.flags|=e,i.memoizedState=cs(1|t,a,n,r))}function ds(e,t){us(8390656,8,e,t)}function fs(e,t){V(2048,8,e,t)}function H(e){R.flags|=4;var t=R.updateQueue;if(t===null)t=Po(),R.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=No().memoizedState;return H({ref:t,nextImpl:e}),function(){if(G&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return V(4,2,e,t)}function hs(e,t){return V(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),V(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&wo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&wo(t,r[1]))return r[0];if(r=e(),vo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||ho&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),R.lanes|=e,Kl|=e,n)}function Ss(e,t,n,r){return Or(n,t)?n:io.current===null?!(ho&42)||ho&1073741824&&!(q&261930)?(ic=!0,e.memoizedState=n):(e=hu(),R.lanes|=e,Kl|=e,t):(e=xs(e,n,r),Or(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=E.p;E.p=a!==0&&8>a?a:8;var o=T.T,s={};T.T=s,Fs(e,!1,t,n);try{var c=i(),l=T.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,Sa(c,r),mu(e)):Ps(e,t,r,mu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{E.p=a,o!==null&&s.types!==null&&(o.types=s.types),T.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,le,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},mu())}function Os(){return sa(tp)}function ks(){return No().memoizedState}function As(){return No().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ya(n);var r=Xa(t,e,n);r!==null&&(gu(r,t,n),Za(r,t,n)),t={cache:ma()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ci(e,t,n,r),n!==null&&(gu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,mu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o))return si(e,t,i,0),Bl===null&&oi(),!1}catch{}if(n=ci(e,t,i,r),n!==null)return gu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=ci(e,n,r,2),t!==null&&gu(t,e,2)}function Is(e){var t=e.alternate;return e===R||t!==null&&t===R}function Ls(e,t){B=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var zs={readContext:sa,use:Io,useCallback:Co,useContext:Co,useEffect:Co,useImperativeHandle:Co,useLayoutEffect:Co,useInsertionEffect:Co,useMemo:Co,useReducer:Co,useRef:Co,useState:Co,useDebugValue:Co,useDeferredValue:Co,useTransition:Co,useSyncExternalStore:Co,useId:Co,useHostTransitionStatus:Co,useFormState:Co,useActionState:Co,useOptimistic:Co,useMemoCache:Co,useCacheRefresh:Co};zs.useEffectEvent=Co;var Bs={readContext:sa,use:Io,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:sa,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=Mo();t=t===void 0?null:t;var r=e();if(vo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Mo();if(n!==void 0){var i=n(t);if(vo){He(!0);try{n(t)}finally{He(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Ns.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Mo(),e,t)},useTransition:function(){var e=Jo(!1);return e=Cs.bind(null,R,e.queue,!0,!1),Mo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,a=Mo();if(N){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));q&127||Uo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Go.bind(null,r,o,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,o,n,t),null),n},useId:function(){var e=Mo(),t=Bl.identifierPrefix;if(N){var n=Ni,r=Mi;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=So++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:rs,useActionState:rs,useOptimistic:function(e){var t=Mo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,R,!0,n),n.dispatch=t,[e,t]},useMemoCache:Lo,useCacheRefresh:function(){return Mo().memoizedState=js.bind(null,R)},useEffectEvent:function(e){var t=Mo(),n={impl:e};return t.memoizedState=n,function(){if(G&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:sa,use:Io,useCallback:ys,useContext:sa,useEffect:fs,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ls,useState:function(){return zo(Ro)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(No(),z.memoizedState,e,t)},useTransition:function(){var e=zo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:ks,useHostTransitionStatus:Os,useFormState:is,useActionState:is,useOptimistic:function(e,t){return Yo(No(),z,e,t)},useMemoCache:Lo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:sa,use:Io,useCallback:ys,useContext:sa,useEffect:fs,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Vo,useRef:ls,useState:function(){return Vo(Ro)},useDebugValue:vs,useDeferredValue:function(e,t){var n=No();return z===null?xs(n,e,t):Ss(n,z.memoizedState,e,t)},useTransition:function(){var e=Vo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:ks,useHostTransitionStatus:Os,useFormState:ss,useActionState:ss,useOptimistic:function(e,t){var n=No();return z===null?(n.baseState=e,[e,n.queue.dispatch]):Yo(n,z,e,t)},useMemoCache:Lo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ya(r);i.payload=t,n!=null&&(i.callback=n),t=Xa(e,i,r),t!==null&&(gu(t,e,r),Za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ya(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Xa(e,i,r),t!==null&&(gu(t,e,r),Za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Ya(n);r.tag=2,t!=null&&(r.callback=t),t=Xa(e,r,n),t!==null&&(gu(t,e,n),Za(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!kr(n,r)||!kr(i,a):!0}function Ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){ni(e)}function Ys(e){console.error(e)}function Xs(e){ni(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Ya(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Ya(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ia(t,n,a,!0),n=P.current,n!==null){switch(n.tag){case 31:case 13:return lo===null?Ou():n.alternate===null&&Y===0&&(Y=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ja?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===ja?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(N)return t=P.current,t===null?(r!==Ui&&(t=Error(i(423),{cause:r}),Xi(wi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=wi(r,n),a=$s(e.stateNode,r,a),Qa(e,a),Y!==4&&(Y=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ui&&(e=Error(i(422),{cause:r}),Xi(wi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=wi(o,n),Zl===null?Zl=[o]:Zl.push(o),Y!==4&&(Y=2),t===null)return!0;r=wi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Qa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Qa(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?Ga(t,null,n,r):Wa(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return oa(t),r=To(e,t,n,o,a,i),s=ko(),e!==null&&!ic?(Ao(e,t,i),Ac(e,t,i)):(N&&s&&Ii(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!hi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=vi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?kr:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=gi(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(kr(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ea(t,a===null?null:a.cachePool),a===null?so():oo(t,a),fo(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ea(t,null),so(),po(t)):(Ea(t,a.cachePool),oo(t,a),po(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=Ta();return a=a===null?null:{parent:pa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ea(t,null),so(),fo(t),e!==null&&ia(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Wa(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,I(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(N){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(uo(t),(e=Bi)?(e=sf(e,Hi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ji===null?null:{id:Mi,overflow:Ni},retryLane:536870912,hydrationErrors:null},n=xi(e),n.return=t,t.child=n,zi=t,Bi=null)):e=null,e===null)throw Wi(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(uo(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||ia(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Bl,r!==null&&(s=ot(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,li(e,s),gu(r,e,s),rc;Ou(),t=pc(e,t,n)}else e=o.treeContext,Bi=df(s.nextSibling),zi=t,N=!0,Vi=null,Hi=!1,e!==null&&Ri(t,e),t=fc(t,r),t.flags|=4096;return t}return e=gi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return oa(t),n=To(e,t,n,r,void 0,i),r=ko(),e!==null&&!ic?(Ao(e,t,i),Ac(e,t,i)):(N&&r&&Ii(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return oa(t),t.updateQueue=null,n=Do(t,r,n,i),Eo(e),r=ko(),e!==null&&!ic?(Ao(e,t,a),Ac(e,t,a)):(N&&r&&Ii(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(oa(t),t.stateNode===null){var a=fi,o=n.contextType;typeof o==`object`&&o&&(a=sa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},qa(t),o=n.contextType,a.context=typeof o==`object`&&o?sa(o):fi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),to(t,r,a,i),eo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=fi,typeof u==`object`&&u&&(o=sa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),Ka=!1;var f=t.memoizedState;a.state=f,to(t,r,a,i),eo(),l=t.memoizedState,s||f!==l||Ka?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=Ka||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ja(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=fi,typeof l==`object`&&l&&(c=sa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),Ka=!1,f=t.memoizedState,a.state=f,to(t,r,a,i),eo();var p=t.memoizedState;o!==d||f!==p||Ka||e!==null&&e.dependencies!==null&&aa(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=Ka||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&aa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Wa(t,e.child,null,i),t.child=Wa(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Ji(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:Da()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(L.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(N){if(a?F(t):po(t),(e=Bi)?(e=sf(e,Hi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ji===null?null:{id:Mi,overflow:Ni},retryLane:536870912,hydrationErrors:null},n=xi(e),n.return=t,t.child=n,zi=t,Bi=null)):e=null,e===null)throw Wi(t);return lf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(po(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=yi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(F(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(F(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(po(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=yi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Wa(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(po(t),t.child=e.child,t.flags|=128,t=null);else if(F(t),lf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Xi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||ia(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Bl,s!==null&&(r=ot(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,li(e,r),gu(s,e,r),rc;cf(c)||Ou(),t=Ec(e,t,n)}else cf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Bi=df(c.nextSibling),zi=t,N=!0,Vi=null,Hi=!1,e!==null&&Ri(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(po(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=gi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=yi(c,a,n,null),c.flags|=2):c=gi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=Da():(l=pa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(F(t),n=e.child,e=n.sibling,n=gi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=mi(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Wa(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),na(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=L.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,O(L,o),ac(e,t,r,n),r=N?Oi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ia(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=gi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=gi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&aa(e))):!0}function Mc(e,t,n){switch(t.tag){case 3:k(t,t.stateNode.containerInfo),ea(t,pa,e.memoizedState.cache),Ji();break;case 27:case 5:ve(t);break;case 4:k(t,t.stateNode.containerInfo);break;case 10:ea(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,uo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(F(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(F(t),t.flags|=128,null);F(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ia(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),O(L,L.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:ea(t,pa,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}else ic=!1,N&&t.flags&1048576&&Fi(t,Oi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Pa(t.elementType),t.type=e,typeof e==`function`)hi(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ee){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===C){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=ce(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(k(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ja(e,t),to(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ea(t,pa,r),r!==o.cache&&ra(t,[pa],n,!0),eo(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}else if(r!==a){a=wi(Error(i(424)),t),Xi(a),t=yc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Bi=df(e.firstChild),zi=t,N=!0,Vi=null,Hi=!0,n=Ga(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ji(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Mf(t.type,null,t.pendingProps,null))?t.memoizedState=n:N||(n=t.type,e=t.pendingProps,r=Ud(he.current).createElement(n),r[ft]=t,r[pt]=e,Ld(r,n,e),Tt(r),t.stateNode=r):t.memoizedState=Mf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&N&&(r=t.stateNode=hf(t.type,t.pendingProps,he.current),zi=t,Hi=!0,a=Bi,ef(t.type)?(ff=a,Bi=df(r.firstChild)):Bi=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&N&&((a=r=Bi)&&(r=af(r,t.type,t.pendingProps,Hi),r===null?a=!1:(t.stateNode=r,zi=t,Bi=df(r.firstChild),Hi=!1,a=!0)),a||Wi(t)),ve(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Kd(a,o)?r=null:s!==null&&Kd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=To(e,t,Oo,null,null,n),tp._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&N&&((e=n=Bi)&&(n=of(n,t.pendingProps,Hi),n===null?e=!1:(t.stateNode=n,zi=t,Bi=null,e=!0)),e||Wi(t)),null;case 13:return Cc(e,t,n);case 4:return k(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wa(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ea(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,oa(t),a=sa(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return oa(t),r=sa(pa),e===null?(a=Ta(),a===null&&(a=Bl,o=ma(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},qa(t),ea(t,pa,a)):((e.lanes&n)!==0&&(Ja(e,t),to(t,null,null,n),eo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ea(t,pa,r),r!==a.cache&&ra(t,[pa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ea(t,pa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw Fa=ja,ka}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!qf(t))if(Tu())e.flags|=8192;else throw Fa=ja,ka}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:et(),e.lanes|=t,Xl|=t)}function Rc(e,t){if(!N)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bc(e,t,n){var r=t.pendingProps;switch(Li(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ta(pa),_e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(qi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Yi())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(ye(t),n=he.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=pe.current,qi(t)?Gi(t,e):(e=hf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(ye(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=pe.current,qi(t))Gi(t,o);else{var s=Ud(he.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ld(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,qi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=zi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Pd(e.nodeValue,n)),e||Wi(t,!0)}else e=Ud(e).createTextNode(r),e[ft]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=qi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ft]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Yi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(I(t),t):(I(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=qi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ft]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Yi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(I(t),t):(I(t),null)}return I(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return _e(),e===null&&wd(t.stateNode.containerInfo),zc(t),null;case 10:return ta(t.type),zc(t),null;case 19:if(fe(L),r=t.memoizedState,r===null)return zc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Rc(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=mo(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)_i(n,e),n=n.sibling;return O(L,L.current&1|2),N&&Pi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Me()>nu&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}else{if(!a)if(e=mo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!N)return zc(t),null}else 2*Me()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Me(),e.sibling=null,n=L.current,O(L,a?n&1|2:n&1),N&&Pi(t,r.treeForkCount),e);case 22:case 23:return I(t),co(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&fe(wa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ta(pa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Li(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ta(pa),_e(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ye(t),null;case 31:if(t.memoizedState!==null){if(I(t),t.alternate===null)throw Error(i(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(I(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(L),null;case 4:return _e(),null;case 10:return ta(t.type),null;case 22:case 23:return I(t),co(),e!==null&&fe(wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ta(pa),null;case 25:return null;default:return null}}function Hc(e,t){switch(Li(t),t.tag){case 3:ta(pa),_e();break;case 26:case 27:case 5:ye(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&I(t);break;case 13:I(t);break;case 19:fe(L);break;case 10:ta(t.type);break;case 22:case 23:I(t),co(),e!==null&&fe(wa);break;case 24:ta(pa)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ro(t,n)}catch(t){Ku(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Rd(r,e.type,n,t),r[pt]=t}catch(t){Ku(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ef(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ef(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function U(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=on));else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(U(e,t,n),e=e.sibling;e!==null;)U(e,t,n),e=e.sibling}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ld(t,r,n),t[ft]=e,t[pt]=n}catch(t){Ku(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Vd=up,e=Nr(e),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Hd={focusedElem:e,selectionRange:n},up=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:rf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,al=e;break}al=t.return}}function W(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:xl(e,n),r&4&&Uc(5,n);break;case 1:if(xl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(xl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{ro(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&el(n);case 26:case 5:xl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:xl(e,n);break;case 31:xl(e,n),r&4&&fl(e,n);break;case 13:xl(e,n),r&4&&pl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),uf(e,n))));break;case 22:if(r=n.memoizedState!==null||tl,!r){t=t!==null&&t.memoizedState!==null||nl,i=tl;var a=nl;tl=r,(nl=t)&&!a?Cl(e,n,(n.subtreeFlags&8772)!=0):xl(e,n),tl=i,nl=a}break;case 30:break;default:xl(e,n)}}function sl(e){var t=e.alternate;t!==null&&(e.alternate=null,sl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var cl=null,ll=!1;function ul(e,t,n){for(n=n.child;n!==null;)dl(e,t,n),n=n.sibling}function dl(e,t,n){if(A&&typeof A.onCommitFiberUnmount==`function`)try{A.onCommitFiberUnmount(Ve,n)}catch{}switch(n.tag){case 26:nl||Jc(n,t),ul(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:nl||Jc(n,t);var r=cl,i=ll;ef(n.type)&&(cl=n.stateNode,ll=!1),ul(e,t,n),gf(n.stateNode),cl=r,ll=i;break;case 5:nl||Jc(n,t);case 6:if(r=cl,i=ll,cl=null,ul(e,t,n),cl=r,ll=i,cl!==null)if(ll)try{(cl.nodeType===9?cl.body:cl.nodeName===`HTML`?cl.ownerDocument.body:cl).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{cl.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:cl!==null&&(ll?(e=cl,tf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Fp(e)):tf(cl,n.stateNode));break;case 4:r=cl,i=ll,cl=n.stateNode.containerInfo,ll=!0,ul(e,t,n),cl=r,ll=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),nl||Wc(4,n,t),ul(e,t,n);break;case 1:nl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),ul(e,t,n);break;case 21:ul(e,t,n);break;case 22:nl=(r=nl)||n.memoizedState!==null,ul(e,t,n),nl=r;break;default:ul(e,t,n)}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fp(e)}catch(e){Ku(t,t.return,e)}}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fp(e)}catch(e){Ku(t,t.return,e)}}function ml(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new il),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new il),t;default:throw Error(i(435,e.tag))}}function hl(e,t){var n=ml(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function gl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(ef(c.type)){cl=c.stateNode,ll=!1;break a}break;case 5:cl=c.stateNode,ll=!1;break a;case 3:case 4:cl=c.stateNode.containerInfo,ll=!0;break a}c=c.return}if(cl===null)throw Error(i(160));dl(o,s,a),cl=null,ll=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)vl(t,e),t=t.sibling}var _l=null;function vl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:gl(t,e),yl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:gl(t,e),yl(e),r&512&&(nl||n===null||Jc(n,n.return)),r&64&&tl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=_l;if(gl(t,e),yl(e),r&512&&(nl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[yt]||o[ft]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ld(o,r,n),o[ft]=e,Tt(o),r=o;break a;case`link`:var s=Wf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Wf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ft]=e,Tt(o),r=o}e.stateNode=r}else Gf(a,e.type,e.stateNode);else e.stateNode=zf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Gf(a,e.type,e.stateNode):zf(a,r,e.memoizedProps))}break;case 27:gl(t,e),yl(e),r&512&&(nl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(gl(t,e),yl(e),r&512&&(nl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{Zt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(rl=!0);break;case 6:if(gl(t,e),yl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Uf=null,a=_l,_l=yf(t.containerInfo),gl(t,e),_l=a,yl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fp(t.containerInfo)}catch(t){Ku(e,e.return,t)}rl&&(rl=!1,bl(e));break;case 4:r=_l,_l=yf(e.stateNode.containerInfo),gl(t,e),yl(e),_l=r;break;case 12:gl(t,e),yl(e);break;case 31:gl(t,e),yl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 13:gl(t,e),yl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=Me()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=tl,d=nl;if(tl=u||a,nl=d||l,gl(t,e),nl=d,tl=u,yl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||tl||nl||Sl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?nf(m,!0):nf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,hl(e,n))));break;case 19:gl(t,e),yl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 30:break;case 21:break;default:gl(t,e),yl(e)}}function yl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;$c(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Zt(o,``),n.flags&=-33),$c(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;U(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;bl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function xl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)W(e,t.alternate,t),t=t.sibling}function Sl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),Sl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),Sl(t);break;case 27:gf(t.stateNode);case 26:case 5:Jc(t,t.return),Sl(t);break;case 22:t.memoizedState===null&&Sl(t);break;case 30:Sl(t);break;default:Sl(t)}e=e.sibling}}function Cl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Cl(i,a,n),Uc(4,a);break;case 1:if(Cl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)no(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:el(a);case 26:case 5:Cl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:Cl(i,a,n);break;case 31:Cl(i,a,n),n&&o&4&&fl(i,a);break;case 13:Cl(i,a,n),n&&o&4&&pl(i,a);break;case 22:a.memoizedState===null&&Cl(i,a,n),qc(a,a.return);break;case 30:break;default:Cl(i,a,n)}t=t.sibling}}function wl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ha(n))}function Tl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ha(e))}function El(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dl(e,t,n,r),t=t.sibling}function Dl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:El(e,t,n,r),i&2048&&Uc(9,t);break;case 1:El(e,t,n,r);break;case 3:El(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ha(e)));break;case 12:if(i&2048){El(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else El(e,t,n,r);break;case 31:El(e,t,n,r);break;case 13:El(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?El(e,t,n,r):(a._visibility|=2,Ol(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?El(e,t,n,r):kl(e,t),i&2048&&wl(o,t);break;case 24:El(e,t,n,r),i&2048&&Tl(t.alternate,t);break;default:El(e,t,n,r)}}function Ol(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ol(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ol(a,o,s,c,i)):u._visibility&2?Ol(a,o,s,c,i):kl(a,o),i&&l&2048&&wl(o.alternate,o);break;case 24:Ol(a,o,s,c,i),i&&l&2048&&Tl(o.alternate,o);break;default:Ol(a,o,s,c,i)}t=t.sibling}}function kl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:kl(n,r),i&2048&&wl(r.alternate,r);break;case 24:kl(n,r),i&2048&&Tl(r.alternate,r);break;default:kl(n,r)}t=t.sibling}}var Al=8192;function jl(e,t,n){if(e.subtreeFlags&Al)for(e=e.child;e!==null;)Ml(e,t,n),e=e.sibling}function Ml(e,t,n){switch(e.tag){case 26:jl(e,t,n),e.flags&Al&&e.memoizedState!==null&&Jf(n,_l,e.memoizedState,e.memoizedProps);break;case 5:jl(e,t,n);break;case 3:case 4:var r=_l;_l=yf(e.stateNode.containerInfo),jl(e,t,n),_l=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Al,Al=16777216,jl(e,t,n),Al=r):jl(e,t,n));break;default:jl(e,t,n)}}function Nl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Pl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Ll(r,e)}Nl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fl(e),e=e.sibling}function Fl(e){switch(e.tag){case 0:case 11:case 15:Pl(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Pl(e);break;case 12:Pl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Il(e)):Pl(e);break;default:Pl(e)}}function Il(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Ll(r,e)}Nl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Il(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Il(t));break;default:Il(t)}e=e.sibling}}function Ll(e,t){for(;al!==null;){var n=al;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ha(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,al=r;else a:for(n=e;al!==null;){r=al;var i=r.sibling,a=r.return;if(sl(r),r===n){al=null;break a}if(i!==null){i.return=a,al=i;break a}al=a}}}var Rl={getCacheForType:function(e){var t=sa(pa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return sa(pa).controller.signal}},zl=typeof WeakMap==`function`?WeakMap:Map,G=0,Bl=null,K=null,q=0,J=0,Vl=null,Hl=!1,Ul=!1,Wl=!1,Gl=0,Y=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return G&2&&q!==0?q&-q:T.T===null?lt():pd()}function hu(){if(Yl===0)if(!(q&536870912)||N){var e=Je;Je<<=1,!(Je&3932160)&&(Je=262144),Yl=e}else Yl=536870912;return e=P.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Bl&&(J===2||J===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,q,Yl,!1)),nt(e,n),(!(G&2)||e!==Bl)&&(e===Bl&&(!(G&2)&&(ql|=n),Y===4&&bu(e,q,Yl,!1)),ad(e))}function _u(e,t,n){if(G&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||$e(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Ul&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Wl&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Hl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-Me(),10<a)){if(bu(r,t,Yl,!Hl),Ze(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Yd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Hl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Hl,o,null,-0,0)}}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},Ml(t,a,d);var m=(a&62914560)===a?eu-Me():(a&4194048)===a?tu-Me():0;if(m=Xf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Or(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ue(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&it(e,n,t)}function xu(){return G&6?!0:(od(0,!1),!1)}function Su(){if(K!==null){if(J===0)var e=K.return;else e=K,$i=Qi=null,jo(e),Ra=null,za=0,e=K;for(;e!==null;)Hc(e.alternate,e),e=e.return;K=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Xd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Bl=e,K=n=gi(e.current,null),q=t,J=0,Vl=null,Hl=!1,Ul=$e(e,t),Wl=!1,Xl=Yl=Jl=ql=Kl=Y=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ue(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,oi(),n}function wu(e,t){R=null,T.H=zs,t===Oa||t===Aa?(t=Ia(),J=3):t===ka?(t=Ia(),J=4):J=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,K===null&&(Y=1,Zs(e,wi(t,e.current)))}function Tu(){var e=P.current;return e===null?!0:(q&4194048)===q?lo===null:(q&62914560)===q||q&536870912?e===lo:!1}function Eu(){var e=T.H;return T.H=zs,e===null?zs:e}function Du(){var e=T.A;return T.A=Rl,e}function Ou(){Y=4,Hl||(q&4194048)!==q&&P.current!==null||(Ul=!0),!(Kl&134217727)&&!(ql&134217727)||Bl===null||bu(Bl,q,Yl,!1)}function ku(e,t,n){var r=G;G|=2;var i=Eu(),a=Du();(Bl!==e||q!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Y;a:do try{if(J!==0&&K!==null){var s=K,c=Vl;switch(J){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:P.current===null&&(t=!0);var l=J;if(J=0,Vl=null,Fu(e,s,c,l),n&&Ul){o=0;break a}break;default:l=J,J=0,Vl=null,Fu(e,s,c,l)}}Au(),o=Y;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,$i=Qi=null,G=r,T.H=i,T.A=a,K===null&&(Bl=null,q=0,oi()),o}function Au(){for(;K!==null;)Nu(K)}function ju(e,t){var n=G;G|=2;var r=Eu(),a=Du();Bl!==e||q!==t?(ru=null,nu=Me()+500,Cu(e,t)):Ul=$e(e,t);a:do try{if(J!==0&&K!==null){t=K;var o=Vl;b:switch(J){case 1:J=0,Vl=null,Fu(e,t,o,1);break;case 2:case 9:if(Ma(o)){J=0,Vl=null,Pu(t);break}t=function(){J!==2&&J!==9||Bl!==e||(J=7),ad(e)},o.then(t,t);break a;case 3:J=7;break a;case 4:J=5;break a;case 7:Ma(o)?(J=0,Vl=null,Pu(t)):(J=0,Vl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(K.tag){case 26:s=K.memoizedState;case 5:case 27:var c=K;if(s?qf(s):c.stateNode.complete){J=0,Vl=null;var l=c.sibling;if(l!==null)K=l;else{var u=c.return;u===null?K=null:(K=u,Iu(u))}break b}}J=0,Vl=null,Fu(e,t,o,5);break;case 6:J=0,Vl=null,Fu(e,t,o,6);break;case 8:Su(),Y=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return $i=Qi=null,T.H=r,T.A=a,G=n,K===null?(Bl=null,q=0,oi(),Y):0}function Mu(){for(;K!==null&&!Ae();)Nu(K)}function Nu(e){var t=Nc(e.alternate,e,Gl);e.memoizedProps=e.pendingProps,t===null?Iu(e):K=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:jo(t);default:Hc(n,t),t=K=_i(t,Gl),t=Nc(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):K=t}function Fu(e,t,n,r){$i=Qi=null,jo(t),Ra=null,za=0;var i=t.return;try{if(nc(e,i,t,n,q)){Y=1,Zs(e,wi(n,e.current)),K=null;return}}catch(t){if(i!==null)throw K=i,t;Y=1,Zs(e,wi(n,e.current)),K=null;return}t.flags&32768?(N||r===1?e=!0:Ul||q&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=P.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Hl);return}e=t.return;var n=Bc(t.alternate,t,Gl);if(n!==null){K=n;return}if(t=t.sibling,t!==null){K=t;return}K=t=e}while(t!==null);Y===0&&(Y=5)}function Lu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,K=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){K=e;return}K=e=n}while(e!==null);Y=6,K=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(G&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ai,rt(e,n,o,s,c,l),e===Bl&&(K=Bl=null,q=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(Ie,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=T.T,T.T=null,a=E.p,E.p=2,s=G,G|=4;try{ol(e,t,n)}finally{G=s,E.p=a,T.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=G;G|=4;try{vl(t,e);var a=Hd,o=Nr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Mr(s.ownerDocument.documentElement,s)){if(c!==null&&Pr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=jr(s,h),v=jr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}up=!!Vd,Hd=Vd=null}finally{G=i,E.p=r,T.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=G;G|=4;try{W(e,t.alternate,t)}finally{G=i,E.p=r,T.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,je();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),ct(n),t=t.stateNode,A&&typeof A.onCommitFiberRoot==`function`)try{A.onCommitFiberRoot(Ve,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=T.T,i=E.p,E.p=2,T.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{T.T=t,E.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ha(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=ct(cu),r=T.T,a=E.p;try{E.p=32>n?32:n,T.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,G&6)throw Error(i(331));var c=G;if(G|=4,Fl(o.current),Dl(o,o.current,s,n),G=c,od(0,!1),A&&typeof A.onPostCommitFiberRoot==`function`)try{A.onPostCommitFiberRoot(Ve,o)}catch{}return!0}finally{E.p=a,T.T=r,Hu(e,t)}}function Gu(e,t,n){t=wi(n,t),t=$s(e.stateNode,t,2),e=Xa(e,t,2),e!==null&&(nt(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=wi(n,e),n=ec(2),r=Xa(t,n,2),r!==null&&(tc(n,r,t,e),nt(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Wl=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>Me()-eu?!(G&2)&&Cu(e,0):Jl|=n,Xl===q&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=et()),e=li(e,t),e!==null&&(nt(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return Oe(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ue(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=q,a=Ze(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||$e(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Jd()&&(e=id);for(var t=Me(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ue(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=j(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Bl,n=q,n=Ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(J===2||J===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ke(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||$e(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ke(r),ct(n)){case 2:case 8:n=Fe;break;case 32:n=Ie;break;case 268435456:n=Re;break;default:n=Ie}return r=ud.bind(null,e),n=Oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ke(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=q;return r=Ze(e,e===Bl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,Me()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){Qd(function(){G&6?Oe(Pe,sd):cd()})}function pd(){if(id===0){var e=va;e===0&&(e=qe,qe<<=1,!(qe&261888)&&(qe=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:an(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Dn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<ei.length;_d++){var vd=ei[_d];ti(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}ti(Kr,`onAnimationEnd`),ti(qr,`onAnimationIteration`),ti(Jr,`onAnimationStart`),ti(`dblclick`,`onDoubleClick`),ti(`focusin`,`onFocus`),ti(`focusout`,`onBlur`),ti(Yr,`onTransitionRun`),ti(Xr,`onTransitionStart`),ti(Zr,`onTransitionCancel`),ti(Qr,`onTransitionEnd`),kt(`onMouseEnter`,[`mouseout`,`mouseover`]),kt(`onMouseLeave`,[`mouseout`,`mouseover`]),kt(`onPointerEnter`,[`pointerout`,`pointerover`]),kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ot(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ot(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ot(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ot(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){ni(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){ni(e)}i.currentTarget=null,a=c}}}}function X(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Td(t,e,2,!1),n.add(r))}function Sd(e,t,n){var r=0;t&&(r|=4),Td(n,e,r,t)}var Cd=`_reactListening`+Math.random().toString(36).slice(2);function wd(e){if(!e[Cd]){e[Cd]=!0,Et.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Sd(t,!1,e),Sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Sd(`selectionchange`,!1,t))}}function Td(e,t,n,r){switch(_p(t)){case 2:var i=dp;break;case 8:i=fp;break;default:i=pp}n=i.bind(null,t,n,e),i=void 0,!gn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Ed(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=xt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}pn(function(){var r=a,i=cn(n),s=[];a:{var c=$r.get(e);if(c!==void 0){var l=Dn,u=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:l=Gn;break;case`focusin`:u=`focus`,l=In;break;case`focusout`:u=`blur`,l=In;break;case`beforeblur`:case`afterblur`:l=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=qn;break;case Kr:case qr:case Jr:l=Ln;break;case Qr:l=Jn;break;case`scroll`:case`scrollend`:l=kn;break;case`wheel`:l=Yn;break;case`copy`:case`cut`:case`paste`:l=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Kn;break;case`toggle`:case`beforetoggle`:l=Xn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=mn(m,p),g!=null&&d.push(Dd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==sn&&(u=n.relatedTarget||n.fromElement)&&(xt(u)||u[mt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?xt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Pn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Ct(l),h=u==null?c:Ct(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,xt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=kd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ad(s,c,l,d,!1),u!==null&&f!==null&&Ad(s,f,u,d,!0)}}a:{if(c=r?Ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=gr;else if(ur(c))if(_r)v=Er;else{v=wr;var y=Cr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&M(r.elementType)&&(v=gr):v=Tr;if(v&&=v(e,r)){dr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&qt(c,`number`,c.value)}switch(y=r?Ct(r):window,e){case`focusin`:(ur(y)||y.contentEditable===`true`)&&(Ir=y,Lr=r,Rr=null);break;case`focusout`:Rr=Lr=Ir=null;break;case`mousedown`:zr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:zr=!1,Br(s,n,i);break;case`selectionchange`:if(Fr)break;case`keydown`:case`keyup`:Br(s,n,i)}var b;if(Qn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else or?ir(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(tr&&n.locale!==`ko`&&(or||x!==`onCompositionStart`?x===`onCompositionEnd`&&or&&(b=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,or=!0)),y=Od(r,x),0<y.length&&(x=new zn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=ar(n),b!==null&&(x.data=b)))),(b=er?sr(e,n):cr(e,n))&&(x=Od(r,`onBeforeInput`),0<x.length&&(y=new zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Dd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Od(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=mn(e,n),i!=null&&r.unshift(Dd(e,i,a)),i=mn(e,t),i!=null&&r.push(Dd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ad(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=mn(n,a),l!=null&&o.unshift(Dd(n,l,c))):i||(l=mn(n,a),l!=null&&o.push(Dd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var jd=/\r\n?/g,Md=/\u0000|\uFFFD/g;function Nd(e){return(typeof e==`string`?e:``+e).replace(jd,`
|
|
17
|
+
`).replace(Md,``)}function Pd(e,t){return t=Nd(t),Nd(e)===t}function Fd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Zt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:tn(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Fd(e,t,`name`,a.name,a,null),Fd(e,t,`formEncType`,a.formEncType,a,null),Fd(e,t,`formMethod`,a.formMethod,a,null),Fd(e,t,`formTarget`,a.formTarget,a,null)):(Fd(e,t,`encType`,a.encType,a,null),Fd(e,t,`method`,a.method,a,null),Fd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=an(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:X(`beforetoggle`,e),X(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=nn.get(n)||n,Pt(e,n,r))}}function Id(e,t,n,r,a,o){switch(n){case`style`:tn(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Zt(e,``+r);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=on);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[pt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}}}function Ld(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:X(`error`,e),X(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,o,s,n,null)}}a&&Fd(e,t,`srcSet`,n.srcSet,n,null),r&&Fd(e,t,`src`,n.src,n,null);return;case`input`:X(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Fd(e,t,r,d,n,null)}}Kt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in X(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Fd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Jt(e,!!r,n,!0):Jt(e,!!r,t,!1);return;case`textarea`:for(s in X(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Fd(e,t,s,c,n,null)}Xt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Fd(e,t,l,r,n,null)}return;case`dialog`:X(`beforetoggle`,e),X(`toggle`,e),X(`cancel`,e),X(`close`,e);break;case`iframe`:case`object`:X(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)X(yd[r],e);break;case`image`:X(`error`,e),X(`load`,e);break;case`details`:X(`toggle`,e);break;case`embed`:case`source`:case`link`:X(`error`,e),X(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,u,r,n,null)}return;default:if(M(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Id(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Fd(e,t,c,r,n,null))}function Rd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Fd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Fd(e,t,p,m,r,f)}}Gt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Fd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Fd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Jt(e,!!n,n?[]:``,!1):Jt(e,!!n,t,!0)):Jt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Fd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Fd(e,t,s,a,r,o)}Yt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Fd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Fd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Fd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Fd(e,t,u,p,r,m)}return;default:if(M(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Id(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Id(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Fd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Fd(e,t,f,p,r,m)}function zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Bd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Vd=null,Hd=null;function Ud(e){return e.nodeType===9?e:e.ownerDocument}function Wd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Gd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Kd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qd=null;function Jd(){var e=window.event;return e&&e.type===`popstate`?e===qd?!1:(qd=e,!0):(qd=null,!1)}var Yd=typeof setTimeout==`function`?setTimeout:void 0,Xd=typeof clearTimeout==`function`?clearTimeout:void 0,Zd=typeof Promise==`function`?Promise:void 0,Qd=typeof queueMicrotask==`function`?queueMicrotask:Zd===void 0?Yd:function(e){return Zd.resolve(null).then(e).catch($d)};function $d(e){setTimeout(function(){throw e})}function ef(e){return e===`head`}function tf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)gf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,gf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&gf(e.ownerDocument.body);n=i}while(n);Fp(t)}function nf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rf(n),bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function af(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=df(e.nextSibling),e===null)break}return null}function of(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=df(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=df(e.nextSibling),e===null))return null;return e}function cf(e){return e.data===`$?`||e.data===`$~`}function lf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function uf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function df(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ff=null;function pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return df(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hf(e,t,n){switch(t=Ud(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bt(e)}var _f=new Map,vf=new Set;function yf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var bf=E.d;E.d={f:xf,r:Sf,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function xf(){var e=bf.f(),t=xu();return e||t}function Sf(e){var t=St(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):bf.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),vf.has(i)||(vf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ld(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Tf(e){bf.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){bf.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){bf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Nf(e);break;case`script`:a=Lf(e)}_f.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),_f.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Pf(a))||t===`script`&&r.querySelector(Rf(a))||(t=r.createElement(`link`),Ld(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Of(e,t){bf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Lf(e)}if(!_f.has(a)&&(e=p({rel:`modulepreload`,href:e},t),_f.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Rf(a)))return}r=n.createElement(`link`),Ld(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function kf(e,t,n){bf.S(e,t,n);var r=Cf;if(r&&e){var i=wt(r).hoistableStyles,a=Nf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Pf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=_f.get(a))&&Vf(e,n);var c=o=r.createElement(`link`);Tt(c),Ld(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Bf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){bf.X(e,t);var n=Cf;if(n&&e){var r=wt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=p({src:e,async:!0},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),Tt(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){bf.M(e,t);var n=Cf;if(n&&e){var r=wt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),Tt(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=he.current)?yf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Nf(n.href),n=wt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Nf(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Pf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),_f.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_f.set(e,n),o||If(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Lf(n),n=wt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Nf(e){return`href="`+Wt(e)+`"`}function Pf(e){return`link[rel="stylesheet"][`+e+`]`}function Ff(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function If(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ld(t,`link`,n),Tt(t),e.head.appendChild(t))}function Lf(e){return`[src="`+Wt(e)+`"]`}function Rf(e){return`script[async]`+e}function zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Ld(r,`style`,a),Bf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Nf(n.href);var o=e.querySelector(Pf(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Ff(n),(a=_f.get(a))&&Vf(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ld(o,`link`,r),t.state.loading|=4,Bf(o,n.precedence,e),t.instance=o;case`script`:return o=Lf(n.src),(a=e.querySelector(Rf(o)))?(t.instance=a,Tt(a),a):(r=n,(a=_f.get(o))&&(r=p({},n),Hf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),Ld(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Bf(r,n.precedence,e));return t.instance}function Bf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Uf=null;function Wf(e,t,n){if(Uf===null){var r=new Map,i=Uf=new Map;i.set(n,r)}else i=Uf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Kf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Jf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Nf(r.href),a=t.querySelector(Pf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Zf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Ff(r),(i=_f.get(i))&&Vf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ld(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Zf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Yf=0;function Xf(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Yf===0&&(Yf=62500*Bd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qf=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qf=new Map,t.forEach(ep,e),Qf=null,Zf.call(e))}function ep(e,t){if(!(t.state.loading&4)){var n=Qf.get(e);if(n)var r=n.get(null);else{n=new Map,Qf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Zf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var tp={$$typeof:x,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function np(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function rp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new np(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=mi(3,null,null,t),e.current=a,a.stateNode=e,t=ma(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},qa(a),e}function ip(e){return e?(e=fi,e):fi}function ap(e,t,n,r,i,a){i=ip(i),r.context===null?r.context=i:r.pendingContext=i,r=Ya(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Xa(e,r,t),n!==null&&(gu(n,e,t),Za(n,e,t))}function op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function sp(e,t){op(e,t),(e=e.alternate)&&op(e,t)}function cp(e){if(e.tag===13||e.tag===31){var t=li(e,67108864);t!==null&&gu(t,e,67108864),sp(e,67108864)}}function lp(e){if(e.tag===13||e.tag===31){var t=mu();t=st(t);var n=li(e,t);n!==null&&gu(n,e,t),sp(e,t)}}var up=!0;function dp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=2,pp(e,t,n,r)}finally{E.p=a,T.T=i}}function fp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=8,pp(e,t,n,r)}finally{E.p=a,T.T=i}}function pp(e,t,n,r){if(up){var i=mp(r);if(i===null)Ed(e,t,r,hp,n),Ep(e,r);else if(Op(i,e,t,n,r))r.stopPropagation();else if(Ep(e,r),t&4&&-1<Tp.indexOf(e)){for(;i!==null;){var a=St(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}ad(a),!(G&6)&&(nu=Me()+500,od(0,!1))}}break;case 31:case 13:s=li(a,2),s!==null&&gu(s,a,2),xu(),sp(a,2)}if(a=mp(r),a===null&&Ed(e,t,r,hp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function mp(e){return e=cn(e),gp(e)}var hp=null;function gp(e){if(hp=null,e=xt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return hp=e,null}function _p(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ne()){case Pe:return 2;case Fe:return 8;case Ie:case Le:return 32;case Re:return 268435456;default:return 32}default:return 32}}var vp=!1,yp=null,bp=null,xp=null,Sp=new Map,Cp=new Map,wp=[],Tp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ep(e,t){switch(e){case`focusin`:case`focusout`:yp=null;break;case`dragenter`:case`dragleave`:bp=null;break;case`mouseover`:case`mouseout`:xp=null;break;case`pointerover`:case`pointerout`:Sp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Cp.delete(t.pointerId)}}function Dp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=St(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Op(e,t,n,r,i){switch(t){case`focusin`:return yp=Dp(yp,e,t,n,r,i),!0;case`dragenter`:return bp=Dp(bp,e,t,n,r,i),!0;case`mouseover`:return xp=Dp(xp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Sp.set(a,Dp(Sp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Cp.set(a,Dp(Cp.get(a)||null,e,t,n,r,i)),!0}return!1}function kp(e){var t=xt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ut(e.priority,function(){lp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){lp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sn=r,n.target.dispatchEvent(r),sn=null}else return t=St(n),t!==null&&cp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ap(e)&&n.delete(t)}function Mp(){vp=!1,yp!==null&&Ap(yp)&&(yp=null),bp!==null&&Ap(bp)&&(bp=null),xp!==null&&Ap(xp)&&(xp=null),Sp.forEach(jp),Cp.forEach(jp)}function Z(e,n){e.blockedOn===n&&(e.blockedOn=null,vp||(vp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(gp(r||n)===null)continue;break}var a=St(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Z(t,e)}yp!==null&&Z(yp,e),bp!==null&&Z(bp,e),xp!==null&&Z(xp,e),Sp.forEach(t),Cp.forEach(t);for(var n=0;n<wp.length;n++){var r=wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wp.length&&(n=wp[0],n.blockedOn===null);)kp(n),n.blockedOn===null&&wp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(gp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Q(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Ip(e){this._internalRoot=e}Lp.prototype.render=Ip.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ap(n,mu(),e,t,null,null)},Lp.prototype.unmount=Ip.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ap(e.current,2,null,e,null,null),xu(),t[mt]=null}};function Lp(e){this._internalRoot=e}Lp.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wp.length&&t!==0&&t<wp[n].priority;n++);wp.splice(n,0,e),n===0&&kp(e)}};var Rp=n.version;if(Rp!==`19.2.7`)throw Error(i(527,Rp,`19.2.7`));E.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var zp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:T,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bp.isDisabled&&Bp.supportsFiber)try{Ve=Bp.inject(zp),A=Bp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=rp(e,1,!1,null,null,n,r,null,o,s,c,Q),e[mt]=t.current,wd(e),new Ip(t)}})),en=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=$t()}))();function tn(e,t){return`color-mix(in srgb, ${e} ${t}%, transparent)`}var M={void:A(`surfaceVoid`),surface:A(`surfaceBase`),surfaceSelected:A(`surfaceSelected`),surfaceHeader:A(`surfaceDetailHeader`),surfaceSection:A(`surfaceSection`),border:A(`borderPanel`),borderStrong:A(`borderDivider`),textEmphasis:A(`textEmphasis`),text:A(`textSecondary`),textMeta:A(`semanticMetadata`),textMuted:A(`textMuted`),error:A(`semanticError`),success:A(`semanticSuccess`),system:A(`semanticSystem`),warning:A(`semanticWarning`)};function nn(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)|0;let n=We();return n[Math.abs(t)%n.length]??M.system}var rn=e=>`color-mix(in srgb, ${e} 72%, white)`,an=We(),on=[A(`surfaceVoid`),A(`semanticError`),A(`semanticSuccess`),A(`semanticWarning`),A(`semanticSystem`),an[0]??A(`semanticSystem`),an[2]??A(`semanticSystem`),A(`textSecondary`)],sn=[...on,...on.map(rn)];function cn(e){switch(e){case`ready`:case`succeeded`:case`running`:return`ready`;case`starting`:case`stopping`:return`active`;case`unready`:case`backoff`:case`blocked`:return`warn`;case`failed`:case`crashed`:return`bad`;default:return`idle`}}var ln={ready:M.success,active:M.system,warn:M.warning,bad:M.error,idle:M.textMuted};function un(e){if(e.state===`blocked`)return{indicator:`warning`,label:`blocked`,tone:`warn`};if(dn(e.state))return e.state===`unready`||e.state===`backoff`?{indicator:`warning`,label:e.state,tone:`warn`}:e.state===`starting`||e.state===`stopping`?{indicator:`transition`,label:e.state,tone:`active`}:{indicator:`running`,label:e.state,tone:`ready`};let t=e.kind===`task`?e.lastTask?.outcome:void 0;return t===`failed`||e.state===`failed`||e.state===`crashed`?{indicator:`failure`,label:e.lastTask?.timedOut?`timed out`:e.state===`crashed`?`crashed`:`failed`,tone:`bad`}:t===`succeeded`||e.state===`succeeded`?{indicator:`success`,label:`succeeded`,tone:`ready`}:{indicator:`idle`,label:e.state,tone:`idle`}}function dn(e){return e===`starting`||e===`running`||e===`ready`||e===`unready`||e===`backoff`||e===`stopping`}var fn=15e3;function pn(e,t){let n=[];e.removed&&n.push(`removed from config`),e.stale&&n.push(`config changed`),e.envDrift&&n.push(`env changed — restart to apply`),e.blockedBy!=null&&n.push(`blocked: ${e.blockedBy}`),e.unreadyReason!=null&&n.push(`unready: ${e.unreadyReason}`),dn(e.state)&&e.sawOutputAt==null&&e.startedAt!=null&&t-e.startedAt>fn&&n.push(`no output since start`),!dn(e.state)&&e.lastTask?.outcome===`failed`&&e.lastTask.reason!=null&&n.push(`last run failed: ${e.lastTask.reason}`);for(let t of e.degradedBy)n.push(`degraded by ${t}`);return e.restarts>=3&&n.push(`${e.restarts} restarts`),e.capability?.degraded===!0&&n.push(`tree ownership degraded (${e.capability.treeMechanism})`),n}function mn(e,t=Date.now()){return Object.entries(e.processes).map(([e,n])=>({id:e,node:n,tone:un(n).tone,chips:pn(n,t),stickyOverrides:n.detail.envVars.filter(e=>e.source===`override`).map(e=>e.name)})).sort((e,t)=>{let n=e.stickyOverrides.length>0?0:1,r=t.stickyOverrides.length>0?0:1;return n===r?e.id<t.id?-1:+(e.id>t.id):n-r})}function hn(e,t){let n=new Map(e.map(e=>[e.id,e]));return t.flatMap(e=>n.get(e)??[])}function gn(e){let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n.node.tags)){let n=t.get(e)??new Set;n.add(r),t.set(e,n)}return[...t.entries()].map(([e,t])=>({key:e,values:[...t].sort()})).sort((e,t)=>e.key<t.key?-1:+(e.key>t.key))}function _n(e){return t=>e.every(e=>{let[n,r]=e.split(`=`);return n!=null&&t[n]===r})}function vn(e,t,n){if(n.length===0)return!0;let r=_n(n);return e.some(e=>{let n=t[e];return n!=null&&r(n.tags)})}function yn(e,t,n){let r=n.trim().toLowerCase(),i=_n(t);return e.filter(e=>i(e.node.tags)?r===``||e.id.toLowerCase().includes(r):!1)}function bn(e,t){return e.detail.endpoints.map(e=>{let n=e.host===`127.0.0.1`||e.host===`localhost`,r=e.url!=null&&t;return{name:e.name,label:`${e.protocol}:${e.port}`,...r?{href:e.url}:{},remote:!t&&n}})}function xn(e){return e===`127.0.0.1`||e===`localhost`||e===`[::1]`}function Sn(e,t){let n=e.map(e=>t[e]?un(t[e]).label:`not-started`);return n.length===0?`stopped`:e.some(e=>t[e]&&un(t[e]).indicator===`failure`)?`failed`:n.filter(e=>cn(e)!==`idle`).length===0?`stopped`:n.some(e=>e===`starting`)?`starting`:n.filter(e=>e===`ready`||e===`succeeded`).length===n.length?`ready`:`partial`}function Cn(e,t){if(e.length===0)return null;let n=e.map(e=>t[e]);return n.every(e=>e!=null&&e.kind===`task`)?e.map((e,t)=>{let r=n[t],i=un(r);return i.indicator===`success`?{id:e,verdict:`pass`}:i.indicator===`failure`?{id:e,verdict:`fail`}:r.state===`blocked`?{id:e,verdict:`blocked`}:dn(r.state)?{id:e,verdict:`running`}:r.state===`stopped`?{id:e,verdict:`stopped`}:{id:e,verdict:`pending`}}):null}function wn({rows:e}){let t={running:0,success:0,failure:0,warning:0,transition:0,idle:0};for(let n of e)t[un(n.node).indicator]+=1;return(0,j.jsxs)(`section`,{className:`nc-overview nc-chrome`,"aria-label":`visible process overview`,children:[(0,j.jsxs)(`div`,{className:`nc-overview-heading`,children:[(0,j.jsx)(`span`,{className:`nc-section-title`,children:`process overview`}),(0,j.jsxs)(`span`,{children:[e.length,` visible`]})]}),(0,j.jsxs)(`div`,{className:`nc-overview-counts`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:t.running}),` running`]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:t.success}),` passed`]}),(0,j.jsxs)(`span`,{"data-attention":t.failure>0,children:[(0,j.jsx)(`strong`,{children:t.failure}),` failed`]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:t.idle}),` idle`]})]}),(t.warning>0||t.transition>0)&&(0,j.jsxs)(`p`,{className:`nc-overview-attention`,children:[t.transition,` starting / stopping · `,t.warning,` need attention`]}),(0,j.jsxs)(`details`,{className:`nc-state-legend`,children:[(0,j.jsx)(`summary`,{children:`status guide`}),(0,j.jsx)(`p`,{children:`● Pulsing green: running or ready. ✓ Green ring: completed successfully. × Red ring: failed, crashed or timed out.`}),(0,j.jsx)(`p`,{children:`! Amber: unready, retrying or blocked. Blue ring: starting or stopping. Muted ring: not started or deliberately stopped.`})]})]})}function Tn({node:e,compact:t=!1}){let n=un(e);return(0,j.jsxs)(`span`,{"aria-hidden":`true`,title:n.label,"data-process-indicator":n.indicator,className:`nc-process-indicator nc-indicator-${n.indicator}${t?` nc-indicator-compact`:``}`,style:{color:ln[n.tone],...n.indicator===`running`?{background:ln[n.tone]}:{}},children:[n.indicator===`success`&&(0,j.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,children:(0,j.jsx)(`path`,{d:`m4 8 2.5 2.5L12 5`})}),n.indicator===`failure`&&(0,j.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,children:(0,j.jsx)(`path`,{d:`m5 5 6 6m0-6-6 6`})}),n.indicator===`warning`&&(0,j.jsx)(`span`,{children:`!`}),n.indicator===`idle`&&n.label===`stopped`&&(0,j.jsx)(`span`,{children:`−`})]})}function En({state:e,tags:t,selected:n,onSelect:r,busy:i,act:a}){let o=Object.entries(e.groups).filter(([,n])=>vn(n.members,e.processes,t));return o.length===0?(0,j.jsx)(j.Fragment,{}):(0,j.jsxs)(`section`,{"aria-label":`groups`,style:{marginBottom:10},children:[(0,j.jsx)(`div`,{className:`nc-section-title`,children:`groups`}),(0,j.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,maxHeight:180,overflowY:`auto`,minWidth:0},children:o.map(([t,o])=>(0,j.jsx)(Dn,{name:t,members:o.members,state:e,selected:t===n,onSelect:r,busy:i,act:a},t))})]})}function Dn({name:e,members:t,state:n,selected:r,onSelect:i,busy:a,act:o}){let s=Cn(t,n.processes),c=s?.some(e=>e.verdict===`fail`),l=r?M.system:c?M.error:M.border;return(0,j.jsx)(`div`,{"data-group-row":e,className:`nc-group-row`,style:{background:r?M.surfaceSelected:M.surface,border:`1px solid ${l}`,borderRadius:8,padding:`6px 10px`,flexShrink:0,minWidth:0},children:(0,j.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:8,minWidth:0},children:[(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>i(e),title:r?`${e} — showing members below; click to release`:`${e} — show members below`,style:{alignItems:`stretch`,flexDirection:`column`,background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,display:`flex`,flex:1,gap:8,minWidth:0,padding:0,textAlign:`left`},children:[(0,j.jsxs)(`span`,{className:`nc-group-identity`,children:[(0,j.jsx)(`span`,{className:`nc-group-name`,style:{color:M.text,fontSize:13},children:e}),(0,j.jsxs)(`span`,{style:{color:M.textMuted,fontSize:11,flexShrink:0},children:[`(`,t.length,`)`]})]}),(0,j.jsxs)(`span`,{className:`nc-group-status`,children:[(0,j.jsx)(On,{members:t,state:n,tasks:s}),(0,j.jsx)(kn,{members:t,state:n})]})]}),s==null?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void o(`start`,t),style:jn,children:`up`}),(0,j.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void o(`stop`,t),style:jn,children:`down`})]}):(0,j.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void o(`restart`,t),style:jn,children:`run`})]})})}function On({members:e,state:t,tasks:n}){if(n!=null){let r=n.filter(e=>e.verdict===`fail`),i=n.filter(e=>e.verdict===`pass`).length,a=e.find(e=>{let n=t.processes[e];return n!=null&&dn(n.state)}),o=n.filter(e=>e.verdict===`blocked`).length,s=n.filter(e=>e.verdict===`stopped`).length,c=n.some(e=>e.verdict===`running`);return(0,j.jsx)(`span`,{style:{color:r.length>0?M.error:o?M.warning:c||i===n.length?M.success:M.textMuted,fontSize:11,overflowWrap:`anywhere`,minWidth:0,maxWidth:`100%`},children:r.length>0?`${r.length} failed`:c?`${i}/${n.length} · ${a??`running`}…`:o?`${o} blocked`:s?`${i}/${n.length} passed · ${s} stopped`:i===0?`pending`:`${i}/${n.length} passed`})}let r=Sn(e,t.processes);return(0,j.jsx)(`span`,{style:{color:An[r],fontSize:11,whiteSpace:`nowrap`},children:r})}function kn({members:e,state:t}){return(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`nc-group-members`,children:e.map(e=>(0,j.jsx)(`span`,{style:{display:`inline-flex`,flexShrink:0},title:`${e}: ${t.processes[e]?.state??`not-started`}`,children:t.processes[e]&&(0,j.jsx)(Tn,{node:t.processes[e],compact:!0})},e))})}var An={stopped:M.textMuted,partial:M.warning,starting:M.system,ready:M.success,failed:M.error},jn={background:`transparent`,border:`1px solid ${M.border}`,borderRadius:5,color:M.textMeta,cursor:`pointer`,fontSize:11,padding:`1px 7px`,flexShrink:0};function Mn(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.text==`string`&&typeof t.seq==`number`}function Nn(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.g==`number`&&typeof t.s==`number`&&typeof t.id==`string`&&Mn(t.line)}function Pn(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t;if(n.k===`merged-gap`){let e=n.dropped;return typeof e==`number`?{k:`merged-gap`,dropped:e}:null}if(n.k===`merged`){let e=n.entries;return!Array.isArray(e)||!e.every(Nn)?null:n.reset===!0?{k:`merged`,reset:!0,entries:e}:{k:`merged`,entries:e}}if(n.k===`search-result`){let e=n.entries;return typeof n.id!=`string`||!Array.isArray(e)||!e.every(Nn)||typeof n.complete!=`boolean`||typeof n.scanned!=`number`?null:{k:`search-result`,id:n.id,entries:e,complete:n.complete,scanned:n.scanned}}let r=n.proc;if(typeof r!=`string`)return null;if(n.k===`gap`){let e=n.dropped;return typeof e==`number`?{k:`gap`,proc:r,dropped:e}:null}if(n.k===`batch`){let e=n.lines;return!Array.isArray(e)||!e.every(Mn)?null:n.reset===!0?{k:`batch`,proc:r,reset:!0,lines:e}:{k:`batch`,proc:r,lines:e}}return null}var Fn=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[[(][0-9;?]*[A-Za-z]/g,In=/^\x1b\[([0-9;]*)m$/,Ln=sn.slice(0,8),Rn=sn.slice(8);function zn(e){let t={};return e.color!=null&&(t.color=e.color),e.background!=null&&(t.backgroundColor=e.background),e.bold===!0&&(t.fontWeight=`600`),e.dim===!0&&(t.opacity=`0.65`),e.italic===!0&&(t.fontStyle=`italic`),e.underline===!0&&(t.textDecoration=`underline`),t}function Bn(e,t){let n={...e},r=t===``?[`0`]:t.split(`;`);for(let e=0;e<r.length;e+=1){let t=Number(r[e]);if(Number.isFinite(t)){if(t===0)for(let e of Object.keys(n))delete n[e];else if(t===1)n.bold=!0;else if(t===2)n.dim=!0;else if(t===3)n.italic=!0;else if(t===4)n.underline=!0;else if(t===22)n.bold=!1,n.dim=!1;else if(t===23)n.italic=!1;else if(t===24)n.underline=!1;else if(t>=30&&t<=37)n.color=Ln[t-30];else if(t===39)delete n.color;else if(t>=40&&t<=47)n.background=Ln[t-40];else if(t===49)delete n.background;else if(t>=90&&t<=97)n.color=Rn[t-90];else if(t>=100&&t<=107)n.background=Rn[t-100];else if((t===38||t===48)&&r[e+1]===`5`){let i=Vn(Number(r[e+2]));i!=null&&(t===38?n.color=i:n.background=i),e+=2}else if((t===38||t===48)&&r[e+1]===`2`){let[i,a,o]=[Number(r[e+2]),Number(r[e+3]),Number(r[e+4])];if([i,a,o].every(e=>Number.isFinite(e)&&e>=0&&e<=255)){let e=`rgb(${i},${a},${o})`;t===38?n.color=e:n.background=e}e+=4}}}return n}function Vn(e){if(!Number.isFinite(e)||e<0||e>255)return null;if(e<8)return Ln[e]??null;if(e<16)return Rn[e-8]??null;if(e<232){let t=e=>e===0?0:55+e*40,n=e-16;return`rgb(${t(Math.floor(n/36))},${t(Math.floor(n/6)%6)},${t(n%6)})`}let t=8+(e-232)*10;return`rgb(${t},${t},${t})`}function Hn(e){let t=[],n={},r=0;for(Fn.lastIndex=0;;){let i=Fn.exec(e);if(i==null)break;i.index>r&&t.push({text:e.slice(r,i.index),style:zn(n)});let a=In.exec(i[0]);a!=null&&(n=Bn(n,a[1]??``)),r=i.index+i[0].length}return r<e.length&&t.push({text:e.slice(r),style:zn(n)}),t.length>0?t:[{text:``,style:{}}]}var Un=/\bhttps?:\/\/[^\s"'<>]+/g,Wn=/[.,;:!?]+$/;function Gn(e,t){let n=[],r=0;for(let i of e.matchAll(Un)){let a=Kn(i[0]);if(a===``)continue;let o=i.index;!t.allowLoopback&&Jn(a)||(o>r&&n.push({kind:`text`,text:e.slice(r,o)}),n.push({kind:`link`,text:a,href:a}),r=o+a.length)}return n.length===0?[{kind:`text`,text:e}]:(r<e.length&&n.push({kind:`text`,text:e.slice(r)}),n)}function Kn(e){let t=e.replace(Wn,``);for(;;){let e=t.at(-1)??``,n=e===`)`?`(`:e===`]`?`[`:null;if(n==null||t.split(n).length>=t.split(e).length)return t;t=t.slice(0,-1)}}function qn(e,t){let n=e.map(e=>e.text).join(``),r=[],i=0;for(let t of e)r.push(i),i+=t.text.length;let a=[],o=0;for(let i of Gn(n,t)){let t=o,n=o+i.text.length;o=n;let s=0;for(;s<e.length&&r[s]+e[s].text.length<=t;)s+=1;let c=[];for(;s<e.length&&r[s]<n;){let a=r[s]+e[s].text.length,o=i.text.slice(Math.max(t,r[s])-t,Math.min(n,a)-t);o.length>0&&c.push({text:o,style:e[s].style}),s+=1}if(i.kind===`link`)a.push({kind:`link`,href:i.href,pieces:c});else for(let e of c)a.push({kind:`text`,text:e.text,style:e.style})}return a}function Jn(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`0.0.0.0`||t===`[::1]`}catch{return!1}}var Yn=5e3;function Xn(e,t,n,r){if(e.kind===`proc`){if(r.k===`gap`&&r.proc===e.id)return{rows:nr(t,[rr(t.length,r.dropped)]),cursor:n};if(r.k!==`batch`||r.proc!==e.id)return null;let i=r.lines.map(e=>({key:`${e.seq}-${e.stream}`,text:e.text,gap:!1,ts:e.ts})),a=r.lines[r.lines.length-1]?.seq,o=r.reset===!0?a:Math.max(n.seq??0,a??0)||void 0;return{rows:r.reset===!0?i.slice(-5e3):nr(t,i),cursor:o==null?{}:{seq:o}}}if(r.k===`merged-gap`)return{rows:nr(t,[rr(t.length,r.dropped)]),cursor:n};if(r.k!==`merged`)return null;let i=r.entries.map(Qn),a=r.entries[r.entries.length-1]?.s,o=r.reset===!0?a:Math.max(n.s??0,a??0)||void 0;return{rows:r.reset===!0?i.slice(-5e3):nr(t,i),cursor:o==null?{}:{s:o}}}function Zn(e){return e.kind===`proc`?`proc:${e.id}`:`merged:${e.procs?.join(`,`)??`*`}`}function Qn(e){return{key:`${e.g}-${e.s}`,prefix:e.id,text:e.line.text,gap:!1,ts:e.line.ts}}function $n(e,t){return e.kind===`proc`?JSON.stringify({k:`sub`,proc:e.id,fromSeq:t.seq}):JSON.stringify({k:`sub-merged`,...e.procs==null?{}:{procs:e.procs},fromS:t.s})}function er(e){return JSON.stringify(e.kind===`proc`?{k:`unsub`,proc:e.id}:{k:`unsub-merged`})}function tr(e,t){return e.kind===`proc`?t.k===`batch`&&t.proc===e.id&&t.reset===!0:t.k===`merged`&&t.reset===!0}function nr(e,t){let n=[...e,...t];return n.length>5e3?n.slice(n.length-Yn):n}function rr(e,t){return{key:`gap-${e}`,text:`… ${t} lines dropped …`,gap:!0}}function ir(e,t,n){let r=new Set;if(e.kind===`proc`){if(n.keepProcs.has(e.id))for(let e of t.filter(e=>!e.gap).slice(-12))r.add(e.key)}else{let e=new Map;for(let n of t){if(n.gap||n.prefix==null)continue;let t=e.get(n.prefix)??[];t.push(n),e.set(n.prefix,t)}for(let[t,i]of e)if(n.keepProcs.has(t))for(let e of i.slice(-12))r.add(e.key)}let i=t.filter(e=>r.has(e.key)),a=t.length-i.length,o=new Date(n.now),s=String(o.getHours()).padStart(2,`0`),c=String(o.getMinutes()).padStart(2,`0`),l=i.length===0?``:e.kind===`proc`?` · kept the last ${i.length} line${i.length===1?``:`s`}`:` · kept ${i.length} lines from ${new Set(i.map(e=>e.prefix)).size} running processes`;return{rows:[...i,{key:`cleared-${n.now}`,text:`— cleared ${s}:${c}${l} · nothing was deleted; search covers the full history —`,gap:!0}],kept:i.length,dropped:a}}function ar(e){if(typeof e!=`object`||!e)return`expected an object`;let t={...e};return!Array.isArray(t.ids)||!t.ids.every(e=>typeof e==`string`&&e.length>0)?`expected ids`:t.token!=null&&(typeof t.token!=`string`||!t.token)?`expected token`:t.force!=null&&typeof t.force!=`boolean`?`expected force boolean`:t.force&&!t.token?`force requires a listener token`:{ids:t.ids,...typeof t.token==`string`?{token:t.token}:{},...typeof t.force==`boolean`?{force:t.force}:{}}}function or(e){if(typeof e!=`object`||!e)return`expected an object`;let t={...e};if(!Array.isArray(t.warnings)||!t.warnings.every(e=>typeof e==`string`)||!Array.isArray(t.listeners))return`expected listeners and warnings`;let n=[];for(let e of t.listeners){if(typeof e!=`object`||!e)return`invalid listener`;let t={...e};if(![t.id,t.endpoint,t.host,t.command].every(e=>typeof e==`string`)||!Number.isInteger(t.pid)||Number(t.pid)<1||!Number.isInteger(t.port)||Number(t.port)<1||Number(t.port)>65535||!(t.ppid===null||Number.isInteger(t.ppid)&&Number(t.ppid)>=0)||!(t.cwd===null||typeof t.cwd==`string`)||![t.startStamp,t.token,t.refusal].every(e=>e===null||typeof e==`string`))return`invalid listener`;n.push(e)}return{listeners:n,warnings:t.warnings}}var sr=fe.createChildDomain({domain:`err_nice_wire_connect`,schema:{connect_exhausted:D({message:({peerId:e,attempted:t})=>`connect() to peer [${e}] exhausted its transport chain (tried: ${t.join(`, `)||`none configured`}).`}),connect_closed:D({message:({peerId:e})=>`connect() to peer [${e}] on a closed WireClient — closed is terminal; create a new client.`}),dial_failed:D({message:({peerId:e,carrierLabel:t,reason:n,endpoint:r})=>`Dialing peer [${e}] over "${t}"${r==null?``:` against ${r}`} failed: ${n}`}),dial_unavailable:D({message:({carrierLabel:e})=>`Dial over "${e}" unavailable — createRequest returned null (no valid endpoint right now). A keep-alive redial parks on this until the next explicit connect()/dispatch.`}),endpoint_answered_non_protocol:D({message:({stage:e,expected:t,url:n,httpStatus:r,contentType:i,receivedKind:a,bodyPreview:o})=>{let s=r==null?a==null?`a response it could not decode`:`a "${a}" frame`:`an HTTP ${r}${i==null?``:` ${i}`} response`;return`[${e}] expected ${t??`a nice-wire frame`} but received ${s} — the endpoint answered but is not speaking the nice-wire protocol (wrong URL, an intercepting proxy/WAF, or a different server)${n==null?``:`. Dialed: ${n}`}${o==null?``:`. Body: ${JSON.stringify(o)}`}.`}}),endpoint_unreachable:D({message:({url:e,carrierLabel:t,reason:n})=>`Could not reach ${e??(t==null?`the endpoint`:`the "${t}" endpoint`)}: ${n} — nothing answered there (wrong host/port, the server is not running, or a firewall/offline network).`}),handshake_rejected:D({message:({stage:e,reason:t})=>`[${e}] rejected by peer: ${t}`}),protocol_unsupported:D({message:({protocolId:e})=>`Protocol "${e}" cannot speak on this connection — the peer did not advertise "proto:${e}" (or it is not registered here).`}),protocol_on_exchange_only:D({message:({protocolId:e})=>`Protocol "${e}" needs a duplex transport — this connection is exchange-only (request/reply), which carries only the lane.`}),protocol_security_blocked:D({message:({protocolId:e,securityLevel:t})=>`Protocol "${e}" frame blocked: connection is at security level "${t}" and the protocol did not opt into allowPlain.`}),binding_version_mismatch:D({message:({found:e,expected:t})=>`Persisted connection binding has schema version ${JSON.stringify(e)} (this build reads v${t}) — the binding is invalidated; the connection must re-handshake.`}),identity_pin_mismatch:D({message:({reason:e})=>`Handshake rejected by peer: ${e}. The peer has a different verify key pinned for this client identity (TOFU) — permanent until the client connects under a new persistent id or the peer's pin is removed; auto-redial parks on this.`})}});function cr(e,t){if(typeof t==`string`||t instanceof ArrayBuffer){e.send(t);return}e.send(new Uint8Array(t))}function lr(e){try{let t=new URL(e);return`${t.host}${t.pathname}`}catch{return e}}function ur(e){let t=!1,n=e.readyState===WebSocket.OPEN,r,i,a=[],o=e=>{r==null?a.push(e):r(e)};return e.addEventListener(`open`,()=>{n=!0}),e.addEventListener(`message`,async e=>{let t=await mr(e.data);t!==void 0&&o(t)}),e.addEventListener(`close`,e=>{n&&!t&&console.warn(`WebSocket closed:`,e),i?.()}),e.addEventListener(`error`,()=>{n&&console.warn(`WebSocket error: ${pr(e)}`),i?.()}),{ready:new Promise((t,n)=>{if(e.readyState===WebSocket.OPEN){t();return}e.addEventListener(`open`,()=>t(),{once:!0}),e.addEventListener(`error`,()=>n(dr(e)),{once:!0}),e.addEventListener(`close`,t=>n(fr(e,`WebSocket closed before open (code=${t.code})`)),{once:!0})}),isOpen:()=>e.readyState===WebSocket.OPEN,send:t=>cr(e,t),attach:e=>{r=e.onMessage,i=e.onClose;for(let t of a)e.onMessage(t);a.length=0},close:()=>{t=!0;try{e.close()}catch{}},get label(){return e.url!=null&&e.url!==``?e.url:void 0}}}function dr(e){return fr(e,`WebSocket dial failed`)}function fr(e,t){return sr.fromId(`endpoint_unreachable`,{url:e.url!=null&&e.url!==``?e.url:void 0,carrierLabel:`ws`,reason:t})}function pr(e){return e.url!=null&&e.url!==``?e.url:`(no url)`}async function mr(e){if(typeof e==`string`||e instanceof ArrayBuffer||e instanceof Uint8Array)return e;if(typeof Blob<`u`&&e instanceof Blob)return await e.arrayBuffer()}function hr(e,t={}){let n=t.createWebSocket??(e=>new WebSocket(e));return{carrierLabel:`ws`,open:t=>{let r=e(t);if(r==null)throw sr.fromId(`dial_unavailable`,{carrierLabel:`ws`});let i=n(r.url);return i.binaryType=`arraybuffer`,ur(i)},getCacheKey:t.getCacheKey??(t=>[e(t)?.url??`ws:(unavailable)`]),getRouteInfo:t.getRouteInfo??(t=>{let n=e(t)?.url;return n==null?{carrierLabel:`ws`,summary:`ws (unavailable)`}:{carrierLabel:`ws`,url:n,summary:`ws ${lr(n)}`}})}}var gr=200,_r=/[\u0000-\u001F\u007F-\u009F]+/g;function vr(e){if(typeof e!=`string`)return;let t=e.replace(_r,` `).replace(/\s+/g,` `).trim();if(t.length!==0)return t.length>gr?`${t.slice(0,gr)}…`:t}function yr(e){return sr.isExact(e)?e.hasId(`endpoint_answered_non_protocol`)?`endpoint_answered_non_protocol`:e.hasId(`endpoint_unreachable`)?`endpoint_unreachable`:e.hasId(`identity_pin_mismatch`)||e.hasId(`handshake_rejected`)?`handshake_rejected`:`unknown`:`unknown`}function br(e){if(sr.isExact(e)){if(e.hasId(`endpoint_answered_non_protocol`))return e.getContext(`endpoint_answered_non_protocol`).url;if(e.hasId(`endpoint_unreachable`))return e.getContext(`endpoint_unreachable`).url}}var xr=function(e){return e.duplex=`duplex`,e.exchange=`exchange`,e}({}),Sr=function(e){return e.uninitialized=`uninitialized`,e.unsupported=`unsupported`,e.initializing=`initializing`,e.ready=`ready`,e.failed=`failed`,e}({}),Cr=class{_cache;_errors;_transports=[];constructor(e,t){this._cache=e,this._errors=t}addTransport(e){this._transports.push(e)}getPreferredTransport(){return this._transports[0]}async getReadyTransport(e){let t=[],n=[];for(let r of this._transports){if(!r.isAvailable(e)){n.push(r);continue}let i=r.getCacheKey(e);if(i!=null){let e=this._cache.get(i);if(e!=null){if(e instanceof Promise){t.push({transport:r,promise:e});continue}t.push({transport:r,promise:Promise.resolve({...e,transport:r})});break}}let a=r.getTransport(e);if(a.status===Sr.ready){let e=a.readyData;if(i!=null){let t={methods:e,transport:r};this._cache.set(i,t),e.addOnDisconnectListener?.(()=>{this._cache.get(i)===t&&this._cache.delete(i)})}t.push({transport:r,promise:Promise.resolve({methods:e,transport:r})});break}if(a.status===Sr.unsupported){n.push(r);continue}if(a.status===Sr.initializing){let e=a.initializationPromise.then(t=>{if(t.status===Sr.failed)throw t.error;if(t.status===Sr.unsupported)throw this._errors.unsupported([r.type]);let n=t.readyData,a={methods:n,transport:r};return i!=null&&(this._cache.get(i)===e?(this._cache.set(i,a),n.addOnDisconnectListener?.(()=>{this._cache.get(i)===a&&this._cache.delete(i)})):n.disconnect?.()),a}).catch(t=>{throw i!=null&&this._cache.get(i)===e&&this._cache.delete(i),t});i!=null&&this._cache.set(i,e),t.push({transport:r,promise:e})}}if(t.length===0)throw n.length>0?this._errors.unsupported(n.map(e=>e.type)):this._errors.notFound(e);let r,i;for(let e of t)try{return await e.promise}catch(t){r=t,i=e.transport}throw sr.isExact(r)&&(r.hasId(`dial_unavailable`)||r.hasId(`identity_pin_mismatch`))?r:this._errors.initializationFailed(e,{cause:wr(r),endpoint:br(r)??i?.getRouteInfo(e)?.url,kind:yr(r),origin:r})}};function wr(e){if(e!=null)return e instanceof Error?e.message:typeof e==`string`?e:String(e)}var Tr=e=>e!=null&&e.length>0,Er=async({privateKey:e,publicKey:t})=>new Uint8Array(await crypto.subtle.deriveBits({name:`X25519`,public:t},e,256)),Dr=`METEOR_BRIDGE_DEFAULT_INFO_STRING`,Or=async({externalX25519PublicKey:e,internalX25519PrivateKey:t,infoString:n,saltString:r})=>{let i=await Er({privateKey:t,publicKey:e}),a=await crypto.subtle.importKey(`raw`,new Uint8Array(i),`HKDF`,!1,[`deriveKey`]),o=Tr(r)?new TextEncoder().encode(r):new Uint8Array,s=new TextEncoder().encode(Tr(n)?n:Dr);return await crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:o,info:s},a,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])},kr=async({aesGcmKey:e,dataToDecrypt:t})=>{let n=await crypto.subtle.decrypt({name:`AES-GCM`,iv:new Uint8Array(t.nonce)},e,new Uint8Array(t.ciphertext));return new Uint8Array(n)};function Ar(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function jr(e){if(!Ar(e))throw TypeError(`Uint8Array expected`)}function Mr(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(e=>typeof e==`string`):t.every(e=>Number.isSafeInteger(e)):!1}function Nr(e){if(typeof e!=`function`)throw TypeError(`function expected`);return!0}function Pr(e,t){if(typeof t!=`string`)throw TypeError(`${e}: string expected`);return!0}function Fr(e){if(typeof e!=`number`)throw TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw RangeError(`invalid integer: ${e}`)}function Ir(e){if(!Array.isArray(e))throw TypeError(`array expected`)}function Lr(e,t){if(!Mr(!0,t))throw TypeError(`${e}: array of strings expected`)}function Rr(e,t){if(!Mr(!1,t))throw TypeError(`${e}: array of numbers expected`)}function zr(...e){let t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function Br(e){let t=typeof e==`string`?e.split(``):e,n=t.length;Lr(`alphabet`,t);let r=new Map(t.map((e,t)=>[e,t]));return{encode:r=>(Ir(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]})),decode:t=>(Ir(t),t.map(t=>{Pr(`alphabet.decode`,t);let n=r.get(t);if(n===void 0)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}function Vr(e=``){return Pr(`join`,e),{encode:t=>(Lr(`join.decode`,t),t.join(e)),decode:t=>(Pr(`join.decode`,t),t.split(e))}}function Hr(e,t=`=`){return Fr(e),Pr(`padding`,t),{encode(n){for(Lr(`padding.encode`,n);n.length*e%8;)n.push(t);return n},decode(n){Lr(`padding.decode`,n);let r=n.length;if(r*e%8)throw Error(`padding: invalid, string should have whole number of bytes`);for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8==0)throw Error(`padding: invalid, string has too much padding`);return n.slice(0,r)}}}function Ur(e){return Nr(e),{encode:e=>e,decode:t=>e(t)}}var Wr=(e,t)=>t===0?e:Wr(t,e%t),Gr=(e,t)=>e+(t-Wr(e,t)),Kr=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function qr(e,t,n,r){if(Ir(e),t<=0||t>32)throw RangeError(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw RangeError(`convertRadix2: wrong to=${n}`);if(Gr(t,n)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Gr(t,n)}`);let i=0,a=0,o=Kr[t],s=Kr[n]-1,c=[];for(let r of e){if(Fr(r),r>=o)throw Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<<t|r,a+t>32)throw Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)c.push((i>>a-n&s)>>>0);let e=Kr[a];if(e===void 0)throw Error(`invalid carry`);i&=e-1}if(i=i<<n-a&s,!r&&a>=t)throw Error(`Excess padding`);if(!r&&i>0)throw Error(`Non-zero padding: ${i}`);return r&&a>0&&c.push(i>>>0),c}function Jr(e,t=!1){if(Fr(e),e<=0||e>32)throw RangeError(`radix2: bits should be in (0..32]`);if(Gr(8,e)>32||Gr(e,8)>32)throw RangeError(`radix2: carry overflow`);return{encode:n=>{if(!Ar(n))throw TypeError(`radix2.encode input should be Uint8Array`);return qr(Array.from(n),8,e,!t)},decode:n=>(Rr(`radix2.decode`,n),Uint8Array.from(qr(n,e,8,t)))}}function Yr(e){return Nr(e),function(...t){try{return e.apply(null,t)}catch{}}}zr(Jr(4),Br(`0123456789ABCDEF`),Vr(``)),zr(Jr(5),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`),Hr(5),Vr(``)),zr(Jr(5),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`),Vr(``)),zr(Jr(5),Br(`0123456789ABCDEFGHIJKLMNOPQRSTUV`),Hr(5),Vr(``)),zr(Jr(5),Br(`0123456789ABCDEFGHIJKLMNOPQRSTUV`),Vr(``)),zr(Jr(5),Br(`0123456789ABCDEFGHJKMNPQRSTVWXYZ`),Vr(``),Ur(e=>e.toUpperCase().replace(/O/g,`0`).replace(/[IL]/g,`1`)));var Xr=typeof Uint8Array.from([]).toBase64==`function`&&typeof Uint8Array.fromBase64==`function`,Zr=/[\t\n\f\r ]/,Qr=(e,t)=>{Pr(`base64`,e);let n=t?`base64url`:`base64`;if(e.length>0&&Zr.test(e))throw Error(`invalid base64`);return Uint8Array.fromBase64(e,{alphabet:n,lastChunkHandling:`strict`})},$r=Object.freeze(Xr?{encode(e){return jr(e),e.toBase64()},decode(e){return Qr(e,!1)}}:zr(Jr(6),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`),Hr(6),Vr(``)));zr(Jr(6),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`),Vr(``)),Xr||zr(Jr(6),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`),Hr(6),Vr(``)),zr(Jr(6),Br(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`),Vr(``));var ei=zr(Br(`qpzry9x8gf2tvdw0s3jn54khce6mua7l`),Vr(``)),ti=[996825010,642813549,513874426,1027748829,705979059];function ni(e){let t=e>>25,n=(e&33554431)<<5;for(let e=0;e<ti.length;e++)(t>>e&1)==1&&(n^=ti[e]);return n}function ri(e,t,n=1){let r=e.length,i=1;for(let t=0;t<r;t++){let n=e.charCodeAt(t);if(n<33||n>126)throw Error(`Invalid prefix (${e})`);i=ni(i)^n>>5}i=ni(i);for(let t=0;t<r;t++)i=ni(i)^e.charCodeAt(t)&31;for(let e of t)i=ni(i)^e;for(let e=0;e<6;e++)i=ni(i);return i^=n,ei.encode(qr([i%Kr[30]],30,5,!1))}function ii(e){let t=e===`bech32`?1:734539939,n=Jr(5),r=n.decode,i=n.encode,a=Yr(r);function o(e,n,r=90){Pr(`bech32.encode prefix`,e),Ar(n)&&(n=Array.from(n)),Rr(`bech32.encode`,n);let i=e.length;if(i===0)throw TypeError(`Invalid prefix length ${i}`);let a=i+7+n.length;if(r!==!1&&a>r)throw TypeError(`Length ${a} exceeds limit ${r}`);let o=e.toLowerCase(),s=ri(o,n,t);return`${o}1${ei.encode(n)}${s}`}function s(e,n=90){Pr(`bech32.decode input`,e);let r=e.length;if(r<8||n!==!1&&r>n)throw TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);let i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw Error(`String must be lowercase or uppercase`);let a=i.lastIndexOf(`1`);if(a===0||a===-1)throw Error(`Letter "1" must be present between prefix and data only`);let o=i.slice(0,a),s=i.slice(a+1);if(s.length<6)throw Error(`Data must be at least 6 characters long`);let c=ei.decode(s).slice(0,-6),l=ri(o,c,t);if(!s.endsWith(l))throw Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:o,words:c}}let c=Yr(s);function l(e){let{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}}function u(e,t){return o(e,i(t))}return{encode:o,decode:s,encodeFromBytes:u,decodeToBytes:l,decodeUnsafe:c,fromWords:r,fromWordsUnsafe:a,toWords:i}}ii(`bech32`),ii(`bech32m`),typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`||zr(Jr(4),Br(`0123456789abcdef`),Vr(``),Ur(e=>{if(typeof e!=`string`||e.length%2!=0)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));var ai=async({aesGcmKey:e,dataToDecrypt:t})=>{let n=await crypto.subtle.decrypt({name:`AES-GCM`,iv:new Uint8Array($r.decode(t.nonce))},e,new Uint8Array($r.decode(t.ciphertext)));return new TextDecoder().decode(n)},oi=async({aesGcmKey:e,dataToEncrypt:t})=>{let n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:`AES-GCM`,iv:n},e,new Uint8Array(t));return{nonce:n,ciphertext:new Uint8Array(r)}},si=async({aesGcmKey:e,dataToEncrypt:t})=>{let n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:`AES-GCM`,iv:n},e,new TextEncoder().encode(t));return{nonce:$r.encode(n),ciphertext:$r.encode(new Uint8Array(r))}};function ci(e){return li(e,`$`,new Set)}function li(e,t,n){if(e===null)return`null`;switch(typeof e){case`string`:return JSON.stringify(e);case`boolean`:return e?`true`:`false`;case`number`:if(!Number.isFinite(e))throw Error(`stringifyCanonicalJson: non-finite number at ${t}`);return JSON.stringify(e);case`undefined`:case`bigint`:case`function`:case`symbol`:throw Error(`stringifyCanonicalJson: unsupported ${typeof e} at ${t}`);default:break}let r=e;if(n.has(r))throw Error(`stringifyCanonicalJson: circular reference at ${t}`);n.add(r);try{if(Array.isArray(r)){let e=`[`;for(let i=0;i<r.length;i++)i>0&&(e+=`,`),e+=i in r?li(r[i],`${t}[${i}]`,n):`null`;return`${e}]`}let e=r,i=Object.keys(e).sort(),a=[];for(let r of i){let i=e[r];i!==void 0&&a.push(`${JSON.stringify(r)}:${li(i,`${t}.${r}`,n)}`)}return`{${a.join(`,`)}}`}finally{n.delete(r)}}function ui(e){if(typeof e.domainTag!=`string`||e.domainTag.length===0)throw Error(`buildCanonicalChallenge: domainTag must be a non-empty string`);if(typeof e.version!=`number`||!Number.isSafeInteger(e.version)||e.version<1)throw Error(`buildCanonicalChallenge: version must be a positive safe integer`);if(!di(e.fields))throw Error(`buildCanonicalChallenge: fields must be a plain object`);for(let[t,n]of Object.entries(e.fields))fi(n,`fields.${t}`);return ci({domainTag:e.domainTag,version:e.version,fields:e.fields})}function di(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function fi(e,t){if(e===void 0)throw Error(`buildCanonicalChallenge: undefined entry at ${t}`);if(!(e===null||typeof e==`string`||typeof e==`boolean`)){if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`buildCanonicalChallenge: non-finite number at ${t}`);return}if(Array.isArray(e)){for(let n=0;n<e.length;n++){if(!(n in e))throw Error(`buildCanonicalChallenge: sparse array hole at ${t}[${n}]`);fi(e[n],`${t}[${n}]`)}return}if(di(e)){for(let[n,r]of Object.entries(e)){if(r===void 0)throw Error(`buildCanonicalChallenge: undefined entry at ${t}.${n}`);fi(r,`${t}.${n}`)}return}throw Error(`buildCanonicalChallenge: unsupported value at ${t} — strict JSON values only (null, boolean, finite number, string, dense array, plain object)`)}}function pi(e){return $r.encode(e)}function mi(e){return $r.decode(e)}var hi=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function gi(e,t){return e>>>t|e<<32-t}function _i(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=t.length*8,r=(t.length+8>>6)+1<<6,i=new Uint8Array(r);i.set(t),i[t.length]=128;let a=new DataView(i.buffer);a.setUint32(r-8,Math.floor(n/4294967296),!1),a.setUint32(r-4,n>>>0,!1);let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);for(let e=0;e<r;e+=64){for(let t=0;t<16;t++)s[t]=a.getUint32(e+t*4,!1);for(let e=16;e<64;e++){let t=gi(s[e-15],7)^gi(s[e-15],18)^s[e-15]>>>3,n=gi(s[e-2],17)^gi(s[e-2],19)^s[e-2]>>>10;s[e]=s[e-16]+t+s[e-7]+n>>>0}let t=o[0],n=o[1],r=o[2],i=o[3],c=o[4],l=o[5],u=o[6],d=o[7];for(let e=0;e<64;e++){let a=gi(c,6)^gi(c,11)^gi(c,25),o=c&l^~c&u,f=d+a+o+hi[e]+s[e]>>>0,p=(gi(t,2)^gi(t,13)^gi(t,22))+(t&n^t&r^n&r)>>>0;d=u,u=l,l=c,c=i+f>>>0,i=r,r=n,n=t,t=f+p>>>0}o[0]=o[0]+t>>>0,o[1]=o[1]+n>>>0,o[2]=o[2]+r>>>0,o[3]=o[3]+i>>>0,o[4]=o[4]+c>>>0,o[5]=o[5]+l>>>0,o[6]=o[6]+u>>>0,o[7]=o[7]+d>>>0}let c=new Uint8Array(32),l=new DataView(c.buffer);for(let e=0;e<8;e++)l.setUint32(e*4,o[e],!1);return c}function vi(e){let t=_i(e),n=``;for(let e of t)n+=e.toString(16).padStart(2,`0`);return n}var yi=async(e,t)=>{let n=new TextEncoder().encode(e),r=await crypto.subtle.sign({name:`ED25519`},t,n);return new Uint8Array(r)},bi=async(e,t,n=`::`)=>await yi(e.join(n),t),xi=({infoString:e,verifyPublicKeys:t})=>{let n=[...t].sort();return[...e==null?[]:[e],...n].join(`::`)},Si=class extends Error{key;issues;constructor(e,t){let n=t.map((e,t)=>{let n=e.path?.map(e=>String(typeof e==`object`?e.key:e)).join(`.`);return` (issue ${t+1})${n?` [${n}]`:``}: ${e.message}`}).join(`
|
|
18
|
+
`);super(`Typed storage validation failed for key "${e}":\n${n}`),this.name=`StorageValidationError`,this.key=e,this.issues=t}};function Ci({storageAdapter:e,schemas:t,onInvalid:n}){let r=(e,r)=>{let i=t?.[e];if(i==null)return r;let a=i[`~standard`].validate(r),o;if(a instanceof Promise)o=[{message:`async schema validation is not supported for typed storage`}];else if(a.issues!=null)o=a.issues;else return a.value;let s=new Si(e,o);throw n?.(s),s},i=e=>t?.[e]!=null;return{getJson:async t=>{let n=await e.getJson(t);return n===void 0||!i(t)?n:r(t,n)},getJsonOrDef:async(t,n)=>{let a=await e.getJson(t)??n;return i(t)?r(t,a):a},setJson:async(t,n)=>e.setJson(t,i(t)?r(t,n):n),removeItem:async t=>{await e.removeItem(t)},updateJson:async(t,n)=>{if(!i(t)){await e.updateJson(t,n);return}await e.updateJson(t,e=>r(t,n(e===void 0?void 0:r(t,e))))},updateJsonWithDef:async(t,n,a)=>{if(!i(t)){await e.updateJsonOrDef(t,n,a);return}await e.updateJsonOrDef(t,n,e=>r(t,a(r(t,e))))},clearAll:async()=>{await e.clearAll()}}}var wi=async()=>await crypto.subtle.generateKey({name:`Ed25519`},!0,[`sign`,`verify`]),Ti=({transformJsonForFormats:e=[],transformJson:t=!1}={})=>n=>{let[r,i,a]=n.split(`::`),o=a;if(t||e.includes(i))try{o=JSON.parse(a)}catch(e){let t=Error(`Failed to parse type and format data string. Given input: "${n}", expected JSON parsable "data" value in the format "${r}::${i}::data" ${e instanceof Error?e.message:String(e)}`);throw t.cause=e,t}return{formattedString:n,type:r,format:i,data:o}},Ei,Di={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Oi(e){return!e&&!Ei?Di:{lang:e?.lang??Ei?.lang,message:e?.message,abortEarly:e?.abortEarly??Ei?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Ei?.abortPipeEarly}}var ki;function Ai(e){return ki?.get(e)}var ji;function Mi(e){return ji?.get(e)}var Ni;function Pi(e,t){return Ni?.get(e)?.get(t)}function Fi(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function Ii(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??Fi(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??Pi(e.reference,c.lang)??(l?Mi(c.lang):null)??r.message??Ai(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}var Li=new WeakMap;function Ri(e){let t=Li.get(e);return t||(t={version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},Oi())}},Li.set(e,t)),t}function zi(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var Bi=/^(?:[\da-z+/]{4})*(?:[\da-z+/]{2}==|[\da-z+/]{3}=)?$/iu;function N(e){return{kind:`validation`,type:`base64`,reference:N,async:!1,expects:null,requirement:Bi,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&Ii(this,`Base64`,e,t),e}}}var Vi={abortEarly:!0};function Hi(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Ui(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Wi(e,t){return{kind:`schema`,type:`array`,reference:Wi,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else Ii(this,`type`,e,t);return e}}}function Gi(e){return{kind:`schema`,type:`boolean`,reference:Gi,expects:`boolean`,async:!1,message:e,get"~standard"(){return Ri(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:Ii(this,`type`,e,t),e}}}function Ki(e,t){return{kind:`schema`,type:`custom`,reference:Ki,expects:`unknown`,async:!1,check:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:Ii(this,`type`,e,t),e}}}function qi(e,t){if(typeof e==typeof t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{value:e};if(e&&t&&e.constructor===Object&&t.constructor===Object){let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(e,r)){let i=qi(e[r],t[r]);if(i.issue)return i;n[r]=i.value}else n[r]=t[r];return{value:n}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){let n=[...e];for(let r=0;r<e.length;r++){let i=qi(e[r],t[r]);if(i.issue)return i;n[r]=i.value}return{value:n}}}return{issue:!0}}function Ji(e,t){return{kind:`schema`,type:`intersect`,reference:Ji,expects:zi(e.map(e=>e.expects),`&`),async:!1,options:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){if(this.options.length){let n=e.value,r;e.typed=!0;for(let i of this.options){let a=i[`~run`]({value:n},t);if(a.issues){if(e.issues)for(let t of a.issues)e.issues.push(t);else e.issues=a.issues;if(t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.typed&&(r?r.push(a.value):r=[a.value])}if(e.typed){e.value=r[0];for(let n=1;n<r.length;n++){let i=qi(e.value,r[n]);if(i.issue){Ii(this,`type`,e,t,{received:`unknown`});break}e.value=i.value}}}else Ii(this,`type`,e,t);return e}}}function Yi(e,t){return{kind:`schema`,type:`literal`,reference:Yi,expects:Fi(e),async:!1,literal:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:Ii(this,`type`,e,t),e}}}function Xi(e,t){return{kind:`schema`,type:`object`,reference:Xi,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ui(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Hi(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(Ii(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else Ii(this,`type`,e,t);return e}}}function Zi(e,t){return{kind:`schema`,type:`optional`,reference:Zi,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return Ri(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Ui(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Qi(e,t){return{kind:`schema`,type:`picklist`,reference:Qi,expects:zi(e.map(Fi),`|`),async:!1,options:e,message:t,get"~standard"(){return Ri(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:Ii(this,`type`,e,t),e}}}function $i(e){return{kind:`schema`,type:`string`,reference:$i,expects:`string`,async:!1,message:e,get"~standard"(){return Ri(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:Ii(this,`type`,e,t),e}}}function ea(e,t,n){return{kind:`schema`,type:`variant`,reference:ea,expects:`Object`,async:!1,key:e,options:t,message:n,get"~standard"(){return Ri(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},Vi).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;Ii(this,`type`,e,t,{input:n[a],expected:zi(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else Ii(this,`type`,e,t);return e}}}function ta(...e){return{...e[0],pipe:e,get"~standard"(){return Ri(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function na(e,t,n){let r=e[`~run`]({value:t},Oi(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var ra=({type:e,format:t,typeKind:n,formatKind:r})=>{let i=n??`data_type`,a=r??`data_format`;return ta(Ki(n=>{if(typeof n!=`string`)return!1;let[r,i,a]=n.split(`::`);return r===e&&i===t&&typeof a==`string`},`Invalid format, expected '<${i}>::<${a}>::<value>' where "${i}" is "${e}", "${a}" is "${t}", and "value" is a string in the specified format`))},ia=function(e){return e.ed25519=`ed25519`,e.x25519=`x25519`,e}({}),aa=function(e){return e.raw_base64=`raw_base64`,e.jwk=`jwk`,e}({});ra({format:`raw_base64`,type:`ed25519`,typeKind:`algo`}),ra({format:`jwk`,type:`ed25519`,typeKind:`algo`,transformJson:!0}),ra({format:`raw_base64`,type:`x25519`,typeKind:`algo`}),ra({format:`jwk`,type:`x25519`,typeKind:`algo`,transformJson:!0}),Ti(),Ti({transformJson:!0});var oa=Ti({transformJsonForFormats:[aa.jwk]}),sa=e=>oa(e);Ti(),Ti({transformJson:!0});var ca=Ti({transformJsonForFormats:[aa.jwk]}),la=e=>ca(e),ua=async(e,t,n)=>{let r=Uint8Array.from($r.decode(e));return await crypto.subtle.importKey(`raw`,r,{name:`Ed25519`},n,t)},da=async(e,t,n=!0)=>await crypto.subtle.importKey(`jwk`,e,{name:`Ed25519`},n,t),fa=async(e,t,n=!0)=>e.format===aa.jwk?await da(e.data,t,n):await ua(e.data,t,n),pa=async(e,t,n=!0)=>await fa(sa(e),t,n),ma=(e,t)=>({extractable:n=>t(n,e,!0),nonExtractable:n=>t(n,e,!1)}),ha={private:{fromFormattedString:ma([`sign`],pa),fromSerializedObject:ma([`sign`],fa),fromJwk:ma([`sign`],da)},public:{fromBase64:ma([`verify`],ua),fromFormattedString:ma([`verify`],pa),fromSerializedObject:ma([`verify`],fa),fromJwk:ma([`verify`],da)}},ga=async e=>{let t=await crypto.subtle.exportKey(`jwk`,e),n=`${ia.ed25519}::${aa.jwk}::${JSON.stringify(t)}`;return{transformed:{formattedString:n,type:ia.ed25519,data:t,format:aa.jwk},prefixed:n}},_a=async e=>{let t=await crypto.subtle.exportKey(`raw`,e),n=$r.encode(new Uint8Array(t)),r=`${ia.ed25519}::${aa.raw_base64}::${n}`;return{transformed:{formattedString:r,type:ia.ed25519,data:n,format:aa.raw_base64},prefixed:r}},va=async({challenge:e,signatureBase64:t,publicKey:n})=>{let r=Uint8Array.from($r.decode(t)),i=new TextEncoder().encode(e);return await crypto.subtle.verify({name:`ED25519`},n,r,i)},ya=async()=>await crypto.subtle.generateKey({name:`X25519`},!0,[`deriveKey`,`deriveBits`]),ba=async(e,t,n)=>{let r=Uint8Array.from($r.decode(e));return await crypto.subtle.importKey(`raw`,r,{name:`X25519`},n,t)},xa=async(e,t,n=!0)=>await crypto.subtle.importKey(`jwk`,e,{name:`X25519`},n,t),Sa=async(e,t,n=!0)=>e.format===aa.jwk?await xa(e.data,t,n):await ba(e.data,t,n),Ca=async(e,t,n=!0)=>await Sa(la(e),t,n),wa=(e,t)=>({extractable:n=>t(n,e,!0),nonExtractable:n=>t(n,e,!1)}),Ta={private:{fromFormattedString:wa([`deriveKey`,`deriveBits`],Ca),fromSerializedObject:wa([`deriveKey`,`deriveBits`],Sa),fromJwk:wa([`deriveKey`,`deriveBits`],xa)},public:{fromBase64:wa([],ba),fromFormattedString:wa([],Ca),fromSerializedObject:wa([],Sa),fromJwk:wa([],xa)}},Ea=async e=>{let t=await crypto.subtle.exportKey(`jwk`,e),n=`${ia.x25519}::${aa.jwk}::${JSON.stringify(t)}`;return{transformed:{formattedString:n,type:ia.x25519,data:t,format:aa.jwk},prefixed:n}},Da=async e=>{let t=await crypto.subtle.exportKey(`raw`,e),n=$r.encode(new Uint8Array(t)),r=`${ia.x25519}::${aa.raw_base64}::${n}`;return{transformed:{formattedString:r,type:ia.x25519,data:n,format:aa.raw_base64},prefixed:r}},Oa=class extends Error{constructor(e=`ClientCryptoKeyLink: identity not provisioned (identityMode 'required'). Call provisionIdentity() once, out-of-band, before serving.`){super(e),this.name=`IdentityNotProvisionedError`}},ka=class{localExchangeKeyPair;localVerifyKeyPair;linkedClientKeys=new Map;storage;identityMode;initialized=!1;initializePromise;localExchangeKeyPairPromise;localVerifyKeyPairPromise;constructor({storageAdapter:e,identityMode:t}={}){e!=null&&(this.storage=Ci({storageAdapter:e})),this.identityMode=t??`lazy`}async initialize(){if(!this.initialized){this.initializePromise??=this.runInitialize();try{await this.initializePromise}finally{this.initializePromise=void 0}}}async runInitialize(){await this.loadStoredLocalKeys(),await this.loadLinkedClients(),this.initialized=!0}async provisionIdentity(){await this.initialize(),await this.mintLocalExchangeKeyPair(),await this.mintLocalVerifyKeyPair()}async loadStoredLocalKeys(){let e=await this.storage?.getJson(`localExchangeKeyPair`);if(e!=null){let t=await Ta.private.fromFormattedString.extractable(e.privateKey),n=await Ta.public.fromFormattedString.extractable(e.publicKey);this.localExchangeKeyPair={privateKey:t,publicKey:n}}let t=await this.storage?.getJson(`localVerifyKeyPair`);if(t!=null){let e=await ha.private.fromFormattedString.extractable(t.privateKey),n=await ha.public.fromFormattedString.extractable(t.publicKey);this.localVerifyKeyPair={privateKey:e,publicKey:n}}}async ensureLocalExchangeKeyPair(){if(this.localExchangeKeyPair!=null)return this.localExchangeKeyPair;if(this.identityMode===`required`)throw new Oa;return this.mintLocalExchangeKeyPair()}async mintLocalExchangeKeyPair(){if(this.localExchangeKeyPair!=null)return this.localExchangeKeyPair;this.localExchangeKeyPairPromise??=(async()=>{let e=await ya();return this.localExchangeKeyPair=e,this.storage!=null&&await this.storage.setJson(`localExchangeKeyPair`,await this.serializeExchangeKeyPair(e)),e})();try{return await this.localExchangeKeyPairPromise}finally{this.localExchangeKeyPairPromise=void 0}}async ensureLocalVerifyKeyPair(){if(this.localVerifyKeyPair!=null)return this.localVerifyKeyPair;if(this.identityMode===`required`)throw new Oa;return this.mintLocalVerifyKeyPair()}async mintLocalVerifyKeyPair(){if(this.localVerifyKeyPair!=null)return this.localVerifyKeyPair;this.localVerifyKeyPairPromise??=(async()=>{let e=await wi();return this.localVerifyKeyPair=e,this.storage!=null&&await this.storage.setJson(`localVerifyKeyPair`,await this.serializeVerifyKeyPair(e)),e})();try{return await this.localVerifyKeyPairPromise}finally{this.localVerifyKeyPairPromise=void 0}}async loadLinkedClients(){let e=await this.storage?.getJson(`linkedClientPublicKeys`);if(e!=null)for(let[t,n]of Object.entries(e))await this.linkClient({linkedClientId:t,verifyPublicKey:n.verifyPublicKey,exchangePublicKey:n.exchangePublicKey,saltString:n.saltString,infoString:n.infoString,bindVerifyKeysIntoDerivation:n.bindVerifyKeysIntoDerivation})}async serializeExchangeKeyPair(e){return{publicKey:(await Da(e.publicKey)).prefixed,privateKey:(await Ea(e.privateKey)).prefixed}}async serializeVerifyKeyPair(e){return{publicKey:(await _a(e.publicKey)).prefixed,privateKey:(await ga(e.privateKey)).prefixed}}async getLocalPublicKeys(){return{verifyPublicKey:await this.getLocalVerifyPublicKey(),exchangePublicKey:await this.getLocalExchangePublicKey()}}async getLocalExchangePublicKey(){return(await Da((await this.ensureLocalExchangeKeyPair()).publicKey)).prefixed}async getLocalVerifyPublicKey(){return(await _a((await this.ensureLocalVerifyKeyPair()).publicKey)).prefixed}async linkClient({linkedClientId:e,verifyPublicKey:t,exchangePublicKey:n,saltString:r,infoString:i,bindVerifyKeysIntoDerivation:a}){let o=this.linkedClientKeys.get(e),s=o?.verify;t!=null&&(s={publicKey:await ha.public.fromFormattedString.extractable(t),publicKeySerialized:t});let c=t!=null&&t!==o?.verify?.publicKeySerialized,l=o?.exchange;if(n!=null||r!==void 0||i!==void 0||a!==void 0){let t=n??o?.exchange?.publicKeySerialized;if(t==null)throw Error(`ClientCryptoKeyLink: Cannot set salt/info for ${e} without an exchange public key`);let s=r===void 0?o?.exchange?.saltString:r,u=i===void 0?o?.exchange?.infoString:i,d=a===void 0?o?.exchange?.bindVerifyKeysIntoDerivation:a,f;f=n==null?o.exchange.publicKey:await Ta.public.fromFormattedString.extractable(n);let p=t===o?.exchange?.publicKeySerialized&&s===o?.exchange?.saltString&&u===o?.exchange?.infoString&&d===o?.exchange?.bindVerifyKeysIntoDerivation&&!(d===!0&&c);l={publicKey:f,publicKeySerialized:t,saltString:s,infoString:u,bindVerifyKeysIntoDerivation:d,sharedEncryptKey:p?o?.exchange?.sharedEncryptKey:void 0}}else l?.bindVerifyKeysIntoDerivation===!0&&c&&l.sharedEncryptKey!=null&&(l={...l,sharedEncryptKey:void 0});this.linkedClientKeys.set(e,{verify:s,exchange:l})}async linkClientAndStore(e){if(await this.linkClient(e),this.storage==null)return;let{linkedClientId:t,verifyPublicKey:n,exchangePublicKey:r,saltString:i,infoString:a,bindVerifyKeysIntoDerivation:o}=e;await this.storage.updateJsonWithDef(`linkedClientPublicKeys`,{},e=>({...e,[t]:{...e[t],...n==null?{}:{verifyPublicKey:n},...r==null?{}:{exchangePublicKey:r},...i===void 0?{}:{saltString:i},...a===void 0?{}:{infoString:a},...o===void 0?{}:{bindVerifyKeysIntoDerivation:o}}}))}hasLinkedClient(e){return this.linkedClientKeys.has(e)}getLinkedClientPublicKeys(e){let t=this.linkedClientKeys.get(e);if(t!=null)return{verifyPublicKey:t.verify?.publicKeySerialized,exchangePublicKey:t.exchange?.publicKeySerialized}}async unlinkClient(e){this.linkedClientKeys.delete(e),this.storage!=null&&await this.storage.updateJson(`linkedClientPublicKeys`,t=>{if(t==null)return{};let{[e]:n,...r}=t;return r})}async unlinkAllClients(){this.linkedClientKeys.clear(),this.storage!=null&&await this.storage.setJson(`linkedClientPublicKeys`,{})}async reset(){this.linkedClientKeys.clear(),this.localExchangeKeyPair=void 0,this.localVerifyKeyPair=void 0,this.initialized=!1,this.storage!=null&&(await this.storage.removeItem(`linkedClientPublicKeys`),await this.storage.removeItem(`localExchangeKeyPair`),await this.storage.removeItem(`localVerifyKeyPair`))}getLinkedClient(e){let t=this.linkedClientKeys.get(e);if(t==null)throw Error(`ClientCryptoKeyLink: No linked client for ${e}`);return t}async getAesGcmKeyForLinkedClient(e){let t=this.getLinkedClient(e);if(t.exchange?.sharedEncryptKey!=null)return t.exchange.sharedEncryptKey;if(t.exchange?.publicKey==null)throw Error(`ClientCryptoKeyLink: No public exchange key set for ${e}`);let n=await this.ensureLocalExchangeKeyPair(),r=t.exchange.infoString;if(t.exchange.bindVerifyKeysIntoDerivation===!0){let n=t.verify?.publicKeySerialized;if(n==null)throw Error(`ClientCryptoKeyLink: Link for ${e} binds verify keys into the derivation, but no verify public key is set`);r=xi({infoString:t.exchange.infoString,verifyPublicKeys:[await this.getLocalVerifyPublicKey(),n]})}let i=await Or({internalX25519PrivateKey:n.privateKey,externalX25519PublicKey:t.exchange.publicKey,saltString:t.exchange.saltString,infoString:r});return this.linkedClientKeys.set(e,{...t,exchange:{...t.exchange,sharedEncryptKey:i}}),i}async deriveSharedAesGcmKey({exchangePublicKey:e,saltString:t,infoString:n,bindVerifyKeysIntoDerivation:r,verifyPublicKey:i}){let a=await this.ensureLocalExchangeKeyPair(),o=await Ta.public.fromFormattedString.extractable(e),s=n;if(r===!0){if(i==null)throw Error(`ClientCryptoKeyLink.deriveSharedAesGcmKey: a verify public key is required when binding verify keys into the derivation`);s=xi({infoString:n,verifyPublicKeys:[await this.getLocalVerifyPublicKey(),i]})}return await Or({internalX25519PrivateKey:a.privateKey,externalX25519PublicKey:o,saltString:t,infoString:s})}async deriveLocalSealKey(e){let t=await this.ensureLocalExchangeKeyPair();return await Or({internalX25519PrivateKey:t.privateKey,externalX25519PublicKey:t.publicKey,infoString:`exchange-ticket-seal/${e?.version??`v1`}`})}async encryptDataForLinkedClient({dataToEncrypt:e,linkedClientId:t}){return await si({dataToEncrypt:e,aesGcmKey:await this.getAesGcmKeyForLinkedClient(t)})}async decryptDataFromLinkedClient({dataToDecrypt:e,linkedClientId:t}){return await ai({dataToDecrypt:e,aesGcmKey:await this.getAesGcmKeyForLinkedClient(t)})}async encryptBytesForLinkedClient({dataToEncrypt:e,linkedClientId:t}){return await oi({dataToEncrypt:e,aesGcmKey:await this.getAesGcmKeyForLinkedClient(t)})}async decryptBytesFromLinkedClient({dataToDecrypt:e,linkedClientId:t}){return await kr({dataToDecrypt:e,aesGcmKey:await this.getAesGcmKeyForLinkedClient(t)})}async signAndEncryptDataForLinkedClient({dataToEncrypt:e,linkedClientId:t}){let{signatureBase64:n}=await this.signChallenge([e]);return{encryptedData:await this.encryptDataForLinkedClient({dataToEncrypt:e,linkedClientId:t}),signatureBase64:n}}async decryptAndVerifyDataFromLinkedClient({dataToDecrypt:e,linkedClientId:t,signatureBase64:n}){let r=await this.decryptDataFromLinkedClient({dataToDecrypt:e,linkedClientId:t});return{data:r,isValid:await this.verifyChallengeFromLinkedClient({linkedClientId:t,challenge:r,signatureBase64:n})}}async signChallenge(e){if(e.length===0)throw Error(`Challenge must contain at least one string`);let t=await this.ensureLocalVerifyKeyPair(),n=e.length>1?await bi(e,t.privateKey):await yi(e[0],t.privateKey);return{signatureBase64:$r.encode(n)}}async signChallengeCanonical(e){return this.signChallenge([ui(e)])}async verifyChallengeCanonicalFromLinkedClient({linkedClientId:e,challenge:t,signatureBase64:n}){return this.verifyChallengeFromLinkedClient({linkedClientId:e,challenge:ui(t),signatureBase64:n})}async verifyChallengeFromLinkedClient({linkedClientId:e,challenge:t,signatureBase64:n}){let r=this.getLinkedClient(e);if(r.verify?.publicKey==null)throw Error(`ClientCryptoKeyLink: No verify public key set for ${e}`);return await va({challenge:t,signatureBase64:n,publicKey:r.verify.publicKey})}},Aa=function(e){return e.string=`string`,e.json=`json`,e}({}),ja=class e{implementation;keyPrefix;durable;trackKeysForClearing;adapterStorage;indexMutationChain=Promise.resolve();constructor({methods:t,keyPrefix:n,trackKeysForClearing:r}){this.implementation=t,this.durable=t.durable,this.keyPrefix=n??``;let i=r??!0;this.trackKeysForClearing=i,this.adapterStorage=i?Ci({storageAdapter:new e({methods:t,keyPrefix:n,trackKeysForClearing:!1})}):void 0}getPrefixedKey(e){return`${this.keyPrefix}${e}`}withIndexLock(e){let t=this.indexMutationChain.then(e,e);return this.indexMutationChain=t.then(()=>void 0,()=>void 0),t}withKeyPrefix(t){return new e({methods:this.implementation,keyPrefix:`${this.keyPrefix}${t}`,trackKeysForClearing:this.trackKeysForClearing})}async trackUsedKey(e){let t=this.adapterStorage;t&&await this.withIndexLock(()=>t.updateJsonWithDef(`__usedKeys__`,[],t=>t.includes(e)?t:[...t,e]))}async untrackUsedKey(e){let t=this.adapterStorage;t&&await this.withIndexLock(()=>t.updateJsonWithDef(`__usedKeys__`,[],t=>t.filter(t=>t!==e)))}async clearAll(){let e=this.adapterStorage;e&&await this.withIndexLock(async()=>{let t=await e.getJsonOrDef(`__usedKeys__`,[])??[];await Promise.all(t.map(e=>this.implementation.removeItem(this.getPrefixedKey(e)))),await e.removeItem(`__usedKeys__`)})}async removeItem(e){await this.implementation.removeItem(this.getPrefixedKey(e)),await this.untrackUsedKey(e)}async setJson(e,t){let n=this.getPrefixedKey(e);this.implementation.type===Aa.string?await this.implementation.setItem(n,JSON.stringify(t)):await this.implementation.setItem(n,t),await this.trackUsedKey(e)}async getJson(e){let t=this.getPrefixedKey(e);if(this.implementation.type===Aa.string){let e=await this.implementation.getItem(t);return e==null||e===`undefined`||e===`null`?void 0:JSON.parse(e)}else{let e=await this.implementation.getItem(t);return e==null||e===`undefined`||e===`null`?void 0:e}}async getJsonOrDef(e,t){if(this.implementation.type===Aa.string){let n=await this.implementation.getItem(this.getPrefixedKey(e));return n==null||n===`undefined`||n===`null`?t:JSON.parse(n)}let n=await this.implementation.getItem(this.getPrefixedKey(e));return n==null||n===`undefined`||n===`null`?t:n}async updateJson(e,t){let n=t(await this.getJson(e));return await this.setJson(e,n),n}async updateJsonOrDef(e,t,n){let r=n(await this.getJsonOrDef(e,t));return await this.setJson(e,r),r}createJsonGetterSetter(e){return{get:()=>this.getJson(e),set:t=>this.setJson(e,t)}}};function Ma(e=new Map){return{type:Aa.json,durable:!1,getItem:async t=>e.get(t),setItem:async(t,n)=>{e.set(t,n)},removeItem:async t=>{e.delete(t)}}}function Na(e){typeof e!=`number`&&e.unref?.()}var Pa=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Fa=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Pa[n[e]&63];return t},Ia=`_unset_`;function La(e){return[`envId[${e.envId}]perId[${e.perId??`_`}]:insId[${e.insId??`_`}]`,`envId[${e.envId}]perId[${e.perId??`_`}]:insId[_]`,`envId[${e.envId}]perId[_]:insId[_]`]}var Ra=class e{envId;perId;insId;static get unknown(){return new e({envId:Ia})}static env(t){return new e({envId:t})}withPersistentId(e){return this.specify({perId:e})}withConnectionId(e){if(e.length===0||/[[\]:~]/.test(e))throw Error(`RuntimeCoordinate.withConnectionId: "${e}" is not a usable connection id — it must be non-empty and free of \`[\`, \`]\`, \`:\` and \`~\` (the coordinate's own string-form separators).`);return this.specify({insId:`${this.insId??`_`}~${e}`})}constructor({envId:e,perId:t,insId:n}){this.envId=e,this.perId=t,this.insId=n}specify(t){return new e({envId:this.envId,perId:this.perId,insId:this.insId,...t})}specifyIfUnset(t){return new e({envId:this.envId,perId:this.perId??t.perId,insId:this.insId??t.insId})}toJsonObject(){return{envId:this.envId,perId:this.perId,insId:this.insId}}isExactlySame(e){return this.envId===e.envId&&this.perId===e.perId&&this.insId===e.insId}isSameFor(e){return{id:this.envId===e.envId,perId:this.envId===e.envId&&this.perId===e.perId,insId:this.envId===e.envId&&this.perId===e.perId&&this.insId===e.insId}}similarityLevel(e){let t=this.isSameFor(e);return t.insId?3:t.perId?2:+!!t.id}get stringId(){return`envId[${this.envId}]perId[${this.perId??`_`}]:insId[${this.insId??`_`}]`}toStringIds(){return La(this)}},za=`nice-ws-hs/1`,Ba=`reliable`,Va=`reliable-streamkey`,Ha=function(e){return e.none=`none`,e.authenticated=`authenticated`,e.encrypted=`encrypted`,e}({}),Ua=function(e){return e.hello=`hello`,e.welcome=`welcome`,e.prove=`prove`,e.accept=`accept`,e.reject=`reject`,e}({}),Wa=Ki(e=>typeof e==`string`&&e.startsWith(`ed25519::raw_base64::`)),Ga=Ki(e=>typeof e==`string`&&e.startsWith(`x25519::raw_base64::`)),Ka=Xi({envId:$i(),perId:Zi($i()),insId:Zi($i())}),qa=Qi([`none`,`authenticated`,`encrypted`]),Ja=ea(`t`,[Xi({t:Yi(`hello`),protocol:$i(),securityLevel:qa,dictionaryVersion:$i(),client:Ka,clientNonce:$i(),verifyPublicKey:Wa,exchangePublicKey:Zi(Ga),channels:Zi(Wi($i())),caps:Zi(Wi($i()))}),Xi({t:Yi(`welcome`),securityLevel:qa,dictionaryVersion:$i(),server:Ka,serverNonce:$i(),verifyPublicKey:Wa,exchangePublicKey:Zi(Ga),caps:Zi(Wi($i()))}),Xi({t:Yi(`prove`),signatureBase64:$i()}),Xi({t:Yi(`accept`),signatureBase64:Zi($i())}),Xi({t:Yi(`reject`),reason:$i(),id:Zi($i())})]);function Ya(e){return JSON.stringify(e)}function Xa(e){let t;try{t=JSON.parse(e)}catch{return}let n=na(Ja,t);return n.success?n.output:void 0}function Za(e){return`runtime::${new Ra(e).stringId}`}function Qa(e){return new Ra(e).stringId}function $a(e,t){return`${e}::${t}`}function eo(e){return`${za}::${e}`}function to(e){return JSON.stringify([za,e.securityLevel,e.dictionaryVersion,e.clientCoordId,e.serverCoordId,e.clientNonce,e.serverNonce,e.clientVerifyKey,e.serverVerifyKey,e.clientExchangeKey??`_`,e.serverExchangeKey??`_`])}function no(e){let{link:t,localCoordinate:n,dictionaryVersion:r,securityLevel:i,channelTags:a}=e,o=i===`encrypted`,s=Fa(),c;return{async createHello(){return{t:`hello`,protocol:za,securityLevel:i,dictionaryVersion:r,client:n,clientNonce:s,verifyPublicKey:await t.getLocalVerifyPublicKey(),exchangePublicKey:o?await t.getLocalExchangePublicKey():void 0,channels:a==null?void 0:[...a],caps:[Ba,Va,...e.extraCaps??[]]}},async onWelcome(e){if(e.dictionaryVersion!==r)throw Error(`[ws-handshake] server dictionary version mismatch`);if(e.securityLevel!==i)throw Error(`[ws-handshake] server security level mismatch`);if(o&&e.exchangePublicKey==null)throw Error(`[ws-handshake] server did not provide an exchange key for encryption`);let a=Za(e.server);await t.linkClient({linkedClientId:a,verifyPublicKey:e.verifyPublicKey,...o?{exchangePublicKey:e.exchangePublicKey,saltString:$a(s,e.serverNonce),infoString:eo(r),bindVerifyKeysIntoDerivation:!0}:{}});let l=o&&e.exchangePublicKey!=null?{verifyPublicKey:e.verifyPublicKey,exchangePublicKey:e.exchangePublicKey,saltString:$a(s,e.serverNonce),infoString:eo(r),bindVerifyKeysIntoDerivation:!0}:void 0,u=to({securityLevel:i,dictionaryVersion:r,clientCoordId:Qa(n),serverCoordId:Qa(e.server),clientNonce:s,serverNonce:e.serverNonce,clientVerifyKey:await t.getLocalVerifyPublicKey(),serverVerifyKey:e.verifyPublicKey,clientExchangeKey:o?await t.getLocalExchangePublicKey():void 0,serverExchangeKey:e.exchangePublicKey});return c={linkedServerId:a,server:e.server,challenge:u,encryptionKeyMaterial:l,remoteCaps:e.caps},{t:`prove`,signatureBase64:(await t.signChallenge([u])).signatureBase64}},async onAccept(e){if(c==null)throw Error(`[ws-handshake] accept before welcome`);if(e.signatureBase64!=null&&!await t.verifyChallengeFromLinkedClient({linkedClientId:c.linkedServerId,challenge:c.challenge,signatureBase64:e.signatureBase64}))throw Error(`[ws-handshake] server signature invalid`);return{linkedClientId:c.linkedServerId,remote:c.server,securityLevel:i,encryptionKeyMaterial:c.encryptionKeyMaterial,remoteCaps:c.remoteCaps}}}}var ro={[Ha.none]:0,[Ha.authenticated]:1,[Ha.encrypted]:2};function io(e,t){return ro[e]>=ro[t]}var ao=e=>sr.isExact(e)&&e.hasId(`dial_unavailable`),oo=e=>ao(e)||sr.isExact(e)&&e.hasId(`identity_pin_mismatch`),so=class{mux;peer;localCoordinate;securityLevel;canPush;_cache=new Map;_manager;_buildConnectInput;_defaultLocalCoordinate;_linkEventListeners=new Set;_downSince;_currentLinkMethods;_tornDown=!1;_keepLinkAliveOption;_keepAliveHooked=new WeakSet;_redialTimer;_redialAttempts=0;_suppressRedial=!1;_debugResumeTimer;_disposed=!1;debug={dropLink:async e=>{if(this._disposed)return;let t=e?.suppressRedialMs??0;if(this._cancelDebugResume(),this._currentLinkMethods!=null&&this._downSince==null&&(this._downSince=Date.now(),this._emitLinkEvent({type:`link_down`})),t>0){this._suppressRedial=!0,this._cancelRedial();let e=setTimeout(()=>{this._debugResumeTimer=void 0,!this._disposed&&(this._suppressRedial=!1,this._scheduleRedial())},t);Na(e),this._debugResumeTimer=e}this.clearCache()}};constructor(e){this.mux=e.mux,this.peer=e.peer,this.localCoordinate=e.localCoordinate,this.securityLevel=e.securityLevel??Ha.none,this.canPush=e.canPush,this._keepLinkAliveOption=e.keepLinkAlive,this._buildConnectInput=e.buildConnectInput,this._defaultLocalCoordinate=e.defaultLocalCoordinate,this._manager=e.createManager(this._cache)}addTransport(e){this._manager.addTransport(e)}getPreferredTransport(){return this._manager.getPreferredTransport()}async getReadyTransport(e){let t=await this._manager.getReadyTransport(e);return this._onLinkEstablished(t.methods),t}get wireMux(){return this.mux}get peerClient(){return this.peer}get requestReconnect(){return()=>void this.reconnectLink()}get _keepLinkAlive(){return this._disposed||!this.canPush?!1:this._keepLinkAliveOption==null?(this.mux?.localCaps().length??0)>0:this._keepLinkAliveOption}_onLinkEstablished(e){let t=e!==this._currentLinkMethods;if(this._currentLinkMethods=e,this._suppressRedial=!1,this._tornDown=!1,this._redialAttempts=0,this._cancelRedial(),this._cancelDebugResume(),this._hookKeepAlive(e),t){let e=this._downSince==null?void 0:Date.now()-this._downSince;this._downSince=void 0,this._emitLinkEvent({type:`link_up`,downForMs:e})}}_hookKeepAlive(e){e.addOnDisconnectListener==null||this._keepAliveHooked.has(e)||(this._keepAliveHooked.add(e),e.addOnDisconnectListener(()=>{e===this._currentLinkMethods&&(this._tornDown||(this._downSince??(this._downSince=Date.now(),this._emitLinkEvent({type:`link_down`})),this._keepLinkAlive&&!this._suppressRedial&&this._scheduleRedial()))}))}_scheduleRedial(){if(!this._keepLinkAlive||this._suppressRedial||this._redialTimer!=null)return;let e=Math.min(1e3*2**this._redialAttempts,3e4),t=e/2+e/2*Math.random();this._redialAttempts+=1,this._emitLinkEvent({type:`redial_scheduled`,attempt:this._redialAttempts,delayMs:Math.round(t)});let n=setTimeout(()=>{this._redialTimer=void 0,this.connect().catch(()=>{})},t);Na(n),this._redialTimer=n}_cancelRedial(){this._redialTimer!=null&&(clearTimeout(this._redialTimer),this._redialTimer=void 0)}_cancelDebugResume(){this._debugResumeTimer!=null&&(clearTimeout(this._debugResumeTimer),this._debugResumeTimer=void 0)}async connect(e){let t=e?.localCoordinate??this.localCoordinate??this._defaultLocalCoordinate?.();if(t==null)throw sr.fromId(`connect_exhausted`,{peerId:this.peer.stringId,attempted:[]});try{await this.getReadyTransport(this._buildConnectInput({localClient:t,externalClient:this.peer}))}catch(e){throw oo(e)||this._scheduleRedial(),e}}async reconnectLink(){this._cancelRedial(),this._suppressRedial=!0,this.clearCache();try{await this.connect()}catch(e){this._suppressRedial=!1,oo(e)||this._scheduleRedial()}}releaseLink(){this.clearTransportCache()}clearTransportCache(){this._suppressRedial=!0,this._tornDown=!0,this._cancelRedial(),this._cancelDebugResume(),this.clearCache()}dispose(){this._disposed=!0,this._tornDown=!0,this._cancelRedial(),this._cancelDebugResume(),this.clearCache()}clearCache(){for(let e of this._cache.values())e instanceof Promise?e.then(e=>e.methods.disconnect?.()).catch(()=>{}):e.methods.disconnect?.();this._cache.clear()}addLinkEventListener(e){return this._linkEventListeners.add(e),()=>{this._linkEventListeners.delete(e)}}_emitLinkEvent(e){for(let t of this._linkEventListeners)try{t(e)}catch(e){console.error(`[link] onLinkEvent listener threw`,e)}}},co;try{co=new TextDecoder}catch{}var P,lo,F=0,uo=[],fo=uo,po=0,I={},L,mo,ho=0,R=0,z,go,_o=[],B,vo={useRecords:!1,mapsAsObjects:!0},yo=class{},bo=new yo;bo.name=`MessagePack 0xC1`;var xo=!1,So=2,Co=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(P)return Qo(()=>($o(),this?this.unpack(t,n):e.prototype.unpack.call(vo,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(lo=n.end||t.length,F=n.start||0):(F=0,lo=n>-1?n:t.length),po=0,R=0,mo=null,fo=uo,z=null,P=t;try{B=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw P=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(I=this,this.structures)return L=this.structures,wo(n);(!L||L.length>0)&&(L=[])}else I=vo,(!L||L.length>0)&&(L=[]);return wo(n)}unpackMultiple(e,t){let n,r=0;try{xo=!0;let i=e.length,a=this?this.unpack(e,i):ts.unpack(e,i);if(t){if(t(a,r,F)===!1)return;for(;F<i;)if(r=F,t(wo(),r,F)===!1)return}else{for(n=[a];F<i;)r=F,n.push(wo());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{xo=!1,$o()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function wo(e){try{if(!I.trusted&&!xo){let e=L.sharedLength||0;e<L.length&&(L.length=e)}let t;if(I._readStruct&&P[F]<64&&P[F]>=32?(t=I._readStruct(P,F,lo),P=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),F=lo):t=Eo(),z&&=(F=z.postBundlePosition,null),xo&&(L.restoreStructures=null),F==lo)L&&L.restoreStructures&&To(),L=null,P=null,go&&=null;else if(F>lo)throw Error(`Unexpected end of MessagePack data`);else if(!xo){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw L&&L.restoreStructures&&To(),$o(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||F>lo)&&(e.incomplete=!0),e}}function To(){for(let e in L.restoreStructures)L[e]=L.restoreStructures[e];L.restoreStructures=null}function Eo(){let e=P[F++];if(e<160)if(e<128){if(e<64)return e;{let t=L[e&63]||I.getStructures&&Ao()[e&63];return t?(t.read||=Oo(t,e&63),t.read()):e}}else if(e<144)if(e-=128,I.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Go();e===`__proto__`&&(e=`__proto_`),t[e]=Eo()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(Eo(),Eo());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=Eo();return I.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(R>=F)return mo.slice(F-ho,(F+=t)-ho);if(R==0&&lo<140){let e=t<16?Bo(t):zo(t);if(e!=null)return e}return jo(t)}else{let t;switch(e){case 192:return null;case 193:return z?(t=Eo(),t>0?z[1].slice(z.position1,z.position1+=t):z[0].slice(z.position0,z.position0-=t)):bo;case 194:return!1;case 195:return!0;case 196:if(t=P[F++],t===void 0)throw Error(`Unexpected end of buffer`);return Ho(t);case 197:return t=B.getUint16(F),F+=2,Ho(t);case 198:return t=B.getUint32(F),F+=4,Ho(t);case 199:return Uo(P[F++]);case 200:return t=B.getUint16(F),F+=2,Uo(t);case 201:return t=B.getUint32(F),F+=4,Uo(t);case 202:if(t=B.getFloat32(F),I.useFloat32>2){let e=es[(P[F]&127)<<1|P[F+1]>>7];return F+=4,(e*t+(t>0?.5:-.5)>>0)/e}return F+=4,t;case 203:return t=B.getFloat64(F),F+=8,t;case 204:return P[F++];case 205:return t=B.getUint16(F),F+=2,t;case 206:return t=B.getUint32(F),F+=4,t;case 207:return I.int64AsType===`number`?(t=B.getUint32(F)*4294967296,t+=B.getUint32(F+4)):I.int64AsType===`string`?t=B.getBigUint64(F).toString():I.int64AsType===`auto`?(t=B.getBigUint64(F),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=B.getBigUint64(F),F+=8,t;case 208:return B.getInt8(F++);case 209:return t=B.getInt16(F),F+=2,t;case 210:return t=B.getInt32(F),F+=4,t;case 211:return I.int64AsType===`number`?(t=B.getInt32(F)*4294967296,t+=B.getUint32(F+4)):I.int64AsType===`string`?t=B.getBigInt64(F).toString():I.int64AsType===`auto`?(t=B.getBigInt64(F),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=B.getBigInt64(F),F+=8,t;case 212:if(t=P[F++],t==114)return qo(P[F++]&63);{let e=_o[t];if(e)return e.read?(F++,e.read(Eo())):e.noBuffer?(F++,e()):e(P.subarray(F,++F));throw Error(`Unknown extension `+t)}case 213:return t=P[F],t==114?(F++,qo(P[F++]&63,P[F++])):Uo(2);case 214:return Uo(4);case 215:return Uo(8);case 216:return Uo(16);case 217:return t=P[F++],R>=F?mo.slice(F-ho,(F+=t)-ho):Mo(t);case 218:return t=B.getUint16(F),F+=2,R>=F?mo.slice(F-ho,(F+=t)-ho):No(t);case 219:return t=B.getUint32(F),F+=4,R>=F?mo.slice(F-ho,(F+=t)-ho):Po(t);case 220:return t=B.getUint16(F),F+=2,Io(t);case 221:return t=B.getUint32(F),F+=4,Io(t);case 222:return t=B.getUint16(F),F+=2,Lo(t);case 223:return t=B.getUint32(F),F+=4,Lo(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}var Do=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Oo(e,t){function n(){if(n.count++>So){let r;try{r=e.read=Function(`r`,`return function(){return `+(I.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:Do.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(Eo)}catch{return So=1/0,n()}return e.read0=r,e.highByte===0&&(e.read=ko(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=Eo()}return I.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?ko(t,n):n}var ko=(e,t)=>function(){let n=P[F++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=L[r]||Ao()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=Oo(i,e),i.read()};function Ao(){let e=Qo(()=>(P=null,I.getStructures()));return L=I._mergeStructures(e,L)}var jo=Fo,Mo=Fo,No=Fo,Po=Fo;function Fo(e){let t;if(e<16&&(t=Bo(e)))return t;if(e>64&&co)return co.decode(P.subarray(F,F+=e));let n=F+e,r=[];for(t=``;F<n;){let e=P[F++];if(!(e&128))r.push(e);else if((e&224)==192){let t=P[F++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=P[F++]&63,n=P[F++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=P[F++]&63,n=P[F++]&63,i=P[F++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=Ro.apply(String,r),r.length=0)}return r.length>0&&(t+=Ro.apply(String,r)),t}function Io(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=Eo();return I.freezeData?Object.freeze(t):t}function Lo(e){if(I.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Go();e===`__proto__`&&(e=`__proto_`),t[e]=Eo()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(Eo(),Eo());return t}}var Ro=String.fromCharCode;function zo(e){let t=F,n=Array(e);for(let r=0;r<e;r++){let e=P[F++];if((e&128)>0){F=t;return}n[r]=e}return Ro.apply(String,n)}function Bo(e){if(e<4)if(e<2){if(e===0)return``;{let e=P[F++];if((e&128)>1){--F;return}return Ro(e)}}else{let t=P[F++],n=P[F++];if((t&128)>0||(n&128)>0){F-=2;return}if(e<3)return Ro(t,n);let r=P[F++];if((r&128)>0){F-=3;return}return Ro(t,n,r)}else{let t=P[F++],n=P[F++],r=P[F++],i=P[F++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){F-=4;return}if(e<6){if(e===4)return Ro(t,n,r,i);{let e=P[F++];if((e&128)>0){F-=5;return}return Ro(t,n,r,i,e)}}else if(e<8){let a=P[F++],o=P[F++];if((a&128)>0||(o&128)>0){F-=6;return}if(e<7)return Ro(t,n,r,i,a,o);let s=P[F++];if((s&128)>0){F-=7;return}return Ro(t,n,r,i,a,o,s)}else{let a=P[F++],o=P[F++],s=P[F++],c=P[F++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){F-=8;return}if(e<10){if(e===8)return Ro(t,n,r,i,a,o,s,c);{let e=P[F++];if((e&128)>0){F-=9;return}return Ro(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=P[F++],u=P[F++];if((l&128)>0||(u&128)>0){F-=10;return}if(e<11)return Ro(t,n,r,i,a,o,s,c,l,u);let d=P[F++];if((d&128)>0){F-=11;return}return Ro(t,n,r,i,a,o,s,c,l,u,d)}else{let l=P[F++],u=P[F++],d=P[F++],f=P[F++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){F-=12;return}if(e<14){if(e===12)return Ro(t,n,r,i,a,o,s,c,l,u,d,f);{let e=P[F++];if((e&128)>0){F-=13;return}return Ro(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=P[F++],m=P[F++];if((p&128)>0||(m&128)>0){F-=14;return}if(e<15)return Ro(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=P[F++];if((h&128)>0){F-=15;return}return Ro(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function Vo(){let e=P[F++],t;if(e<192)t=e-160;else switch(e){case 217:t=P[F++];break;case 218:t=B.getUint16(F),F+=2;break;case 219:t=B.getUint32(F),F+=4;break;default:throw Error(`Expected string`)}return Fo(t)}function Ho(e){return I.copyBuffers?Uint8Array.prototype.slice.call(P,F,F+=e):P.subarray(F,F+=e)}function Uo(e){let t=P[F++];if(_o[t]){let n;return _o[t](P.subarray(F,n=F+=e),e=>{F=e;try{return Eo()}finally{F=n}})}else throw Error(`Unknown extension type `+t)}var Wo=Array(4096);function Go(){let e=P[F++];if(e>=160&&e<192){if(e-=160,R>=F)return mo.slice(F-ho,(F+=e)-ho);if(!(R==0&&lo<180))return jo(e)}else return F--,Ko(Eo());let t=(e<<5^(e>1?B.getUint16(F):e>0?P[F]:0))&4095,n=Wo[t],r=F,i=F+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=B.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=P[r++],a!=n[o++]){r=1879048192;break}if(r===i)return F=r,n.string;i-=3,r=F}for(n=[],Wo[t]=n,n.bytes=e;r<i;)a=B.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=P[r++],n.push(a);let s=e<16?Bo(e):zo(e);return s==null?n.string=jo(e):n.string=s}function Ko(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if(I.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var qo=(e,t)=>{let n=Eo().map(Ko),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=L[e];return i&&(i.isShared||xo)&&((L.restoreStructures||=[])[e]=i),L[e]=n,n.read=Oo(n,r),(n.read0||n.read)()};_o[0]=()=>{},_o[0].noBuffer=!0,_o[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};var Jo={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};_o[101]=()=>{let e=Eo();if(!Jo[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return Jo[e[0]](e[1],{cause:e[2]})},_o[105]=e=>{if(I.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=B.getUint32(F-4);go||=new Map;let n=P[F],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&P[F+1]===115?new Set:{};let i={target:r};go.set(t,i);let a=Eo();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},_o[112]=e=>{if(I.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=B.getUint32(F-4),n=go.get(t);return n.used=!0,n.target},_o[115]=()=>new Set(Eo());var Yo=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),Xo=typeof globalThis==`object`?globalThis:window;_o[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=Yo[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new Xo[r](n)},_o[120]=()=>{let e=Eo();return new RegExp(e[0],e[1])};var Zo=[];_o[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=F;return F+=t-e.length,z=Zo,z=[Vo(),Vo()],z.position0=0,z.position1=0,z.postBundlePosition=F,F=n,Eo()},_o[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function Qo(e){I&&I._onSaveState&&I._onSaveState();let t=lo,n=F,r=po,i=ho,a=R,o=mo,s=fo,c=go,l=z,u=new Uint8Array(P.slice(0,lo)),d=L,f=L.slice(0,L.length),p=I,m=xo,h=e();return lo=t,F=n,po=r,ho=i,R=a,mo=o,fo=s,go=c,z=l,P=u,xo=m,L=d,L.splice(0,L.length,...f),I=p,B=new DataView(P.buffer,P.byteOffset,P.byteLength),h}function $o(){P=null,go=null,L=null}var es=Array(147);for(let e=0;e<256;e++)es[e]=+(`1e`+Math.floor(45.15-e*.30103));var ts=new Co({useRecords:!1}),ns=ts.unpack;ts.unpackMultiple,ts.unpack;var rs={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),Co.SUPPORTS_STRUCT_HOOKS=!0;var is;try{is=new TextEncoder}catch{}var as,os,ss=typeof Buffer<`u`,cs=ss?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,ls=ss?Buffer:Uint8Array,us=ss?4294967296:2144337920,V,ds,fs,H=0,ps,ms=null,hs=21760,gs=/[\u0080-\uFFFF]/,_s=Symbol(`record-id`),vs=class extends Co{constructor(e){super(e),this.offset=0;let t,n,r,i,a=ls.prototype.utf8Write?function(e,t){return V.utf8Write(e,t,V.byteLength-t)}:is&&is.encodeInto?function(e,t){return is.encodeInto(e,V.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,g=0;this.pack=this.encode=function(e,a){if(V||(V=new cs(8192),fs=V.dataView||=new DataView(V.buffer,0,8192),H=0),ps=V.length-10,ps-H<2048?(V=new cs(V.length),fs=V.dataView||=new DataView(V.buffer,0,V.length),ps=V.length-10,H=0):H=H+7&2147483640,t=H,a&2048&&(H+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(ms=[],ms.size=1/0):ms=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[_s]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?S(e):e.constructor!==Map&&!Array.isArray(e)&&!os.some(t=>e instanceof t)?S(e.toJSON?e.toJSON():e):y(e):y(e);let n=ms;if(ms&&Cs(t,y,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(fs.setUint32(n.position+t,fs.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&fs.setUint32(n.position+t,fs.getUint32(n.position+t)+a),H+=e.length*6,H>ps&&C(H),o.offset=H;let s=Ss(V.subarray(t,H),e);return i=null,s}return o.offset=H,a&512?(V.start=t,V.end=H,V):V.subarray(t,H)}catch(e){throw c=e,e}finally{if(r&&(_(),n&&o.saveStructures)){let n=r.sharedLength||0,i=V.subarray(t,H),s=(o._prepareStructures||ws)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?(r.uninitialized=!0,o.pack(e,a)):(o.lastNamedStructuresLength=n,V.length>1073741824&&(V=null),i)}V.length>1073741824&&(V=null),a&1024&&(H=t)}};let _=()=>{g<10&&g++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,g=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][_s]=0;m=[]}},v=e=>{var t=e.length;t<16?V[H++]=144|t:t<65536?(V[H++]=220,V[H++]=t>>8,V[H++]=t&255):(V[H++]=221,fs.setUint32(H,t),H+=4);for(let n=0;n<t;n++)y(e[n])},y=e=>{H>ps&&(V=C(H));var n=typeof e,r;if(n===`string`){let n=e.length;if(ms&&n>=4&&n<4096){if((ms.size+=n)>hs){let e,n=(ms[0]?ms[0].length*3+ms[1].length:0)+10;H+n>ps&&(V=C(H+n));let r;ms.position?(r=ms,V[H]=200,H+=3,V[H++]=98,e=H-t,H+=4,Cs(t,y,0),fs.setUint16(e+t-3,H-t-e)):(V[H++]=214,V[H++]=98,e=H-t,H+=4),ms=[``,``],ms.previous=r,ms.size=0,ms.position=e}let r=gs.test(e);ms[+!r]+=e,V[H++]=193,y(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if(H+o>ps&&(V=C(H+o)),n<64||!a){let t,a,o,s=H+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?V[s++]=a:a<2048?(V[s++]=a>>6|192,V[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,V[s++]=a>>18|240,V[s++]=a>>12&63|128,V[s++]=a>>6&63|128,V[s++]=a&63|128):(V[s++]=a>>12|224,V[s++]=a>>6&63|128,V[s++]=a&63|128);r=s-H-i}else r=a(e,H+i);r<32?V[H++]=160|r:r<256?(i<2&&V.copyWithin(H+2,H+1,H+1+r),V[H++]=217,V[H++]=r):r<65536?(i<3&&V.copyWithin(H+3,H+2,H+2+r),V[H++]=218,V[H++]=r>>8,V[H++]=r&255):(i<5&&V.copyWithin(H+5,H+3,H+3+r),V[H++]=219,fs.setUint32(H,r),H+=4),H+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?V[H++]=e:e<256?(V[H++]=204,V[H++]=e):e<65536?(V[H++]=205,V[H++]=e>>8,V[H++]=e&255):(V[H++]=206,fs.setUint32(H,e),H+=4);else if(e>>0===e)e>=-32?V[H++]=256+e:e>=-128?(V[H++]=208,V[H++]=e+256):e>=-32768?(V[H++]=209,fs.setInt16(H,e),H+=2):(V[H++]=210,fs.setInt32(H,e),H+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){V[H++]=202,fs.setFloat32(H,e);let n;if(t<4||(n=e*es[(V[H]&127)<<1|V[H+1]>>7])>>0===n){H+=4;return}else H--}V[H++]=203,fs.setFloat64(H,e),H+=8}else if(n===`object`||n===`function`)if(!e)V[H++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),V[H++]=214,V[H++]=112,fs.setUint32(H,n.id),H+=4;return}else i.set(e,{offset:H-t})}let a=e.constructor;if(a===Object)te(e);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)V[H++]=128;else{r=e.size,r<16?V[H++]=128|r:r<65536?(V[H++]=222,V[H++]=r>>8,V[H++]=r&255):(V[H++]=223,fs.setUint32(H,r),H+=4);for(let[t,n]of e)y(t),y(n)}else{for(let t=0,n=as.length;t<n;t++){let n=os[t];if(e instanceof n){let n=as[t];if(n.write){n.type&&(V[H++]=212,V[H++]=n.type,V[H++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?v(e):te(e):y(t);return}let r=V,i=fs,a=H;V=null;let o;try{o=n.pack.call(this,e,e=>(V=r,r=null,H+=e,H>ps&&C(H),{target:V,targetView:fs,position:H-e}),y)}finally{r&&(V=r,fs=i,H=a,ps=V.length-10)}o&&(o.length+H>ps&&C(o.length+H),H=xs(o,V,H,n.type));return}}if(Array.isArray(e))v(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return y(t)}if(n===`function`)return y(this.writeFunction&&this.writeFunction(e));te(e)}}}else if(n===`boolean`)V[H++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)V[H++]=211,fs.setBigInt64(H,e);else if(e<0x10000000000000000&&e>0)V[H++]=207,fs.setBigUint64(H,e);else if(this.largeBigIntToFloat)V[H++]=203,fs.setFloat64(H,Number(e));else if(this.largeBigIntToString)return y(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),ss)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+H>ps&&C(n.length+H),H=xs(n,V,H,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);H+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?V[H++]=192:(V[H++]=212,V[H++]=0,V[H++]=0);else throw Error(`Unknown type: `+n)},b=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?V[H++]=128|n:n<65536?(V[H++]=222,V[H++]=n>>8,V[H++]=n&255):(V[H++]=223,fs.setUint32(H,n),H+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);y(isNaN(n)?r:n),y(e[r])}else for(let i=0;i<n;i++)y(r=t[i]),y(e[r])}:e=>{V[H++]=222;let n=H-t;H+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(y(t),y(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);V[n+++t]=r>>8,V[n+t]=r&255},x=this.useRecords===!1?b:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=H++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==H?(H--,ne(i,c,u)):re(i,c,a,u),o=!0,i=l[s]}y(e[s])}if(!o){let n=i[_s];n?V[a+t]=n:re(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[_s];a?a>=96&&d?(V[H++]=((a-=96)&31)+96,V[H++]=a>>5):V[H++]=a:ne(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&y(e[t])},ee=typeof this.useRecords==`function`&&this.useRecords,te=ee?e=>{ee(e)?x(e):b(e)}:x,S=e=>{let i=o._writeStruct(e,V,t,H,r,C,(e,t,r)=>{if(r)return n=!0;H=t;let i=V;return y(e),_(),i===V?H:{position:H,targetView:fs,target:V}});if(i===0)return te(e);H=i},C=e=>{let n;if(e>16777216){if(e-t>us)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(us,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,V.length-1)>>12)+1<<12;let r=new cs(n);return fs=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,V.length),V.copy?V.copy(r,0,t,e):r.set(V.slice(t,e)),H-=t,t=0,ps=r.length-10,V=r},ne=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[_s]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(V[H++]=(a&31)+96,V[H++]=o):V[H++]=a):(o>=0?(V[H++]=213,V[H++]=114,V[H++]=(a&31)+96,V[H++]=o):(V[H++]=212,V[H++]=114,V[H++]=a),i&&(h+=g*i),m.length>=u&&(m.shift()[_s]=0),m.push(e),y(t))},re=(e,n,r,i)=>{let a=V,o=H,s=ps,c=t;V=ds,H=0,t=0,V||(ds=V=new cs(8192)),ps=V.length-10,ne(e,n,i),ds=V;let l=H;if(V=a,H=o,ps=s,t=c,l>1){let e=H+l-1;e>ps&&C(e);let n=r+t;V.copyWithin(n+l,n+1,H),V.set(ds.slice(0,l),n),H=e}else V[r+t]=ds[0]}}useBuffer(e){V=e,V.dataView||=new DataView(V.buffer,V.byteOffset,V.byteLength),fs=V.dataView,H=0}set position(e){H=e}get position(){return H}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};os=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,yo],as=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?ys(e,16,t):bs(ss?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==ls&&this.moreTypes?ys(e,Yo.indexOf(n.name),t):bs(e,t)}},{pack(e,t){this.moreTypes?ys(e,17,t):bs(ss?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function ys(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function bs(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function xs(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function Ss(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function Cs(e,t,n){if(ms.length>0){fs.setUint32(ms.position+e,H+n-ms.position-e),ms.stringsPosition=H-e;let r=ms;ms=null,t(r[0]),t(r[1])}}function ws(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}vs.SUPPORTS_STRUCT_HOOKS=!0;var Ts=new vs({useRecords:!1}),Es=Ts.pack;Ts.pack;var{NEVER:Ds,ALWAYS:Os,DECIMAL_ROUND:ks,DECIMAL_FIT:As}=rs,js=2;function Ms({link:e,keyMaterial:t}){let n=e.deriveSharedAesGcmKey(t);return{async encryptFrame(e){let{nonce:t,ciphertext:r}=await oi({dataToEncrypt:e,aesGcmKey:await n});return Es([t,r])},async decryptFrame(e){if(typeof e==`string`)throw Error(`[ws-crypto] expected an encrypted binary frame, received text`);let t=ns(e instanceof ArrayBuffer?new Uint8Array(e):e);if(!Array.isArray(t)||t.length!==js)throw Error(`[ws-crypto] malformed encrypted frame envelope`);let[r,i]=t;if(!(r instanceof Uint8Array)||!(i instanceof Uint8Array))throw Error(`[ws-crypto] malformed encrypted frame fields`);return await kr({dataToDecrypt:{nonce:r,ciphertext:i},aesGcmKey:await n})}}}var Ns={invalid:0,realm:1,devtools:2};function Ps(e){let t;if(e instanceof Uint8Array)t=e.length>0?e[0]:void 0;else if(e instanceof ArrayBuffer)t=e.byteLength>0?new Uint8Array(e,0,1)[0]:void 0;else return;if(!(t==null||t>15))return t}function Fs(e,t){if(e<=0||e>15)throw Error(`encodeProtocolFrame: prefix 0x${e.toString(16)} outside reserved range`);let n=new Uint8Array(t.length+1);return n[0]=e,n.set(t,1),n}function Is(e){return`proto:${e}`}function Ls(e){let t=new Set;for(let n of e??[])n.startsWith(`proto:`)&&t.add(n.slice(6));return t}function Rs(e){return typeof e==`string`?new TextEncoder().encode(e):e instanceof ArrayBuffer?new Uint8Array(e):e}function zs(e){let{write:t,isOpen:n,crypto:r,label:i=`link`}=e,a=Promise.resolve();return{send:(e,o)=>{if(n!=null&&!n())return;if(r==null){t(e,o);return}let s=Rs(e);a=a.then(()=>r).then(e=>e.encryptFrame(s)).then(e=>{(n==null||n())&&t(e,o)}).catch(e=>console.error(`[${i}] failed to encrypt/send frame`,e))},decryptIncoming:async e=>{if(r==null)return e;try{return await(await r).decryptFrame(e)}catch(e){console.error(`[${i}] failed to decrypt incoming frame`,e);return}}}}function Bs(e,t){return n=>{e(n.linkId==null?{...n,linkId:t}:n)}}function Vs(e,t,n){return{exchange:async(r,i)=>{t({dir:`out`,bytes:Us(r),lane:`http`,linkId:n});let a=await e.exchange(r,i);return t({dir:`in`,bytes:Us(a),lane:`http`,linkId:n}),a},get label(){return e.label}}}var Hs;function Us(e){return typeof e==`string`?(Hs??=new TextEncoder,Hs.encode(e).byteLength):e instanceof Uint8Array||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:0}function Ws(e,t){return t.id===`identity_pin_mismatch`?sr.fromId(`identity_pin_mismatch`,{reason:t.reason}):sr.fromId(`handshake_rejected`,{stage:e,reason:t.reason})}var Gs=15e3,Ks=`link-handshake`;function qs(e,t,n){return sr.fromId(`endpoint_answered_non_protocol`,{stage:Ks,expected:t,url:e.label,receivedKind:`hs/${n}`})}var Js=`ping`,Ys=`pong`;function Xs(e,t,n){let r=Date.now(),i,a,o=!1,s=e=>{a=setTimeout(c,e),Na(a)},c=()=>{if(o||!e.isOpen())return;if(i!=null){e.close();return}let a=Date.now()-r;if(a>=t.idleMs){i=Date.now();try{e.send(Js),n?.({dir:`out`,bytes:4,lane:`keepalive`})}catch{}s(t.pongTimeoutMs)}else s(t.idleMs-a)};return s(t.idleMs),{noteInbound:()=>{r=Date.now(),i=void 0},stop:()=>{o=!0,a!=null&&clearTimeout(a)}}}function Zs(e){let t=!1,n,r=()=>{t||(t=!0,n?.())};return{ready:e.ready,isOpen:()=>e.isOpen(),send:t=>e.send(t),attach:t=>{n=t.onClose,e.attach({onMessage:t.onMessage,onClose:r,onError:r})},close:()=>{e.close(),queueMicrotask(r)},get label(){return e.label}}}function Qs(e){let t=Zs(e.channel),n=[],r=e.tap,i=ec(t,void 0,r),a=tc(t,i),o=e.mux,s=e.keepalive==null?void 0:Xs(t,e.keepalive,r);return s!=null&&n.push(s.stop),t.attach({onMessage:t=>{if(s?.noteInbound(),t===Ys){r?.({dir:`in`,bytes:4,lane:`keepalive`});return}ic(i,t,o,e.lane,a,r)},onClose:()=>ac(n,e.lane),onError:()=>ac(n,e.lane)}),o!=null&&(o.setRemoteProtocolIds(Ls(o.localCaps())),o.attach(r==null?e=>i.send(e):e=>i.send(e,o.protocolIdFor(e)??`protocol`)),n.push(()=>o.detach())),nc(t,i,n,void 0)}async function $s(e){let t=Zs(e.channel),n=[],r=e.tap,i={},a=!1,o=[],s=[],c=[],l,u,d=e.mux;t.attach({onMessage:t=>{if(u?.noteInbound(),t===Ys){r?.({dir:`in`,bytes:4,lane:`keepalive`});return}if(a&&i.pipe!=null&&i.port!=null){ic(i.pipe,t,d,e.lane,i.port,r);return}if(typeof t==`string`){let e=Xa(t);if(e!=null){r?.({dir:`in`,bytes:Us(t),lane:`handshake`});let n=s.shift();n==null?o.push(e):n(e);return}l??=t}c.push(t)},onClose:()=>ac(n,e.lane),onError:()=>ac(n,e.lane)});let f=()=>{let e=o.shift();return e==null?new Promise((e,n)=>{let r=setTimeout(()=>n(l==null?Error(`[${Ks}] timed out waiting for peer reply`):sr.fromId(`endpoint_answered_non_protocol`,{stage:Ks,expected:`a handshake frame`,url:t.label,bodyPreview:vr(l)})),Gs);s.push(t=>{clearTimeout(r),e(t)})}):Promise.resolve(e)},{crypto:p,remoteCaps:m}=await rc({...e,channel:t},f),h=ec(t,p,r),g=tc(t,h);i.pipe=h,i.port=g,d!=null&&(d.setRemoteProtocolIds(Ls(m)),d.attach(r==null?e=>h.send(e):e=>h.send(e,d.protocolIdFor(e)??`protocol`)),n.push(()=>d.detach())),e.lane.onAttach?.(g,{remoteCaps:m??[]}),a=!0;for(let t of c)await ic(h,t,d,e.lane,g,r);return c.length=0,e.keepalive!=null&&(u=Xs(t,e.keepalive,r),n.push(u.stop)),nc(t,h,n,m)}function ec(e,t,n){return zs({write:n==null?t=>e.send(t):(t,r)=>{n({dir:`out`,bytes:Us(t),lane:r??`action`}),e.send(t)},isOpen:()=>e.isOpen(),crypto:t})}function tc(e,t){return{send:e=>t.send(e),isOpen:()=>e.isOpen()}}function nc(e,t,n,r){return{send:e=>t.send(e),isOpen:()=>e.isOpen(),close:()=>{try{e.close()}catch{}},addOnDisconnectListener:e=>{n.push(e)},remoteCaps:r}}async function rc(e,t){let n=e.secure,r=t=>{e.channel.send(t),e.tap?.({dir:`out`,bytes:Us(t),lane:`handshake`})};await n.link.initialize();let i=e.lane.handshakeConfig(),a=no({link:n.link,localCoordinate:n.localCoordinate,dictionaryVersion:i.dictionaryVersion,securityLevel:n.securityLevel,channelTags:i.channels,extraCaps:[...e.lane.caps?.()??[],...e.mux?.localCaps()??[]]});r(Ya(await a.createHello()));let o=await t();if(o.t===Ua.reject)throw Ws(Ks,o);if(o.t!==Ua.welcome)throw qs(e.channel,`a welcome frame`,o.t);r(Ya(await a.onWelcome(o)));let s=await t();if(s.t===Ua.reject)throw Ws(Ks,s);if(s.t!==Ua.accept)throw qs(e.channel,`an accept frame`,s.t);let c=await a.onAccept(s);return{crypto:c.securityLevel===Ha.encrypted&&c.encryptionKeyMaterial!=null?Ms({link:n.link,keyMaterial:c.encryptionKeyMaterial}):void 0,remoteCaps:c.remoteCaps}}async function ic(e,t,n,r,i,a){let o=a==null?0:Us(t),s=await e.decryptIncoming(t);if(s!==void 0){if(n?.dispatchIncoming(s)){a?.({dir:`in`,bytes:o,lane:n.protocolIdFor(s)??`protocol`});return}a?.({dir:`in`,bytes:o,lane:`action`}),await r.onLaneFrame(s,i)}}function ac(e,t){for(let t of e)t();t.onDetach?.()}var oc=0,sc=class{def;transOrd=oc++;type;initialized;definition;constructor(e){this.def=e,this.type=e.type,this.initialized=e.initialize()}getRouteInfo(e){return this.definition?.getRouteInfo(e)}_needsAsyncBringUp(e){return!1}_awaitCarrierReady(e){return Promise.resolve()}_finalizeReady(e){return this._finalizeTransportMethods(e)}_getCacheKey(e){let t=this.initialized.getTransportCacheKey?.(e);return t==null?null:t.join(`\0`)}getCacheKey(e){let t=this._getCacheKey(e);return t==null?null:`${this.transOrd}:${t}`}isAvailable(e){return this.initialized.isAvailable?.(e)??!0}getTransport(e){return this._processTransportStatus(e)}_processTransportStatus(e){let t=cc(this.initialized.getTransport(e));if(t.status===Sr.ready)return this._needsAsyncBringUp(t.readyData)?{status:Sr.initializing,timeStarted:Date.now(),initializationPromise:this._bringUp(t.readyData)}:{status:Sr.ready,readyData:this._finalizeTransportMethods(t.readyData)};if(t.status===Sr.initializing){let e=t.initializationPromise.then(e=>e.status===Sr.ready?this._bringUp(e.readyData):e);return{status:Sr.initializing,timeStarted:t.timeStarted,initializationPromise:e}}return t}async _bringUp(e){return await this._awaitCarrierReady(e),{status:Sr.ready,readyData:await this._finalizeReady(e)}}};function cc(e){return e.status===Sr.ready?{status:Sr.ready,readyData:e.readyData}:e.status===Sr.initializing?{status:Sr.initializing,initializationPromise:e.initializationPromise,timeStarted:Date.now()}:e.status===Sr.failed?{status:Sr.failed,error:e.error,timeFailed:Date.now()}:e.status===Sr.unsupported?{status:Sr.unsupported}:{status:Sr.uninitialized}}var lc=class{_byPrefix=new Map;_send;_remoteProtocolIds=new Set;_attached=!1;registerProtocol(e){if(this._attached&&console.warn(`[wire] registerProtocol("${e.id}"): the connection is already attached — this protocol missed the handshake's caps advertisement and will not be resumed after a host wake. Register it before connecting.`),e.prefixByte<=Ns.invalid||e.prefixByte>15)throw Error(`registerProtocol("${e.id}"): prefix 0x${e.prefixByte.toString(16)} outside the reserved range`);if(this._byPrefix.has(e.prefixByte))throw Error(`registerProtocol("${e.id}"): prefix 0x${e.prefixByte.toString(16)} already registered`);let t={send:t=>{if(!this._canSpeak(e))throw Error(`protocol "${e.id}": connection not attached or peer did not advertise "${Is(e.id)}"`);this._send?.(Fs(e.prefixByte,t))},isOpen:()=>this._canSpeak(e)};return this._byPrefix.set(e.prefixByte,{protocol:e,port:t}),this._attached&&this._canSpeak(e)&&e.onAttach?.(t),t}localCaps(){return[...this._byPrefix.values()].map(({protocol:e})=>Is(e.id))}setRemoteProtocolIds(e){this._remoteProtocolIds=e}attach(e){this._send=e,this._attached=!0;for(let{protocol:e,port:t}of this._byPrefix.values())this._canSpeak(e)&&e.onAttach?.(t)}detach(){if(this._attached){this._attached=!1,this._send=void 0;for(let{protocol:e}of this._byPrefix.values())e.onDetach?.()}}protocolIdFor(e){let t=Ps(e);if(t!=null)return this._byPrefix.get(t)?.protocol.id}dispatchIncoming(e){let t=Ps(e);if(t==null)return!1;let n=this._byPrefix.get(t);if(t===Ns.invalid||n==null)return!0;let r=e instanceof Uint8Array?e:new Uint8Array(e);return n.protocol.onFrame(r.subarray(1),n.port),!0}_canSpeak(e){return this._attached&&this._remoteProtocolIds.has(e.id)}},uc=15e3,dc=5e3,fc=new Set;function pc(e,t,n){if(n.durable!==!1||t.perId==null)return;let r=`${t.envId}::${t.perId}`;fc.has(r)||(fc.add(r),console.warn(`${e}: the runtime coordinate [${r}] carries a persistent id, which keys the peer's trust-on-first-use verify-key pin — but the \`storage\` passed here is not durable (memory/session-backed), so this client's crypto identity regenerates on every reload. The peer will pin the first key it sees and reject every reconnect after the first reload (identity_pin_mismatch). Back the connection with a durable adapter (e.g. createWebLocalStorageAdapter) that persists at least as long as the persistent id, or set \`ephemeralIdentity: true\` if the id is minted fresh per session. Memory adapters are for tests.`))}function mc(e){let t=e.mux??new lc;for(let n of e.protocols??[])t.registerProtocol(n);let n=e.link;if(e.anySecure&&n==null){if(e.storage==null)throw Error(`${e.callerName}: a secure transport requires \`storage\` (or \`link\`) for the crypto identity. Pass it, or set \`secure: false\` on the transport for a plain connection.`);e.ephemeralIdentity!==!0&&pc(e.callerName,e.identity,e.storage),n=new ka({storageAdapter:e.storage})}let r=()=>{if(e.linkKeepalive===!1)return;let n=e.linkKeepalive;if(n!=null||e.keepLinkAlive===!0||e.keepLinkAlive!==!1&&t.localCaps().length>0)return{idleMs:n?.idleMs??uc,pongTimeoutMs:n?.pongTimeoutMs??dc}},i=e.wireTap==null?void 0:Bs(e.wireTap,e.peer.stringId);return{mux:t,link:n,resolveLinkKeepalive:r,wireTap:i}}function hc(e){return JSON.stringify(e)}function gc(e){let t=_c(e);return vc(t)?t:void 0}function _c(e){try{return JSON.parse(e)}catch{return}}function vc(e){return yc(e)&&(e.k===`hs`||e.k===`act`||e.k===`err`)}function yc(e){return typeof e==`object`&&!!e&&`k`in e}var bc=new TextEncoder,xc=new TextDecoder;function Sc(e){return wc(e,{})}async function Cc(e){let t=await Dc(e.carrier,e.secure,e.lane);return wc(e.carrier,t)}function wc(e,t){let n=async(n,r)=>{let i=await Tc(t,n);return e.exchange(hc(i),{signal:r?.signal})};return{send:async(e,t)=>{await n(e,t)},exchange:async(e,r)=>{let i=gc(Mc(await n(e,r)));if(i==null)return{ok:!1,reason:`malformed_reply`};if(i.k===`err`)return{ok:!1,reason:`peer_error`,message:i.message};let a=await Ec(t,i);return a===void 0?{ok:!1,reason:`malformed_reply`}:{ok:!0,wire:a}}}}async function Tc(e,t){if(e.crypto!=null){let n=await e.crypto.encryptFrame(bc.encode(JSON.stringify(t)));return{k:`act`,t:e.token,c:pi(n)}}return{k:`act`,t:e.token,w:t}}async function Ec(e,t){if(t.k===`act`){if(`c`in t){if(e.crypto==null)return;let n=await e.crypto.decryptFrame(mi(t.c));return JSON.parse(xc.decode(n))}return t.w}}async function Dc(e,t,n){await t.link.initialize();let r=no({link:t.link,localCoordinate:t.localCoordinate,dictionaryVersion:n.dictionaryVersion,securityLevel:t.securityLevel,channelTags:n.channels}),i=await kc(e,{k:`hs`,m:Ya(await r.createHello())},`a welcome frame`),a=Xa(i.m);if(a==null)throw Ac(e,`a welcome frame`,`hs (undecodable)`);if(a.t===Ua.reject)throw Ws(Oc,a);if(a.t!==Ua.welcome)throw Ac(e,`a welcome frame`,`hs/${a.t}`);if(i.hsc==null)throw Error(`[${Oc}] welcome missing handshake continuation token${jc(e)}`);let o=await kc(e,{k:`hs`,m:Ya(await r.onWelcome(a)),hsc:i.hsc},`an accept frame`),s=Xa(o.m);if(s==null)throw Ac(e,`an accept frame`,`hs (undecodable)`);if(s.t===Ua.reject)throw Ws(Oc,s);if(s.t!==Ua.accept)throw Ac(e,`an accept frame`,`hs/${s.t}`);if(o.t==null)throw Error(`[${Oc}] accept missing session token${jc(e)}`);let c=await r.onAccept(s),l=c.securityLevel===Ha.encrypted&&c.encryptionKeyMaterial!=null?Ms({link:t.link,keyMaterial:c.encryptionKeyMaterial}):void 0;return{token:o.t,crypto:l}}var Oc=`exchange-handshake`;async function kc(e,t,n){let r=Mc(await e.exchange(hc(t))),i=gc(r);if(i==null)throw sr.fromId(`endpoint_answered_non_protocol`,{stage:Oc,expected:n,url:e.label,bodyPreview:vr(r)});if(i.k===`err`)throw sr.fromId(`handshake_rejected`,{stage:Oc,reason:i.message});if(i.k!==`hs`)throw Ac(e,n,i.k);return i}function Ac(e,t,n){return sr.fromId(`endpoint_answered_non_protocol`,{stage:Oc,expected:t,url:e.label,receivedKind:n})}function jc(e){return e.label==null?``:` (endpoint: ${e.label})`}function Mc(e){return typeof e==`string`?e:xc.decode(e instanceof ArrayBuffer?new Uint8Array(e):e)}new TextEncoder,new TextDecoder;function Nc(e){if(e.length===0)return!1;let t=e[0];return t>=128&&t<=143||t===222||t===223}function Pc(e){return typeof e!=`object`||!e||Array.isArray(e)||!(`$c`in e&&`domain`in e&&`id`in e)||typeof e.domain!=`string`||typeof e.id!=`string`||`k`in e&&e.k!=null&&typeof e.k!=`string`?!1:e.$c===`rack`?`ack`in e&&typeof e.ack==`number`:e.$c===`rsync`?!0:e.$c===`rskip`?`seq`in e&&typeof e.seq==`number`:e.$c===`rclose`}function Fc(e){return Es(e)}function Ic(e){let t;if(e instanceof ArrayBuffer)t=new Uint8Array(e);else if(e instanceof Uint8Array)t=e;else return;if(Nc(t))try{let e=ns(t);return Pc(e)?e:void 0}catch{return}}function Lc(e,t,n,r){let i=`${e.stringId}::${t}:${n}`;return r==null?i:`${i}#${r}`}var Rc=new Set;function zc(e,t){let n=`${e}:${t}`;Rc.has(n)||(Rc.add(n),console.warn(`[reliable] "${n}" is .reliable() but this transport has no binary codec, so its reliability metadata can't be sent — the frame is delivered best-effort (no ordering/dedup/resend). Reliable delivery requires the binary wire codec (use a channel-based transport).`))}var Bc=new Set;function Vc(e,t){let n=`${e}:${t}`;Bc.has(n)||(Bc.add(n),console.warn(`[reliable] "${n}" is .reliable() but the connected peer did not advertise reliable support (an older server) — the frame is sent best-effort (no ordering/dedup/resend). Upgrade the peer to enable reliable delivery.`))}var Hc=new Set;function Uc(e,t){let n=`${e}:${t}`;Hc.has(n)||(Hc.add(n),console.warn(`[reliable] "${n}" was sent with a streamKey but the connected peer did not advertise streamkey support (an older peer) — a keyed reliable frame it can't interpret is dropped, not delivered. Upgrade the peer, or drop the streamKey to use the single default stream.`))}var Wc=new Set;function Gc(e,t){let n=`${e}:${t}`;Wc.has(n)||(Wc.add(n),console.warn(`[reliable] a reply-less "${n}" frame was abandoned — not acknowledged within the delivery deadline. The stream skips past it and continues; the frame may not have been delivered. (Reply-less reliable sends report success on send; this warning is where a bounded non-delivery surfaces.)`))}var Kc=class{form;_domain;id;domain;allDomains;schema;constructor(e,t,n){this.form=e,this._domain=t,this.id=n,this.domain=t.domain,this.allDomains=t.allDomains,this.schema=t.actionSchema[n]}toJsonObject(){return{form:this.form,domain:this.domain,allDomains:this.allDomains,id:this.id}}toJsonString(){return JSON.stringify(this.toJsonObject())}},qc=function(e){return e.core=`core`,e.context=`context`,e.data=`data`,e}({}),Jc=class extends Kc{_domain;form=qc.context;_routing;timeCreated;cuid;originClient;reliability;constructor(e,t,n){super(qc.context,e,t),this._domain=e,this.timeCreated=n.timeCreated,this.cuid=n.cuid,this._routing=n.routing,this.originClient=n.originClient,this.reliability=n.reliability}_setOriginClient(e){this.originClient=e}toJsonString(){return JSON.stringify(this.toJsonObject())}toContextDataJsonObject(){return{timeCreated:this.timeCreated,cuid:this.cuid,routing:this.routing.map(e=>({runtime:e.runtime.toJsonObject(),handler:e.handler,time:e.time})),originClient:this.originClient.toJsonObject()}}toJsonObject(){return{...super.toJsonObject(),...this.toContextDataJsonObject()}}get routing(){return this._routing}addRouteItem(e){this._routing.push(e)}deserializeInput(e){return this.schema.deserializeInput(e)}serializeInput(e){return this.schema.serializeInput(e)}validateInput(e){return this.schema.validateInput(e,{domain:this.domain,actionId:this.id})}validateOutput(e){return this.schema.validateOutput(e,{domain:this.domain,actionId:this.id})}},Yc=class extends Kc{form=qc.data;type;context;time;constructor(e,t,n){super(qc.data,e._domain,e.id),this.context=e,this.type=t,this.time=n.time}toBaseJsonObject(){return{...super.toJsonObject(),type:this.type,context:this.context.toContextDataJsonObject(),time:this.time}}};function Xc(e){return e==null?String(e):typeof e==`object`?Array.isArray(e)?`[${e.map(Xc).join(`,`)}]`:`{`+Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Xc(e[t])}`).join(`,`)+`}`:JSON.stringify(e)??`undefined`}function Zc(e){let t=2166136261;for(let n=0;n<e.length;n++)t=(t^e.charCodeAt(n))*16777619>>>0;return t.toString(16).padStart(8,`0`)}function Qc(e){return Zc(Xc(e))}var U=function(e){return e.request=`request`,e.progress=`progress`,e.result=`result`,e.stream=`stream`,e.push=`push`,e}({}),$c=class extends Yc{progress;constructor(e,t,n){super(e.context,U.progress,n),this.progress=t}toJsonObject(){return{...this.toBaseJsonObject(),progress:this.progress}}toJsonString(){return JSON.stringify(this.toJsonObject())}toHttpResponse(){return new Response(this.toJsonString(),{status:200,headers:{"Content-Type":`application/json`}})}},el=class extends Yc{result;outputHash;constructor(e,t,n){if(super(e.context,U.result,n),t.ok)this.result=t,this.outputHash=Qc(this.context.schema.serializeOutput(t.output));else{let e=this.context.schema.isExpectedError(t.error);this.result=e?{ok:!1,expected:!0,error:t.error}:{ok:!1,expected:!1,error:t.error},this.outputHash=Qc(t.error.message)}}toJsonObject(){let e=this.result.ok?{ok:!0,output:this.context.schema.serializeOutput(this.result.output)}:{ok:!1,expected:this.result.expected,error:this.result.error.toJsonObject()};return{...this.toBaseJsonObject(),result:e,outputHash:this.outputHash}}toJsonString(){return JSON.stringify(this.toJsonObject())}toHttpResponse({useErrorStatus:e=!0}={}){return new Response(this.toJsonString(),{status:this.result.ok?200:e?this.result.error.httpStatusCode:500,headers:{"Content-Type":`application/json`}})}},tl=class extends Yc{input;inputHash;_callSite;constructor(e,t,n){super(e.context,U.request,n),this.input=t,this.inputHash=Qc(this.context.schema.serializeInput(t))}successResult(...e){let t=e[0],n=this.context.schema.validateOutput(t,{domain:this.domain,actionId:this.id});return new el(this,{ok:!0,output:n},{time:Date.now()})}errorResult(e){return new el(this,{ok:!1,error:e},{time:Date.now()})}progress(e){return new $c(this,e,{time:Date.now()})}toJsonObject(){return{...super.toBaseJsonObject(),input:this.context.schema.serializeInput(this.input),inputHash:this.inputHash}}toJsonString(){return JSON.stringify(this.toJsonObject())}async runToOutput(e){let t=await(await this.run(e)).waitForResultPayload();if(t.result.ok)return t.result.output;throw t.result.error}async runToResultPayload(e){return(await this.run(e)).waitForResultPayload()}async runToResult(e){return(await this.runToResultPayload(e)).result}async run(e){return this._callSite??=Error().stack,this._domain.runAction(this,e)}},nl=class extends Kc{_domain;form=qc.core;constructor(e,t){super(qc.core,e,t),this._domain=e}is(e){return e instanceof Yc&&e.domain===this.domain&&e.id===this.id}isExpectedError(e){return e instanceof se&&this.schema.isExpectedError(e)}toJsonObject(){return{id:this.id,form:this.form,domain:this.domain,allDomains:this.allDomains}}request(...e){let t=e[0],n=this.schema.validateInput(t,{actionId:this.id,domain:this.domain});return new tl({context:new Jc(this._domain,this.id,{cuid:Fa(),timeCreated:Date.now(),routing:[],originClient:Ra.unknown})},n,{time:Date.now()})}deserializeInput(e){return this.schema.deserializeInput(e)}serializeInput(e){return this.schema.serializeInput(e)}validateInput(e){return this.schema.validateInput(e,{domain:this.domain,actionId:this.id})}validateOutput(e){return this.schema.validateOutput(e,{domain:this.domain,actionId:this.id})}},rl=function(e){return e.started=`started`,e.progress=`progress`,e.finished=`finished`,e.reliability=`reliability`,e}({}),il=function(e){return e.aborted=`aborted`,e.failed=`failed`,e.success=`success`,e}({}),al=class{_state;reliability;context;cuid;id;_domain;domain;allDomains;parentCuid;callSite;_resultPayloadPromise;_resolveResult;_rejectResult;_isAborted=!1;_updates=[];_updateListeners=[];_ackOutcome;_ackPromise;_resolveAck;_rejectAck;constructor(e){this.context=e.context,this.cuid=e.context.cuid,this.id=e.context.id,this.domain=e.context.domain,this.allDomains=e.context.allDomains,this._domain=e.context._domain,this.parentCuid=e.parentCuid,this.callSite=e.callSite,this._resultPayloadPromise=new Promise((e,t)=>{this._resolveResult=e,this._rejectResult=t}),this._resultPayloadPromise.catch(()=>{}),this._state={request:e.request,progress:e.progress??[],result:e.result},this._sendUpdate({type:rl.started,runningAction:this,time:Date.now()})}get state(){return this._state}get isSettled(){return this._state.result!=null||this._isAborted}get isAborted(){return this._isAborted}_setReliability(e){this.reliability=e}waitForAck(){if(this._ackPromise==null){this._ackPromise=new Promise((e,t)=>{this._resolveAck=e,this._rejectAck=t}),this._ackPromise.catch(()=>{});let e=this._ackOutcome;e!=null&&(e.ok?this._resolveAck?.():this._rejectAck?.(e.reason))}return this._ackPromise}_settleAck(e){return this._ackOutcome==null?(this._ackOutcome=e,e.ok?this._resolveAck?.():this._rejectAck?.(e.reason),!0):!1}_notifyAcked(){this.reliability!=null&&this.reliability.acked!==!0&&(this.reliability.acked=!0,this._sendUpdate({type:rl.reliability,runningAction:this,time:Date.now()})),this._settleAck({ok:!0})}_notifyAckAbandoned(e){this._settleAck({ok:!1,reason:e})}abort(e){this._abort(e)}addUpdateListeners(e){this._updateListeners.push(...e);for(let t of this._updates)for(let n of e)n(t);return()=>{for(let t of e){let e=this._updateListeners.indexOf(t);e!==-1&&this._updateListeners.splice(e,1)}}}async*iterateUpdates(){let e=[],t=null,n=this.addUpdateListeners([n=>{e.push(n),t&&=(t(),null)}]);try{for(;;){e.length===0&&await new Promise(e=>{t=e});let n=e.shift();if(yield n,n.type===rl.finished)break}}finally{n()}}_sendUpdate(e){this._updates.push(e);for(let t of this._updateListeners)t(e)}_completeWithResult(e){return this._state.result!=null||this._isAborted?!1:(this._state={request:this._state.request,progress:this._state.progress,result:e},this._resolveResult(e),this._sendUpdate({type:rl.finished,finishType:il.success,runningAction:this,time:Date.now(),response:e}),this.reliability??this._settleAck({ok:!0}),!0)}_abort(e){return this._state.result!=null||this._isAborted?!1:(this._isAborted=!0,this._rejectResult(e),this._sendUpdate({type:rl.finished,finishType:il.aborted,runningAction:this,time:Date.now(),reason:e}),this.reliability??this._settleAck({ok:!1,reason:e}),!0)}_failWithError(e){return this._state.result!=null||this._isAborted?!1:(this._isAborted=!0,this._rejectResult(e),this._sendUpdate({type:rl.finished,finishType:il.failed,runningAction:this,time:Date.now(),error:e}),this.reliability??this._settleAck({ok:!1,reason:e}),!0)}_updateProgress(e){this._state.result!=null||this._isAborted||(this._state.progress.push(e),this._sendUpdate({type:rl.progress,runningAction:this,time:Date.now(),progress:e.progress}))}waitForResultPayload(){return this._resultPayloadPromise}_resolveFromJson(e){if(this._state.result!=null||this._isAborted)return!1;let t=this._domain.hydrateResultPayload(e);return this._completeWithResult(t)}},ol=function(e){return e.not_implemented=`not_implemented`,e.action_id_not_in_domain=`action_id_not_in_domain`,e.domain_already_exists_in_hierarchy=`domain_already_exists_in_hierarchy`,e.domain_name_collision=`domain_name_collision`,e.domain_no_handler=`domain_no_handler`,e.hydration_domain_mismatch=`hydration_domain_mismatch`,e.hydration_action_state_mismatch=`hydration_action_state_mismatch`,e.hydration_action_id_not_found=`hydration_action_id_not_found`,e.no_action_execution_handler=`no_action_execution_handler`,e.wire_action_not_payload=`wire_action_not_payload`,e.wire_not_action_data=`wire_not_action_data`,e.client_runtime_already_registered=`client_runtime_already_registered`,e.client_runtime_not_registered=`client_runtime_not_registered`,e.runtime_reset=`runtime_reset`,e.no_client_runtimes_registered=`no_client_runtimes_registered`,e.action_input_validation_failed=`action_input_validation_failed`,e.action_input_validation_promise=`action_input_validation_promise`,e.action_output_validation_failed=`action_output_validation_failed`,e.action_output_validation_promise=`action_output_validation_promise`,e}({}),W=fe.createChildDomain({domain:`err_nice_action`,defaultHttpStatusCode:500,schema:{not_implemented:D({message:({label:e})=>`The "${e}" functionality is not implemented yet.`}),action_id_not_in_domain:D({message:({actionId:e,domain:t})=>`Action with id "${e}" does not exist in domain "${t}".`}),domain_already_exists_in_hierarchy:D({message:({domain:e,allParentDomains:t,parentDomain:n})=>`Domain "${e}" already exists in the hierarchy under the parent "${n}". All parent domains ["${t.join(`, `)}"]`}),domain_name_collision:D({message:({domain:e,existingParentDomains:t,incomingParentDomains:n})=>`Two different domain definitions named "${e}" were registered on one runtime router (existing under [${t.join(` > `)}], incoming under [${n.join(` > `)}]). Wire routing is by name only, so the later registration would silently shadow the earlier one — give the domains distinct names, or register the same instance.`}),domain_no_handler:D({message:({domain:e})=>`Domain "${e}" has no action handler registered.`}),hydration_domain_mismatch:D({message:({expected:e,received:t})=>`Cannot hydrate action: domain mismatch. Expected "${e}", got "${t}".`}),hydration_action_state_mismatch:D({message:({expected:e,received:t})=>`Cannot hydrate action: action state type mismatch. Expected "${e}", got "${t}".`}),hydration_action_id_not_found:D({message:({domain:e,actionId:t})=>`Cannot hydrate action: id "${t}" does not exist in domain "${e}".`}),no_action_execution_handler:D({message:({domain:e,actionId:t,specifiedClient:n})=>`${n?` The targeted client runtime [${n.stringId}] has no`:`No`} action handler registered for "${t}" in domain "${e}".`}),wire_action_not_payload:D({message:({domain:e,actionId:t,actionState:n})=>`Cannot handle wire for action "${t}" in domain "${e}": expected action form of "${qc.data}" and type of "${U.request}", "${U.progress}" or "${U.result}", got "${n}".`}),wire_not_action_data:D({message:()=>`Cannot handle wire for action: expected an object with a "domain" property of type string, a "form" property of "${qc.data}" and a "type" property of "${U.request}", "${U.progress}" or "${U.result}".`}),runtime_reset:D({message:()=>`Runtime has been reset.`}),client_runtime_already_registered:D({message:({context:e,client:t})=>`Environment is already registered${e?.domain?` on domain "${e.domain}"`:``} for client [${t.stringId}]. Each client specifier (exact match on all properties) may only be registered once.`}),client_runtime_not_registered:D({message:({context:e,clientStringId:t})=>`No runtime registered${e?.domain?` on domain "${e.domain}"`:``} for client [${t}].`}),no_client_runtimes_registered:D({message:({context:e})=>`No runtimes registered${e?.domain?` on domain "${e.domain}"`:``}. Add handlers to a runtime via runtime.addHandlers([handler]) before executing actions.`}),action_input_validation_failed:D({message:({domain:e,actionId:t,validationMessage:n})=>`Input validation failed for action "${t}" in domain "${e}":\n${n}`,httpStatusCode:400}),action_input_validation_promise:D({message:({domain:e,actionId:t})=>`Input validation for action "${t}" in domain "${e}" returned a promise, which is not supported.`,httpStatusCode:400}),action_output_validation_failed:D({message:({domain:e,actionId:t,validationMessage:n})=>`Output validation failed for action "${t}" in domain "${e}":\n${n}`,httpStatusCode:500}),action_output_validation_promise:D({message:({domain:e,actionId:t})=>`Output validation for action "${t}" in domain "${e}" returned a promise, which is not supported.`,httpStatusCode:500})}}),sl=e=>typeof e==`object`&&!!e&&typeof e.domain==`string`&&typeof e.id==`string`&&typeof e.form==`string`,cl=e=>sl(e)&&e.result!=null&&e.form===qc.data&&e.type===U.result,ll;(function(e){e[e.CONTINUE=100]=`CONTINUE`,e[e.SWITCHING_PROTOCOLS=101]=`SWITCHING_PROTOCOLS`,e[e.PROCESSING=102]=`PROCESSING`,e[e.EARLY_HINTS=103]=`EARLY_HINTS`,e[e.OK=200]=`OK`,e[e.CREATED=201]=`CREATED`,e[e.ACCEPTED=202]=`ACCEPTED`,e[e.NON_AUTHORITATIVE_INFORMATION=203]=`NON_AUTHORITATIVE_INFORMATION`,e[e.NO_CONTENT=204]=`NO_CONTENT`,e[e.RESET_CONTENT=205]=`RESET_CONTENT`,e[e.PARTIAL_CONTENT=206]=`PARTIAL_CONTENT`,e[e.MULTI_STATUS=207]=`MULTI_STATUS`,e[e.MULTIPLE_CHOICES=300]=`MULTIPLE_CHOICES`,e[e.MOVED_PERMANENTLY=301]=`MOVED_PERMANENTLY`,e[e.MOVED_TEMPORARILY=302]=`MOVED_TEMPORARILY`,e[e.SEE_OTHER=303]=`SEE_OTHER`,e[e.NOT_MODIFIED=304]=`NOT_MODIFIED`,e[e.USE_PROXY=305]=`USE_PROXY`,e[e.TEMPORARY_REDIRECT=307]=`TEMPORARY_REDIRECT`,e[e.PERMANENT_REDIRECT=308]=`PERMANENT_REDIRECT`,e[e.BAD_REQUEST=400]=`BAD_REQUEST`,e[e.UNAUTHORIZED=401]=`UNAUTHORIZED`,e[e.PAYMENT_REQUIRED=402]=`PAYMENT_REQUIRED`,e[e.FORBIDDEN=403]=`FORBIDDEN`,e[e.NOT_FOUND=404]=`NOT_FOUND`,e[e.METHOD_NOT_ALLOWED=405]=`METHOD_NOT_ALLOWED`,e[e.NOT_ACCEPTABLE=406]=`NOT_ACCEPTABLE`,e[e.PROXY_AUTHENTICATION_REQUIRED=407]=`PROXY_AUTHENTICATION_REQUIRED`,e[e.REQUEST_TIMEOUT=408]=`REQUEST_TIMEOUT`,e[e.CONFLICT=409]=`CONFLICT`,e[e.GONE=410]=`GONE`,e[e.LENGTH_REQUIRED=411]=`LENGTH_REQUIRED`,e[e.PRECONDITION_FAILED=412]=`PRECONDITION_FAILED`,e[e.REQUEST_TOO_LONG=413]=`REQUEST_TOO_LONG`,e[e.REQUEST_URI_TOO_LONG=414]=`REQUEST_URI_TOO_LONG`,e[e.UNSUPPORTED_MEDIA_TYPE=415]=`UNSUPPORTED_MEDIA_TYPE`,e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]=`REQUESTED_RANGE_NOT_SATISFIABLE`,e[e.EXPECTATION_FAILED=417]=`EXPECTATION_FAILED`,e[e.IM_A_TEAPOT=418]=`IM_A_TEAPOT`,e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]=`INSUFFICIENT_SPACE_ON_RESOURCE`,e[e.METHOD_FAILURE=420]=`METHOD_FAILURE`,e[e.MISDIRECTED_REQUEST=421]=`MISDIRECTED_REQUEST`,e[e.UNPROCESSABLE_ENTITY=422]=`UNPROCESSABLE_ENTITY`,e[e.LOCKED=423]=`LOCKED`,e[e.FAILED_DEPENDENCY=424]=`FAILED_DEPENDENCY`,e[e.UPGRADE_REQUIRED=426]=`UPGRADE_REQUIRED`,e[e.PRECONDITION_REQUIRED=428]=`PRECONDITION_REQUIRED`,e[e.TOO_MANY_REQUESTS=429]=`TOO_MANY_REQUESTS`,e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]=`REQUEST_HEADER_FIELDS_TOO_LARGE`,e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]=`UNAVAILABLE_FOR_LEGAL_REASONS`,e[e.INTERNAL_SERVER_ERROR=500]=`INTERNAL_SERVER_ERROR`,e[e.NOT_IMPLEMENTED=501]=`NOT_IMPLEMENTED`,e[e.BAD_GATEWAY=502]=`BAD_GATEWAY`,e[e.SERVICE_UNAVAILABLE=503]=`SERVICE_UNAVAILABLE`,e[e.GATEWAY_TIMEOUT=504]=`GATEWAY_TIMEOUT`,e[e.HTTP_VERSION_NOT_SUPPORTED=505]=`HTTP_VERSION_NOT_SUPPORTED`,e[e.INSUFFICIENT_STORAGE=507]=`INSUFFICIENT_STORAGE`,e[e.NETWORK_AUTHENTICATION_REQUIRED=511]=`NETWORK_AUTHENTICATION_REQUIRED`})(ll||={});function ul(e){let t=``;for(let n of e)typeof n==`object`?n.key!=null&&(typeof n.key==`number`?t+=`[${String(n.key)}]`:typeof n.key==`symbol`?t+=`[SYMBOL:${String(n.key)}]`:t+=`.${String(n.key)}`):t+=`.${String(n)}`;return t.slice(1)}var dl=e=>{let t=`Data validation failed:
|
|
19
|
+
`,n=0;for(let r of e.issues)n++,r.path==null||r.path.length===0?t+=` (issue ${n}) ${r.message}\n`:t+=` (issue ${n}) [${ul(r.path)}]: ${r.message}\n`;return t};fe.createChildDomain({domain:`err_validation`,defaultHttpStatusCode:ll.BAD_REQUEST,schema:{standard_schema:D({message:({issues:e})=>dl({issues:e})})}});var fl=function(e){return e.payload=`payload`,e.ack=`ack`,e.none=`none`,e}({}),pl=function(e){return e.none=`none`,e.session=`session`,e.persisted=`persisted`,e}({}),ml=class{_errorDeclarations=[];inputOptions;outputOptions;_responseMode;_reliabilityTier=`none`;get inputSchema(){return this.inputOptions?.schema}get outputSchema(){return this.outputOptions?.schema}get responseMode(){return this._responseMode==null?this.outputOptions==null?`ack`:`payload`:this._responseMode}ack(){return this._responseMode=`ack`,this}fireAndForget(){return this._responseMode=`none`,this}get reliabilityTier(){return this._reliabilityTier}reliable(e){return this._reliabilityTier=e?.persist===!0?`persisted`:`session`,this}input(e){return this.inputOptions=e,this}output(e){return this.outputOptions=e,this}throws(e,t){return this._errorDeclarations.push({_domain:e,_ids:t}),this}isExpectedError(e){return this._errorDeclarations.some(t=>t._domain.isExact(e)&&(t._ids==null||t._ids.some(t=>e.hasId(t))))}serializeInput(e){return this.inputOptions?.serialization?this.inputOptions.serialization.serialize(e):e}deserializeInput(e){return this.inputOptions?.serialization?this.inputOptions.serialization.deserialize(e):e}validateInput(e,t){if(this.inputOptions?.schema==null)return e;let n=this.inputOptions.schema[`~standard`].validate(e);if(n instanceof Promise)throw W.fromId(ol.action_input_validation_promise,{domain:t.domain,actionId:t.actionId});if(n.issues!=null)throw W.fromId(ol.action_input_validation_failed,{domain:t.domain,actionId:t.actionId,validationMessage:dl(n)});return n.value}validateOutput(e,t){if(this.outputOptions?.schema==null)return e;let n=this.outputOptions.schema[`~standard`].validate(e);if(n instanceof Promise)throw W.fromId(ol.action_output_validation_promise,{domain:t.domain,actionId:t.actionId});if(n.issues!=null)throw W.fromId(ol.action_output_validation_failed,{domain:t.domain,actionId:t.actionId,validationMessage:dl(n)});return n.value}serializeOutput(e){return this.outputOptions?.serialization?this.outputOptions.serialization.serialize(e):e}deserializeOutput(e){return this.outputOptions?.serialization?this.outputOptions.serialization.deserialize(e):e}},hl=()=>new ml,gl={},_l=globalThis.process||{env:gl},vl=_l!==void 0&&_l.env&&_l.env.NODE_ENV||void 0,yl=[[`claude`,[`CLAUDECODE`,`CLAUDE_CODE`]],[`replit`,[`REPL_ID`]],[`gemini`,[`GEMINI_CLI`]],[`codex`,[`CODEX_SANDBOX`,`CODEX_THREAD_ID`]],[`opencode`,[`OPENCODE`]],[`pi`,[bl(`PATH`,/\.pi[\\/]agent/)]],[`auggie`,[`AUGMENT_AGENT`]],[`goose`,[`GOOSE_PROVIDER`]],[`devin`,[bl(`EDITOR`,/devin/)]],[`cursor`,[`CURSOR_AGENT`]],[`kiro`,[bl(`TERM_PROGRAM`,/kiro/)]]];function bl(e,t){return()=>{let n=gl[e];return n?t.test(n):!1}}function xl(){let e=gl.AI_AGENT;if(e)return{name:e.toLowerCase()};for(let[e,t]of yl)for(let n of t)if(typeof n==`string`?gl[n]:n())return{name:e};return{}}var Sl=xl();Sl.name,Sl.name;var Cl=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CLOUDFLARE_WORKERS`,`WORKERS_CI`,{ci:!0}],[`GOOGLE_CLOUDRUN`,`K_SERVICE`],[`GOOGLE_CLOUDRUN_JOB`,`CLOUD_RUN_JOB`],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`JENKINS`,`JENKINS_URL`],[`HUDSON`,`HUDSON_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOY`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}],[`EDGEONE_PAGES`,`EO_PAGES_CI`,{ci:!0}]];function wl(){for(let e of Cl)if(gl[e[1]||e[0]])return{name:e[0].toLowerCase(),...e[2]};return gl.SHELL===`/bin/jsh`&&_l.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}var Tl=wl();Tl.name;var El=_l.platform||``;gl.CI||Tl.ci;var Dl=!!_l.stdout?.isTTY;gl.DEBUG,vl===`test`||gl.TEST,vl===`production`||gl.MODE,vl===`dev`||vl===`development`||gl.MODE,gl.MINIMAL;var Ol=/^win/i.test(El);/^linux/i.test(El),/^darwin/i.test(El),!gl.NO_COLOR&&(gl.FORCE_COLOR||(Dl||Ol)&&gl.TERM);var kl=(_l.versions?.node||``).replace(/^v/,``)||null;Number(kl?.split(`.`)[0]);var Al=!!_l?.versions?.node,jl=`Bun`in globalThis,Ml=`Deno`in globalThis,Nl=`fastly`in globalThis,Pl=`Netlify`in globalThis,Fl=`EdgeRuntime`in globalThis,Il=globalThis.navigator?.userAgent===`Cloudflare-Workers`,Ll=[[Pl,`netlify`],[Fl,`edge-light`],[Il,`workerd`],[Nl,`fastly`],[Ml,`deno`],[jl,`bun`],[Al,`node`]];function Rl(){let e=Ll.find(e=>e[0]);if(e)return{name:e[1]}}var zl=Rl()?.name||``,G=()=>({assumed:!0,runtimeName:zl}),Bl=e=>sl(e)&&`progress`in e&&e.form===qc.data&&e.type===U.progress,K=e=>sl(e)&&e.form===qc.data&&e.type===U.request;function q(e){return K(e)||cl(e)||Bl(e)}var J=function(e){return e.peer=`peer`,e.local=`local`,e}({}),Vl=[];function Hl(e){Vl.push(e)}function Ul(){Vl.pop()}function Wl(){return Vl[Vl.length-1]}var Gl=W.createChildDomain({domain:`err_nice_external_client`,schema:{}}),Y=function(e){return e.timeout=`timeout`,e.not_found=`not_found`,e.unsupported=`unsupported`,e.initialization_failed=`initialization_failed`,e.send_failed=`send_failed`,e.invalid_action_response=`invalid_action_response`,e.reliable_outbox_overflow=`reliable_outbox_overflow`,e.reliable_delivery_abandoned=`reliable_delivery_abandoned`,e.reliable_stream_closed=`reliable_stream_closed`,e}({}),Kl=Gl.createChildDomain({domain:`err_nice_transport`,schema:{timeout:D({message:({timeout:e})=>`ActionConnect transport timed out after ${e}ms.`}),not_found:D({message:({actionId:e})=>`No connected transport found for action "${e}".`}),unsupported:D({message:({transportShapes:e})=>`${e.length} Transport(s) [${e.join(`, `)}] found but returned "unsupported" status.`}),initialization_failed:D({message:({actionId:e,cause:t,endpoint:n})=>{let r=`Could not connect any transport for action "${e}"${n==null?``:` against ${n}`}`;return t==null?`${r} (all transports failed to initialize).`:`${r}: ${t}${t.endsWith(`.`)?``:`.`}`}}),send_failed:D({message:({actionId:e,httpStatusCode:t,message:n})=>`Failed to send action "${e}" [${t??`Unknown status`}]: ${n??`Unknown error`}.`,httpStatusCode:({httpStatusCode:e})=>e??500}),invalid_action_response:D({message:({actionId:e})=>`Invalid action response JSON structure for action "${e}"`}),reliable_outbox_overflow:D({message:({actionId:e,maxUnacked:t})=>`Reliable outbox for action "${e}" exceeded its unacked window (${t}) — the peer is not acknowledging. Send rejected to bound memory.`}),reliable_delivery_abandoned:D({message:({actionId:e,timeout:t})=>`Reliable action "${e}" was abandoned: not acknowledged within its ${t}ms delivery deadline (or swept with an aborted earlier frame on its stream). The stream skips past it and continues.`}),reliable_stream_closed:D({message:({actionId:e,streamId:t})=>`Reliable action "${e}" was abandoned because its stream ("${t}") was closed (closeReliableStream) while the send was still unacknowledged.`})}}),ql=class extends Cr{constructor(e){super(e,{unsupported:e=>Kl.fromId(Y.unsupported,{transportShapes:e}),notFound:e=>Kl.fromId(Y.not_found,{actionId:e.action==null?`connect()`:e.action.id}),initializationFailed:(e,t)=>Kl.fromId(Y.initialization_failed,{actionId:e.action==null?`connect()`:e.action.id,cause:t.cause,endpoint:t.endpoint,kind:t.kind}).withOriginError(t.origin)})}},Jl=class{_domains=new Map;addDomain(e){let t=this._domains.get(e.domain);if(t!==e){if(t!=null)throw W.fromId(ol.domain_name_collision,{domain:e.domain,existingParentDomains:t.allDomains,incomingParentDomains:e.allDomains});this._domains.set(e.domain,e)}}getDomains(){return[...this._domains.values()]}verifyIsActionJson(e){if(typeof e.domain!=`string`||typeof e.id!=`string`)throw W.fromId(ol.wire_not_action_data)}getActionDomain(e){this.verifyIsActionJson(e);let t=this._domains.get(e.domain);if(t)return t}getActionDomainOrThrow(e){this.verifyIsActionJson(e);let t=this._domains.get(e.domain);if(!t)throw W.fromId(ol.domain_no_handler,{domain:e.domain});return t}hydrateActionPayload(e){return this.getActionDomainOrThrow(e).hydrateAnyAction(e)}},Yl=function(e){return e.runtime_to_handler=`runtime_to_handler`,e.handler_route=`handler_route`,e}({}),Xl=class{domainManager=new Jl;actionRouteData=new Map;_context;constructor(e){this._context=e}mergeRouter(e){for(let t of e.getDomains())this.domainManager.addDomain(t);for(let[t,n]of e.actionRouteData.entries())this.actionRouteData.set(t,[...n])}addDomainsFromOther(e){for(let t of e.getDomains())this.domainManager.addDomain(t)}getRouteDataEntriesForAction(e){let t=`dom[${e.domain}]id[${e.id}]`,n=`dom[${e.domain}]id[_]`;return[...this.actionRouteData.get(t)??[],...this.actionRouteData.get(n)??[]]}getRouteDataForAction(e){return this.getRouteDataEntriesForAction(e)[0]}throwNoHandlerForAction(e,t){throw this._context.contextType===Yl.handler_route?W.fromId(ol.no_action_execution_handler,{domain:e.domain,actionId:e.id,specifiedClient:t.targetLocalRuntime?.coordinate}):this._context.contextType===Yl.runtime_to_handler?W.fromId(ol.no_action_execution_handler,{domain:e.domain,actionId:e.id,specifiedClient:this._context.runtime.coordinate}):W.fromId(ol.no_action_execution_handler,{domain:e.domain,actionId:e.id})}getRouteDataEntriesForActionOrThrow(e,t){let n=this.getRouteDataEntriesForAction(e);return n.length===0&&this.throwNoHandlerForAction(e,t),n}getRouteDataForActionOrThrow(e,t){let n=this.getRouteDataForAction(e);return n||this.throwNoHandlerForAction(e,t),n}getForKey(e){return this.actionRouteData.get(e)??[]}getRegisteredKeys(){return[...this.actionRouteData.keys()]}getDomains(){return this.domainManager.getDomains()}forDomain(e,t){return this.domainManager.addDomain(e),this.actionRouteData.set(`dom[${e.domain}]id[_]`,[t]),this}forAction(e,t){return this.forActionId(e._domain,e.id,t)}forActionId(e,t,n){return this.domainManager.addDomain(e),this.actionRouteData.set(`dom[${e.domain}]id[${t}]`,[n]),this}forActionIds(e,t,n){this.domainManager.addDomain(e);for(let r of t)this.forActionId(e,r,n);return this}forDomainActionCases(e,t){this.domainManager.addDomain(e);for(let n of Object.keys(t)){let r=t[n];r!=null&&this.actionRouteData.set(`dom[${e.domain}]id[${n}]`,[r])}return this}addForDomain(e,t){return this.domainManager.addDomain(e),this._push(`dom[${e.domain}]id[_]`,t),this}addForAction(e,t,n){return this.domainManager.addDomain(e),this._push(`dom[${e.domain}]id[${t}]`,n),this}addForActionIds(e,t,n){this.domainManager.addDomain(e);for(let r of t)this.addForAction(e,r,n);return this}addForDomainActionCases(e,t){this.domainManager.addDomain(e);for(let n of Object.keys(t)){let r=t[n];r!=null&&this._push(`dom[${e.domain}]id[${n}]`,r)}return this}addForKey(e,t){return this._push(e,t),this}_push(e,t){let n=this.actionRouteData.get(e);n==null?this.actionRouteData.set(e,[t]):n.push(t)}},Zl=class{cuid;constructor(){this.cuid=Fa()}getActionRouter(){return this.actionRouter}},Ql=class extends Zl{peerClient;handlerType=J.peer;actionRouter=new Xl({contextType:Yl.handler_route,handler:this});_incomingActionDataListeners=[];constructor(e){super(),this.peerClient=e}forDomain(e){return this.actionRouter.forDomain(e,!0),this}forAction(e){return this.actionRouter.forAction(e,!0),this}forActionIds(e,t){return this.actionRouter.forActionIds(e,t,!0),this}_setIncomingActionDataListener(e){this._incomingActionDataListeners.push(e)}_emitIncoming(e){for(let t of this._incomingActionDataListeners)t(e)}ownsLiveConnectionFor(e){return!1}clearTransportCache(){}},$l=1024,eu=class{_streams=new Map;_overflowed=new Set;_maxUnacked;_onOverflow;constructor(e){this._maxUnacked=e?.maxUnackedPerStream??$l,this._onOverflow=e?.onOverflow}get maxUnackedPerStream(){return this._maxUnacked}_stream(e){let t=this._streams.get(e);return t??(t={nextSeq:0,ackedSeq:-1,unacked:new Map},this._streams.set(e,t)),t}prepare(e,t,n,r){let i=this._stream(e);if(i.unacked.size>=this._maxUnacked)return this._overflowed.has(e)||(this._overflowed.add(e),this._onOverflow?.(e)),null;let a=i.nextSeq++,o=n==null?{streamId:e,seq:a}:{streamId:e,seq:a,streamKey:n};return i.unacked.set(a,{seq:a,preparedAt:Date.now(),reliability:o,dispatch:t,onDrop:r?.onDrop,onAck:r?.onAck}),{reliability:o}}ack(e,t){let n=this._streams.get(e);if(n==null||t<=n.ackedSeq)return[];n.ackedSeq=t;let r=[];for(let e of n.unacked.values())e.seq<=t&&r.push(e);for(let e of r)n.unacked.delete(e.seq);n.unacked.size<this._maxUnacked&&this._overflowed.delete(e);for(let e of r)e.onAck?.();return r}dropThrough(e,t,n){let r=this._streams.get(e);if(r==null)return[];let i=[];for(let e of r.unacked.values())e.seq<=t&&i.push(e);for(let e of i)r.unacked.delete(e.seq);t>r.ackedSeq&&(r.ackedSeq=t),r.unacked.size<this._maxUnacked&&this._overflowed.delete(e);for(let e of i)e.onDrop?.(n);return i}pending(e){return[...this._streams.get(e)?.unacked.values()??[]]}pendingCount(e){return this._streams.get(e)?.unacked.size??0}oldestPreparedAt(e){let t=this._streams.get(e);if(t!=null)for(let e of t.unacked.values())return e.preparedAt}highestSeq(e){let t=this._streams.get(e);if(!(t==null||t.nextSeq===0))return t.nextSeq-1}allPending(){let e=[];for(let t of this._streams.values())e.push(...t.unacked.values());return e}resendAll(){for(let e of this.allPending())e.dispatch()}resync(e){let t=this._streams.get(e);if(t==null||t.unacked.size===0)return;let n=[...t.unacked.values()],r=new Map;n.forEach((e,t)=>{e.seq=t,e.reliability.seq=t,r.set(t,e)}),t.unacked=r,t.ackedSeq=-1,t.nextSeq=n.length;for(let e of r.values())e.dispatch()}get size(){let e=0;for(let t of this._streams.values())e+=t.unacked.size;return e}},tu=6e4,nu=1e3,ru=class extends Ql{_connectionIdentity;_defaultTimeout;_reliableTimeout;_wire;get canPush(){return this._wire.canPush}get localCoordinate(){return this._wire.localCoordinate}get securityLevel(){return this._wire.securityLevel}get wireMux(){return this._wire.wireMux}get requestReconnect(){return this._wire.requestReconnect}get debug(){return this._wire.debug}_outbox=new eu;_resendHooked=new WeakSet;_deliveryDeadlines=new WeakMap;_streamSkips=new Map;_streamCloses=new Map;_controlMethods;_reliableEventListeners=new Set;constructor({runtimeCoordinate:e,transports:t,defaultTimeout:n,reliableActionTimeout:r,wireMux:i,localCoordinate:a,connectionIdentity:o,securityLevel:s,keepLinkAlive:c}){super(e),this._connectionIdentity=o,this._defaultTimeout=n??1e4,this._reliableTimeout=r??tu,this._wire=new so({createManager:e=>new ql(e),mux:i,peer:this.peerClient,localCoordinate:o??a,securityLevel:s,canPush:t.some(e=>e.type===xr.duplex),keepLinkAlive:c,buildConnectInput:e=>e,defaultLocalCoordinate:()=>iu.getDefault().coordinate});for(let e of t){let t=e._createConnection({resolvers:{onIncomingActionDataJson:(e,t)=>{t?.ack!=null&&this._applyAck(Lc(this.peerClient,e.domain,e.id,t.streamKey),t.ack),this._emitIncoming(e)},onControlMessage:e=>{let t=Lc(this.peerClient,e.domain,e.id,e.k);e.$c===`rack`?this._applyAck(t,e.ack):e.$c===`rsync`&&(this._streamSkips.delete(t),this._outbox.resync(t))}}});t.definition=e,this._wire.addTransport(t)}}async connect(e){await this._wire.connect({localCoordinate:this._connectionIdentity??e?.targetLocalRuntime?.coordinate})}reconnectLink(){return this._wire.reconnectLink()}dispose(){this._wire.dispose()}async handleActionRequest(e,t){let n=t?.targetLocalRuntime??iu.getDefault(),r=this._connectionIdentity??n.coordinate;this._connectionIdentity!=null&&e.context._setOriginClient(this._connectionIdentity);let i=t?.timeout??this._defaultTimeout,a=Wl(),o=e._callSite??Error().stack,s={action:e,localClient:r,externalClient:this.peerClient},c=this._wire.getPreferredTransport(),l=c==null?void 0:{runtime:r,handler:this.toHandlerRouteItem(c,s),time:Date.now()};l!=null&&e.context.addRouteItem(l);let u=new al({context:e.context,request:e,parentCuid:a,callSite:o});if(n.registerRunningAction(u),e.schema.reliabilityTier!==pl.none){let n=t?.streamKey,r=Lc(this.peerClient,e.domain,e.id,n),a=this._outbox.prepare(r,()=>{u.isAborted||this._dispatchWhenTransportReady(u,s,l,i)},n,{onDrop:e=>{u._notifyAckAbandoned(e),u._abort(e)},onAck:()=>u._notifyAcked()});if(a==null)return this._emitReliableEvent(n==null?{type:`overflow`,domain:e.domain,actionId:e.id}:{type:`overflow`,domain:e.domain,actionId:e.id,streamKey:n}),u._abort(Kl.fromId(Y.reliable_outbox_overflow,{actionId:e.id,streamId:r,maxUnacked:this._outbox.maxUnackedPerStream})),u;s.reliability=a.reliability,u._setReliability({tier:e.schema.reliabilityTier,seq:a.reliability.seq,streamKey:n}),this._armDeliveryDeadline(r,a.reliability,u);let o=u.addUpdateListeners([t=>{t.type===rl.finished&&(o(),u.isAborted&&this._abandonReliableThrough(r,a.reliability,e.domain,e.id,n))}])}return this._dispatchWhenTransportReady(u,s,l,i),u}async _dispatchWhenTransportReady(e,t,n,r){let i=t.action;try{let{methods:a,transport:o}=await this._wire.getReadyTransport(t);a.addOnDisconnectListener!=null&&!this._resendHooked.has(a)&&(this._resendHooked.add(a),a.addOnDisconnectListener(()=>{this._outbox.size>0&&setTimeout(()=>this._outbox.resendAll(),0)}),a.sendControlData!=null&&(this._controlMethods=a),this._outbox.size>0&&setTimeout(()=>this._outbox.resendAll(),0));let s=this.toHandlerRouteItem(o,t);n==null?i.context.addRouteItem({runtime:t.localClient,handler:s,time:Date.now()}):(n.handler=s,n.time=Date.now());let c={...t,runningAction:e,timeout:r};i.type===U.request&&a.updateRunConfig!=null&&(c.timeout=a.updateRunConfig(c)?.timeout??r),a.sendActionData(c),this._streamSkips.size>0&&this._flushStreamSkips(),i.type===U.request&&i.schema.responseMode===fl.none&&e._completeWithResult(i.successResult(void 0))}catch(a){if(i.type===U.request&&t.reliability!=null){e.isAborted||setTimeout(()=>{e.isAborted||this._dispatchWhenTransportReady(e,t,n,r)},nu);return}e._abort(a)}}_applyAck(e,t){for(let n of this._outbox.ack(e,t)){let e=this._deliveryDeadlines.get(n.reliability);e!=null&&(clearTimeout(e),this._deliveryDeadlines.delete(n.reliability))}let n=this._streamSkips.get(e);n!=null&&t>=n.seq&&this._streamSkips.delete(e)}_armDeliveryDeadline(e,t,n){let r=setTimeout(()=>{if(!n._abort(Kl.fromId(Y.reliable_delivery_abandoned,{actionId:n.state.request.id,streamId:e,timeout:this._reliableTimeout}))){let r=n.state.request;Gc(r.domain,r.id),this._abandonReliableThrough(e,t,r.domain,r.id,t.streamKey)}},this._reliableTimeout);this._deliveryDeadlines.set(t,r)}_abandonReliableThrough(e,t,n,r,i,a){let o=t.seq;if(o==null)return;let s=a??Kl.fromId(Y.reliable_delivery_abandoned,{actionId:r,streamId:e,timeout:this._reliableTimeout}),c=this._outbox.dropThrough(e,o,s);for(let e of c){let t=this._deliveryDeadlines.get(e.reliability);t!=null&&(clearTimeout(t),this._deliveryDeadlines.delete(e.reliability))}if(c.length>0&&this._emitReliableEvent({type:`abandoned`,domain:n,actionId:r,...i==null?{}:{streamKey:i},fromSeq:c[0].seq,toSeq:o,reason:s}),c.length===0&&(this._streamSkips.get(e)?.seq??-1)>=o)return;let l=this._streamSkips.get(e);(l==null||o>l.seq)&&this._streamSkips.set(e,i==null?{$c:`rskip`,domain:n,id:r,seq:o}:{$c:`rskip`,domain:n,id:r,seq:o,k:i}),this._flushStreamSkips()}_flushStreamSkips(){let e=this._controlMethods;if(e?.sendControlData!=null){for(let t of this._streamSkips.values())e.sendControlData(t);for(let[t,n]of this._streamCloses)e.sendControlData(n),this._streamCloses.delete(t)}}addReliableEventListener(e){return this._reliableEventListeners.add(e),()=>{this._reliableEventListeners.delete(e)}}_emitReliableEvent(e){for(let t of this._reliableEventListeners)try{t(e)}catch(e){console.error(`[reliable] onReliableEvent listener threw`,e)}}addLinkEventListener(e){return this._wire.addLinkEventListener(e)}closeReliableStream(e,t){let n=Lc(this.peerClient,e.domain,e.id,t),r=this._outbox.highestSeq(n);if(r==null)return;let i=Kl.fromId(Y.reliable_stream_closed,{actionId:e.id,streamId:n});this._abandonReliableThrough(n,{streamId:n,seq:r,streamKey:t},e.domain,e.id,t,i),this._streamCloses.set(n,t==null?{$c:`rclose`,domain:e.domain,id:e.id}:{$c:`rclose`,domain:e.domain,id:e.id,k:t}),this._flushStreamSkips()}reliablePending(e,t){if(e==null)return this._outbox.size;let n=Lc(this.peerClient,e.domain,e.id,t),r=this._outbox.oldestPreparedAt(n);return{unackedCount:this._outbox.pendingCount(n),oldestUnackedAgeMs:r==null?void 0:Date.now()-r,maxUnackedPerStream:this._outbox.maxUnackedPerStream}}async sendReturnPayload(e,t){let n=this._connectionIdentity??t.targetLocalRuntime.coordinate;try{let{methods:t}=await this._wire.getReadyTransport({action:e,localClient:n,externalClient:this.peerClient});return t.sendReturnData==null?!1:(t.sendReturnData(e,{localClient:n,externalClient:this.peerClient}),!0)}catch{return!1}}toJsonObject(){return{type:this.handlerType,client:this.peerClient}}toHandlerRouteItem(e,t){return{type:this.handlerType,client:this.peerClient,transOrd:e.transOrd,transShape:e.type,transInfo:e.getRouteInfo(t)}}releaseLink(){this._wire.releaseLink()}clearTransportCache(){this._wire.clearTransportCache()}},iu=class{_coordinate;timeCreated;runtimeInfo=G();actionRouter;_pendingRunningActions=new Map;_registeredPeerHandlers=[];_applied=!1;static getDefault(){return ou()}constructor(e){this._coordinate=e.specifyIfUnset({insId:Fa(14)}),this.timeCreated=Date.now(),this.actionRouter=new Xl({contextType:Yl.runtime_to_handler,runtime:this})}get coordinate(){return this._coordinate}specifyRuntimeCoordinate(e){if(e.envId!=null&&this._coordinate.envId!==e.envId)throw W.fromId(ol.not_implemented,{label:`updating RuntimeCoordinate with a different "envId" ("${this._coordinate.envId}" → "${e.envId}")`});this._coordinate=this._coordinate.specify(e),this.apply()}registerRunningAction(e){this._pendingRunningActions.set(e.cuid,e),e.addUpdateListeners([t=>{t.type===rl.finished&&this._pendingRunningActions.delete(e.cuid)}])}resolveIncomingActionPayload(e){if(e.type===U.request){this.handleActionPayloadWire(e).catch(t=>{console.error(`[ActionRuntime] Incoming action [${e.domain}:${e.id}:${e.form}:${e.type}] unhandled:`,t)});return}this._pendingRunningActions.get(e.context.cuid)?._resolveFromJson(e)}async handleActionPayloadWire(e){let t;if(q(e)&&(t=this.actionRouter.domainManager.getActionDomainOrThrow(e).hydrateAnyAction(e)),t==null)throw W.fromId(ol.wire_not_action_data);return this.handleActionPayload(t)}responseModeForWire(e){try{return this.actionRouter.domainManager.getActionDomainOrThrow(e).actionSchema[e.id]?.responseMode}catch{return}}reliabilityTierForWire(e){return this.reliabilityTierForRoute(e.domain,e.id)}reliabilityTierForRoute(e,t){try{return this.actionRouter.domainManager.getActionDomainOrThrow({domain:e,id:t}).actionSchema[t]?.reliabilityTier}catch{return}}async handleActionPayload(e,t){if(e.type===U.request){let n=e.context._domain._collectActionObservers(),r;try{r=this.getHandlerForActionOrThrow(e,t)}catch(t){let r=new al({context:e.context,request:e});return r.addUpdateListeners(n),r._completeWithResult(e.errorResult(ye(t))),r}let i;try{i=new tl({context:e.context},e.context.validateInput(e.input),{time:e.time}),i._callSite=e._callSite}catch(t){let r=new al({context:e.context,request:e});return r.addUpdateListeners(n),r._completeWithResult(e.errorResult(ye(t))),this._trySetupReturnDispatch(r),r}let a=await r.handleActionRequest(i,{...t,targetLocalRuntime:this});return a.addUpdateListeners(n),this._trySetupReturnDispatch(a),a}throw W.fromId(ol.not_implemented,{label:`Handling incoming action payloads of type "${e.type}"`})}_getHandlerForAction(e,t){let n=this.actionRouter.getRouteDataEntriesForAction(e),r=t?.targetPeer,i=n.filter(t=>t.handlerType===J.peer?!(r&&!r.isSameFor(t.peerClient).id):r==null?e.type===U.request:!1);if(i.length===0)return;let a=r??Ra.unknown,o=-1,s;for(let e of i){if(e.handlerType===J.local)return e;if(e.handlerType===J.peer){let t=a.similarityLevel(e.peerClient);t>o&&(o=t,s=e)}}return s}getHandlerForActionOrThrow(e,t){let n=this._getHandlerForAction(e,t);if(n==null)throw W.fromId(ol.no_action_execution_handler,{actionId:e.id,domain:e.domain,specifiedClient:t?.targetPeer});return n}addHandlers(e){for(let t of e){t.handlerType===J.peer&&(t._setIncomingActionDataListener(e=>this.resolveIncomingActionPayload(e)),this._registeredPeerHandlers.push(t));let e=t.getActionRouter();this.actionRouter.addDomainsFromOther(e),this._applied&&this.apply();for(let n of e.getRegisteredKeys())this.actionRouter.getForKey(n).some(e=>e.cuid===t.cuid)||this.actionRouter.addForKey(n,t)}return this}connectTo(e,t){let n=new ru({runtimeCoordinate:e,transports:t.transports,defaultTimeout:t.defaultTimeout,reliableActionTimeout:t.reliableActionTimeout,wireMux:t.wireMux,localCoordinate:this.coordinate,connectionIdentity:t.connectionIdentity,securityLevel:t.securityLevel,keepLinkAlive:t.keepLinkAlive});for(let e of t.domains??[])n.forDomain(e);for(let e of t.actions??[])n.forAction(e);return this.addHandlers([n,...t.localHandlers??[]]),this.apply(),n}applyRuntimeForDomain(e){let t=e.rootDomain;t._hasRuntime(this)||t._registerRuntime(this)}apply(){this._applied=!0;for(let e of this.actionRouter.getDomains())this.applyRuntimeForDomain(e);return this}getReturnHandlerForOrigin(e){if(e.envId===`_unset_`)return;let t=-1,n,r=-1,i;for(let a of this._registeredPeerHandlers){if(!a.canPush)continue;let o=e.similarityLevel(a.peerClient);o>t&&(t=o,n=a),a.ownsLiveConnectionFor(e)&&o>r&&(r=o,i=a)}return i??(t>0?n:void 0)}resetRuntime(){for(let e of this._pendingRunningActions.values())e._abort(W.fromId(ol.runtime_reset));for(let e of this._registeredPeerHandlers)e.clearTransportCache()}_trySetupReturnDispatch(e){if(e.context.schema.responseMode===fl.none)return;let t=e.context.originClient;t.envId===`_unset_`||t.isSameFor(this._coordinate).id||e.addUpdateListeners([e=>{e.type===rl.finished&&e.finishType===il.success&&this.getReturnHandlerForOrigin(t)?.sendReturnPayload(e.response,{targetLocalRuntime:this}).catch(()=>{})}])}},au={defaultLocalRuntime:void 0,assumedRuntimeInfo:void 0};function ou(){return au.assumedRuntimeInfo??=G(),au.defaultLocalRuntime??=new iu(Ra.unknown.specify({perId:`${au.assumedRuntimeInfo?.runtimeName??`unknown`}-runtime`})),au.defaultLocalRuntime}var su=class extends Zl{handlerType=J.local;actionRouter=new Xl({contextType:Yl.handler_route,handler:this});constructor(){super()}forDomain(e,t){return this.actionRouter.forDomain(e,t),this}forAction(e,t){return this.actionRouter.forAction(e,t),this}forActionIds(e,t,n){return this.actionRouter.forActionIds(e,t,n),this}forDomainActionCases(e,t){return this.actionRouter.forDomainActionCases(e,t),this}async handleActionRequest(e,t){let n=t?.targetLocalRuntime??iu.getDefault(),r=this.actionRouter.getRouteDataForActionOrThrow(e,{targetLocalRuntime:n});e.context.addRouteItem({runtime:n.coordinate,handler:this.toHandlerRouteItem(),time:Date.now()});let i=new al({context:e.context,request:e,parentCuid:Wl(),callSite:e._callSite??Error().stack});return this._handleRunningAction(r,i),i}async _handleRunningAction(e,t){let n=t.state;if(n.result==null){await Promise.resolve(),Hl(t.cuid);try{let r=await be(async()=>{let t=await e(n.request);return t instanceof el?t:t!=null&&cl(t)?this.actionRouter.domainManager.getActionDomainOrThrow(n.request).hydrateResultPayload(t):n.request.successResult(t)}),i=r.ok?r.output:n.request.errorResult(r.error);t._completeWithResult(i)}finally{Ul()}}}async handlePayloadWireOrThrow(e,t){let n=this.actionRouter.domainManager.hydrateActionPayload(e);if(!(n instanceof tl))throw W.fromId(ol.wire_action_not_payload,{domain:n.domain,actionId:n.id,actionState:n.type??n.form});return await this.handleActionRequest(n,t)}toJsonObject(){return{type:this.handlerType}}toHandlerRouteItem(){return{type:this.handlerType}}},cu=e=>sl(e)&&e.form===qc.context,lu=e=>sl(e)&&e.form===qc.core;function uu(e){return q(e)||cu(e)||lu(e)}function du(e){if(!uu(e))throw W.fromId(ol.wire_not_action_data)}function fu(e){return e instanceof nl||e instanceof Yc||e instanceof Jc}var pu=class{domain;allDomains;actionSchema;_listeners=[];constructor(e){this.domain=e.domain,this.allDomains=e.allDomains,this.actionSchema=e.actionSchema}addActionListener(e){return this._listeners.push(e),()=>{this._listeners=this._listeners.filter(t=>t!==e)}}_getActionObservers(){return this._listeners}},mu=class{_runtimes=new Map;_preferredRuntimeClientId=null;_context;constructor(e){this._context=e??{}}registerRuntime(e){let t=e.coordinate.stringId;if(this._runtimes.has(t))throw W.fromId(ol.client_runtime_already_registered,{context:this._context,client:e.coordinate});for(let t of e.coordinate.toStringIds())this._runtimes.has(t)||this._runtimes.set(t,e)}getRuntimeAndHandlerForAction(e,t,n){let r=t?.targetLocalRuntime;if(r!=null){let i=n?this.getBestRuntimeOrThrow(t?.targetLocalRuntime?.coordinate):this.getBestRuntime(t?.targetLocalRuntime?.coordinate);if(i==null)return;let a=i._getHandlerForAction(e,t);if(a!=null)return{handler:a,runtime:i};if(n)throw W.fromId(ol.no_action_execution_handler,{domain:e.domain,actionId:e.id,specifiedClient:r.coordinate})}for(let t of this._runtimes.values()){let n=t._getHandlerForAction(e);if(n)return{handler:n,runtime:t}}if(n)throw W.fromId(ol.no_action_execution_handler,{domain:e.domain,actionId:e.id,specifiedClient:t?.targetLocalRuntime?.coordinate})}getRuntimeAndHandlerForActionOrThrow(e,t){return this.getRuntimeAndHandlerForAction(e,t,!0)}setPreferredRuntime(e){let t=e.coordinate.stringId;this._preferredRuntimeClientId=t}getPreferredRuntime(){if(this._preferredRuntimeClientId){let e=this._runtimes.get(this._preferredRuntimeClientId);if(e)return e}return this._runtimes.values().next().value}getBestRuntimeForSpecifier(e){let t=new Ra(e).toStringIds();for(let e of t){let t=this._runtimes.get(e);if(t)return t}}getBestRuntime(e){return e==null?this.getPreferredRuntime():this.getBestRuntimeForSpecifier(e)}hasRuntime(e){return this._runtimes.has(e.coordinate.stringId)}getBestRuntimeOrThrow(e){let t=this.getBestRuntime(e);if(!t)throw e==null?W.fromId(ol.no_client_runtimes_registered,{context:this._context}):W.fromId(ol.client_runtime_not_registered,{context:this._context,clientStringId:La(e)[0]});return t}},hu=class extends pu{domainDefinition;_actionRuntimeManager;constructor(e){let t=e.domain;super({domain:t,allDomains:[t],actionSchema:{}}),this.domainDefinition=e,this._actionRuntimeManager=new mu({domain:t})}createChildDomain(e){if(this.allDomains.includes(e.domain))throw W.fromId(ol.domain_already_exists_in_hierarchy,{domain:e.domain,allParentDomains:this.allDomains,parentDomain:this.domain});return new gu({allDomains:[...this.allDomains,e.domain],domain:e.domain,actionSchema:e.actions},{rootDomain:this})}_registerRuntime(e){this._actionRuntimeManager.registerRuntime(e)}_hasRuntime(e){return this._actionRuntimeManager.hasRuntime(e)}getRuntime(e){return this._actionRuntimeManager.getBestRuntimeForSpecifier(e)}async _runAction(e,t){let n=[...this._listeners,...t?.listeners??[]],r;try{r=this._actionRuntimeManager.getRuntimeAndHandlerForActionOrThrow(e,t)}catch(t){let r=new al({context:e.context,request:e,callSite:e._callSite});throw r.addUpdateListeners(n),r._failWithError(t),t}let{handler:i,runtime:a}=r;e.context._setOriginClient(a.coordinate);let o=await i.handleActionRequest(e,{targetLocalRuntime:a,streamKey:t?.streamKey});return o.addUpdateListeners(n),o}},gu=class e extends pu{_rootDomain;_actionMap;constructor(e,{rootDomain:t}){super(e),this._rootDomain=t,this._actionMap=this.createActionMap()}get rootDomain(){return this._rootDomain}_collectActionObservers(){return[...this._rootDomain._getActionObservers(),...this._getActionObservers()]}_registerRuntime(e){this._rootDomain._registerRuntime(e)}createChildDomain(t){if(this.allDomains.includes(t.domain))throw W.fromId(ol.domain_already_exists_in_hierarchy,{domain:t.domain,allParentDomains:this.allDomains,parentDomain:this.domain});return new e({allDomains:[...this.allDomains,t.domain],domain:t.domain,actionSchema:t.actions},{rootDomain:this._rootDomain})}get action(){return this._actionMap}actionsMap(){return this._actionMap}actionForId(e){if(!this.actionSchema[e])throw W.fromId(ol.action_id_not_in_domain,{domain:this.domain,actionId:e});return new nl(this,e)}wrapAsPartialLocalHandler(e){let t=new su,n=e;for(let r in e)this.actionSchema[r]&&t.forAction(this.actionForId(r),e=>n[e.id](e.input));return t}wrapAsLocalHandler(e){let t=new su,n=e;return t.forDomain(this,e=>n[e.id](e.input))}hydrateContext(e,t){return new Jc(this,e,{timeCreated:t.timeCreated,cuid:t.cuid,routing:t.routing.map(e=>({runtime:new Ra(e.runtime),handler:e.handler,time:e.time})),originClient:t.originClient?new Ra(t.originClient):Ra.unknown,reliability:t.reliability})}isDomainAction(e){return fu(e)&&e.domain===this.domain}hydrateRequestPayload(e){if(e.type!==U.request)throw W.fromId(ol.hydration_action_state_mismatch,{expected:U.request,received:e.type});if(e.domain!==this.domain)throw W.fromId(ol.hydration_domain_mismatch,{expected:this.domain,received:e.domain});let t=e.id;if(!this.actionSchema[t])throw W.fromId(ol.hydration_action_id_not_found,{domain:this.domain,actionId:e.id});let n=this.hydrateContext(t,e.context);return new tl({context:n},n.deserializeInput(e.input),{time:e.time})}hydrateResultPayload(e){if(e.type!==U.result)throw W.fromId(ol.hydration_action_state_mismatch,{expected:U.result,received:e.type});if(e.domain!==this.domain)throw W.fromId(ol.hydration_domain_mismatch,{expected:this.domain,received:e.domain});let t=e.id;if(!this.actionSchema[t])throw W.fromId(ol.hydration_action_id_not_found,{domain:this.domain,actionId:e.id});let n=this.hydrateContext(t,e.context),r=e.result.ok?{ok:!0,output:n.schema.deserializeOutput(e.result.output)}:{ok:!1,error:ye(e.result.error)};return new el({context:n},r,{time:e.time})}hydrateAnyAction(e){if(du(e),e.form===qc.data){if(e.type===U.request)return this.hydrateRequestPayload(e);if(e.type===U.result)return this.hydrateResultPayload(e)}return this.actionForId(e.id)}async runAction(e,t){let n=[...t?.listeners??[],...this._listeners];return this._rootDomain._runAction(e,{...t,listeners:n})}createActionMap(){let e={};for(let t in this.actionSchema)e[t]=new nl(this,t);return e}},_u=e=>new hu(e);function vu(e,t){let n=t?.incoming?.(e)??(typeof e==`string`?yu(e):void 0);return n!=null&&q(n)?n:void 0}function yu(e){try{let t=JSON.parse(e);return q(t)?t:void 0}catch{return}}Ha.none,Ha.authenticated,Ha.encrypted;function bu(e){return`shape`in e&&e.shape===`exchange`}function xu(e,t){return e==null?void 0:(t===U.request?e.seq:e.ack)??void 0}function Su(e,t){let n=t===U.request?0:-1;if(!(typeof e!=`number`||!Number.isInteger(e)||e<n))return t===U.request?{seq:e}:{ack:e}}var Cu={[U.request]:0,[U.result]:1,[U.progress]:2},wu=[U.request,U.result,U.progress];function Tu(e){let t=new Map,n=[];for(let r of e)for(let e of Object.keys(r.actionSchema)){let i=`${r.domain}:${e}`;t.has(i)||(t.set(i,n.length),n.push({domain:r.domain,id:e,allDomains:r.allDomains}))}return{routeToInt:t,intToRoute:n}}function Eu(e){if(e.type===U.request)return e.input;if(e.type===U.result)return e.result;if(e.type===U.progress)return e.progress}function Du(e,t,n,r,i){let a={form:qc.data,domain:e.domain,id:e.id,allDomains:e.allDomains,time:n,context:r};return t===U.request?{...a,type:U.request,input:i,inputHash:``}:t===U.result?{...a,type:U.result,result:i,outputHash:``}:{...a,type:U.progress,progress:i}}var Ou={route:0,type:1,corr:2,time:3,originClient:4,payload:5,reliability:6,streamKey:7},ku=6,Au=7,ju=8,Mu=5*6e4;function Nu(e){return e!=null&&e.envId!==`_unset_`}function Pu(e,t,n){for(let[r,i]of e){if(t-i.time<=n)break;e.delete(r)}}function Fu(e,t){let{routeToInt:n,intToRoute:r}=Tu(e),i=Ra.unknown.toJsonObject(),a=t?.correlationTtlMs??Mu;return()=>{let e=0,t=new Map,o=new Map,s,c;return{outgoing:r=>{let i=r.action.toJsonObject(),c=`${i.domain}:${i.id}`,l=n.get(c);if(l==null)throw Error(`[binary-wire] Cannot pack unregistered action route: ${c}`);let u=Date.now();Pu(t,u,a),Pu(o,u,a);let d,f;i.type===U.request?(d=e++,t.set(d,{value:i.context.cuid,time:u}),s==null&&Nu(i.context.originClient)&&(s=i.context.originClient,f=i.context.originClient)):(d=o.get(i.context.cuid)?.value??-1,i.type===U.result&&o.delete(i.context.cuid));let p=xu(r.reliability,i.type),m=r.reliability?.streamKey,h=Array(m==null?p==null?ku:Au:ju);return h[Ou.route]=l,h[Ou.type]=Cu[i.type],h[Ou.corr]=d,h[Ou.time]=i.time,h[Ou.originClient]=f,h[Ou.payload]=Eu(i),p!=null&&(h[Ou.reliability]=p),m!=null&&(h[Ou.streamKey]=m),Es(h)},incoming:e=>{let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else if(e instanceof Uint8Array)n=e;else return;try{let e=ns(n);if(!Iu(e))return;let l=r[e[Ou.route]],u=wu[e[Ou.type]];if(l==null||u==null)return;let d=Date.now();Pu(t,d,a),Pu(o,d,a);let f=e[Ou.corr],p=e[Ou.time],m=e[Ou.originClient],h,g;return u===U.request?(h=Fa(),o.set(h,{value:f,time:d}),Nu(m)&&(c=m),g=c??i):(h=t.get(f)?.value??Fa(),u===U.result&&t.delete(f),g=s??i),Du(l,u,p,{cuid:h,timeCreated:p,routing:[],originClient:g},e[Ou.payload])}catch(e){console.error(`[binary-wire] Failed to unpack binary action session frame`,e);return}},incomingReliability:e=>{let t;if(e instanceof ArrayBuffer)t=new Uint8Array(e);else if(e instanceof Uint8Array)t=e;else return;try{let e=ns(t);if(!Iu(e)||e.length!==Au&&e.length!==ju)return;let n=wu[e[Ou.type]];if(n==null)return;let r=Su(e[Ou.reliability],n);if(r==null)return;if(e.length===ju){let t=e[Ou.streamKey];if(typeof t!=`string`)return;r.streamKey=t}return r}catch{return}}}}}function Iu(e){return Array.isArray(e)&&(e.length===ku||e.length===Au||e.length===ju)}var Lu=class{};function Ru(e){return Bu(e,Sc(e.carrier))}async function zu(e){return Bu(e,await Cc({carrier:e.carrier,secure:e.secure,lane:{dictionaryVersion:e.secure.dictionaryVersion,channels:e.secure.channelTags}}))}function Bu(e,t){return{sendActionData:e=>{Vu(t,e).catch(t=>e.runningAction._abort(t))},updateRunConfig:e.updateRunConfig}}async function Vu(e,t){let{action:n,runningAction:r,timeout:i}=t,a=new AbortController,o=!1,s=setTimeout(()=>{o=!0,a.abort()},i),c=r.addUpdateListeners([e=>{e.type===rl.finished&&(clearTimeout(s),a.abort())}]);try{if(n.type!==U.request){await e.send(n.toJsonObject(),{signal:a.signal});return}let t=await e.exchange(n.toJsonObject(),{signal:a.signal});if(!t.ok&&t.reason===`peer_error`)throw Kl.fromId(Y.send_failed,{actionState:n.type,actionId:n.id,message:t.message});if(!t.ok||!cl(t.wire))throw Kl.fromId(Y.invalid_action_response,{actionId:n.id});r._completeWithResult(n._domain.hydrateResultPayload(t.wire))}catch(e){throw o?Kl.fromId(Y.timeout,{timeout:i}):e}finally{clearTimeout(s),c()}}var Hu=class extends sc{},Uu=class extends Hu{constructor(e){super({...e,type:xr.exchange})}_getCacheKey(e){return this.initialized.getTransportCacheKey?.(e).join(`\0`)??``}_needsAsyncBringUp(e){return e.secureChannel!=null&&e.secureChannel.securityLevel!==Ha.none}_finalizeReady(e){let t=e.secureChannel;return t!=null&&t.securityLevel!==Ha.none?zu({...this._sessionContext(e),secure:t}):this._finalizeTransportMethods(e)}_finalizeTransportMethods(e){return Ru(this._sessionContext(e))}_sessionContext(e){return{carrier:e.carrier,updateRunConfig:e.updateRunConfig,secure:e.secureChannel}}},Wu=class e extends Lu{options;type=xr.exchange;constructor(e){super(),this.options=e}static create(t){return new e(t)}_createConnection(e){let t=this.options;return new Uu({initialize:()=>({getTransportCacheKey:t.getTransportCacheKey,isAvailable:t.available,getTransport:e=>{Gu(t);let n=t.openCarrier(e);return{status:Sr.ready,readyData:{carrier:t.wireTap==null?n:Vs(n,t.wireTap),secureChannel:t.security,updateRunConfig:t.updateRunConfig}}}})})}getRouteInfo(e){return this.options.getRouteInfo==null?{carrierLabel:this.options.label??`exchange`,summary:this.options.label??`exchange`}:this.options.getRouteInfo(e)}};function Gu(e){if(!(e.exchangeOnlyConnection!==!0||e.mux==null))for(let t of Ls(e.mux.localCaps()))throw sr.fromId(`protocol_on_exchange_only`,{protocolId:t})}var Ku=e=>({onIncomingActionDataJson:t=>{console.warn(`Received incoming action JSON [${t.domain}:${t.id}] on Transport [${e}] but no incoming data listener has been set.`)}});function qu(e,t){return{id:`action`,onLaneFrame:t=>Zu(e,t),onDetach:()=>Qu(e,t)}}function Ju(e){let t=new Set;return Xu(e,Qs({channel:e.channel,lane:qu(e,t),keepalive:e.linkKeepalive,tap:e.wireTap}),t)}async function Yu(e){let t=new Set,n={...qu(e,t),handshakeConfig:()=>({dictionaryVersion:e.secure.dictionaryVersion,channels:e.secure.channelTags})},r=await $s({channel:e.channel,secure:e.secure,lane:n,mux:e.secure.mux,keepalive:e.linkKeepalive,tap:e.wireTap});return Xu(e,r,t,r.remoteCaps?.includes(`reliable`)??!1,r.remoteCaps?.includes(`reliable-streamkey`)??!1)}function Xu(e,t,n,r,i){return{sendActionData:a=>{let{action:o,runningAction:s,timeout:c}=a,l=o.type===U.request&&o.schema?.reliabilityTier!=null&&o.schema.reliabilityTier!==pl.none;if(!t.isOpen()){o.type===U.request&&!l&&s._abort(e.makeDisconnectError(o.id));return}if(o.type===U.request&&!l){n.add(s);let e=setTimeout(()=>{s._abort(Kl.fromId(Y.timeout,{timeout:c}))},c);s.addUpdateListeners([t=>{t.type===rl.finished&&(clearTimeout(e),n.delete(s))}])}let u=a;a.reliability!=null&&(e.formatMessage==null?zc(o.domain,o.id):r===!1?(Vc(o.domain,o.id),u={...a,reliability:void 0}):a.reliability.streamKey!=null&&i===!1&&Uc(o.domain,o.id)),t.send(e.formatMessage?.outgoing(u)??JSON.stringify(u.action.toJsonObject()))},sendControlData:e=>{t.isOpen()&&t.send(Fc(e))},updateRunConfig:e.updateRunConfig,addOnDisconnectListener:e=>t.addOnDisconnectListener(e),disconnect:()=>t.close(),sendReturnData:(n,r)=>{let i=r==null?void 0:e.formatMessage?.outgoing({action:n,...r});t.send(i??JSON.stringify(n.toJsonObject()))}}}function Zu(e,t){let n=Ic(t);if(n!=null){e.resolvers.onControlMessage?.(n);return}let r=vu(t,e.formatMessage);if(r!=null){let n=e.formatMessage?.incomingReliability?.(t);n==null?e.resolvers.onIncomingActionDataJson(r):e.resolvers.onIncomingActionDataJson(r,n)}}function Qu(e,t){let n=e.makeDisconnectError(`—`);for(let e of[...t])e._abort(n)}function $u(e){return Kl.fromId(Y.send_failed,{actionId:e,actionState:`request`,message:`link channel disconnected`})}var ed=class extends Hu{resolvers;constructor(e,t){super({...e,type:xr.duplex}),this.resolvers=t??Ku(`link`)}_getCacheKey(e){return this.initialized.getTransportCacheKey?.(e).join(`\0`)??``}_needsAsyncBringUp(){return!0}_awaitCarrierReady(e){return e.channel.ready}_finalizeReady(e){let t=e.secureChannel;return t!=null&&t.securityLevel!==Ha.none?Yu({...this._sessionContext(e),secure:t}):this._finalizeTransportMethods(e)}_sessionContext(e){return{channel:e.channel,resolvers:this.resolvers,formatMessage:e.formatMessage,updateRunConfig:e.updateRunConfig,makeDisconnectError:$u,linkKeepalive:e.linkKeepalive,wireTap:e.wireTap}}_finalizeTransportMethods(e){return Ju(this._sessionContext(e))}},td=class e extends Lu{options;type=xr.duplex;constructor(e){super(),this.options=e}static create(t){return new e(t)}_createConnection(e){let t=this.options;return new ed({initialize:()=>({getTransportCacheKey:t.getTransportCacheKey,isAvailable:t.available,getTransport:e=>({status:Sr.ready,readyData:{channel:t.openChannel(e),formatMessage:t.createFormatMessage?.()??t.formatMessage,updateRunConfig:t.updateRunConfig,secureChannel:t.security,linkKeepalive:t.linkKeepalive?.(),wireTap:t.wireTap}})})},e.resolvers)}getRouteInfo(e){return this.options.getRouteInfo==null?{carrierLabel:this.options.label??`link`,summary:this.options.label??`link`}:this.options.getRouteInfo(e)}};function nd(e){let{carrier:t,channel:n,available:r,label:i}=e,a=i??t.carrierLabel,o;if(e.secure){let t=e.link??(e.storage==null?void 0:new ka({storageAdapter:e.storage}));if(t==null)throw Error("transport: a secure transport requires `link` or `storage` for the crypto identity.");o={securityLevel:e.securityLevel??Ha.authenticated,link:t,localCoordinate:(e.identity??e.runtime.coordinate).toJsonObject(),dictionaryVersion:n.dictionaryVersion,channelTags:n.tags,mux:e.mux}}return bu(t)?Wu.create({openCarrier:t.open,getTransportCacheKey:t.getCacheKey,available:r,getRouteInfo:t.getRouteInfo,label:a,security:o,mux:e.mux,exchangeOnlyConnection:e.exchangeOnlyConnection,wireTap:e.wireTap}):td.create({openChannel:t.open,createFormatMessage:n.createCodec,getTransportCacheKey:t.getCacheKey,available:r,getRouteInfo:t.getRouteInfo,label:a,security:o,linkKeepalive:e.linkKeepalive,wireTap:e.wireTap})}function rd(e){return e.map(e=>e.domain).join(`+`)}function id(e){let{intToRoute:t}=Tu(e),n=t.map(e=>`${e.domain}:${e.id}`).join(`,`),r=2166136261;for(let e=0;e<n.length;e++)r^=n.charCodeAt(e),r=Math.imul(r,16777619);return`auto:${(r>>>0).toString(16).padStart(8,`0`)}`}function ad(e={}){let t=e.toAcceptor??[],n=e.toConnector??[],r=[...t,...n],i=e.tag??rd(r);return{toAcceptorDomains:t,toConnectorDomains:n,dictionaryVersion:e.dictionaryVersion??id(r),createCodec:Fu(r,e.sessionOptions),tag:i,tags:[i]}}var od=new WeakMap;function sd(e,t,n){let r=od.get(e);r??(r=new Map,od.set(e,r));let i=r.get(t.stringId)??new Set;if(r.set(t.stringId,i),i.has(n.stringId)){console.warn(`connectChannel: this runtime already has a connection to [${t.stringId}] dialling as [${n.stringId}]. The peer binds each connection by that identity, so it cannot tell the two apart: every reply and push for both goes back over whichever connected first, and the other link's traffic hangs until it times out. Give each connection its own \`connectionId\` (e.g. \`connectChannel(runtime, jobsChannel, { connectionId: "jobs", … })\`) — or, if they carry the same routes over one link, use \`connectChannels\`.`);return}i.add(n.stringId)}function cd(e,t,n){let r=n.securityLevel??Ha.authenticated,i=n.transports.some(e=>e.secure??!0),a=n.connectionId==null?void 0:e.coordinate.withConnectionId(n.connectionId);n.transports.some(e=>!bu(e.carrier))&&sd(e,n.peer,a??e.coordinate);let{mux:o,link:s,resolveLinkKeepalive:c,wireTap:l}=mc({callerName:`connectChannel`,peer:n.peer,identity:a??e.coordinate,mux:n.wireMux,protocols:n.protocols,anySecure:i,storage:n.storage,link:n.link,ephemeralIdentity:n.ephemeralIdentity,keepLinkAlive:n.keepLinkAlive,linkKeepalive:n.linkKeepalive,wireTap:n.wireTap}),u=n.transports.every(e=>bu(e.carrier)),d=n.transports.map(n=>nd({carrier:n.carrier,channel:t,runtime:e,identity:a,secure:n.secure??!0,link:s,securityLevel:n.securityLevel??r,available:n.available,label:n.label,mux:o,exchangeOnlyConnection:u,linkKeepalive:c,wireTap:l})),f=n.onPush==null?[]:t.toConnectorDomains.map(e=>e.wrapAsPartialLocalHandler(n.onPush)),p=n.transports.filter(e=>!bu(e.carrier)).map(e=>e.secure??!0?e.securityLevel??r:Ha.none),m=p.length===0?Ha.none:p.reduce((e,t)=>io(t,e)?e:t),h=e.connectTo(n.peer,{transports:d,domains:[...t.toAcceptorDomains],localHandlers:f,defaultTimeout:n.defaultTimeout,reliableActionTimeout:n.reliableActionTimeout,wireMux:o,securityLevel:m,keepLinkAlive:n.keepLinkAlive,connectionIdentity:a});return n.onReliableEvent!=null&&h.addReliableEventListener(n.onReliableEvent),n.onLinkEvent!=null&&h.addLinkEventListener(n.onLinkEvent),h}Ha.none,Ha.authenticated,Ha.encrypted;function ld(e){return{localClient:e.localClient,externalClient:e.externalClient,dialContext:e}}function ud(e){let{getCacheKey:t,getRouteInfo:n}=e;return{carrierLabel:e.carrierLabel,open:t=>e.open(ld(t)),getCacheKey:t==null?void 0:e=>t(ld(e)),getRouteInfo:n==null?void 0:e=>n(ld(e))}}Kl.createChildDomain({domain:`err_nice_transport_ws`,schema:{ws_disconnected:D({message:()=>`WebSocket transport disconnected.`}),ws_create_failed:D({message:({originalError:e})=>`Failed to create WebSocket transport.${e?` Original error: ${e.message}`:``}`}),ws_error:D({message:({originalError:e})=>`WebSocket transport error.${e?` Original error: ${e.message}`:``}`})}});function dd(e,t={}){let{getTransportCacheKey:n,getRouteInfo:r,createWebSocket:i}=t;return ud(hr(t=>e(t.dialContext),{getCacheKey:n==null?void 0:e=>n(e.dialContext),getRouteInfo:r==null?void 0:e=>r(e.dialContext),createWebSocket:i}))}var{getOwnPropertyNames:fd,getOwnPropertySymbols:pd}=Object,{hasOwnProperty:md}=Object.prototype;function hd(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function gd(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function _d(e){return fd(e).concat(pd(e))}var vd=Object.hasOwn||((e,t)=>md.call(e,t)),yd=`__v`,bd=`__o`,xd=`_owner`,{getOwnPropertyDescriptor:X,keys:Sd}=Object,Cd=Object.is||function(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function wd(e,t){return e===t}function Td(e,t){return e.byteLength===t.byteLength&&Id(new Uint8Array(e),new Uint8Array(t))}function Ed(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Dd(e,t){return e.byteLength===t.byteLength&&Id(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Od(e,t){return Cd(e.getTime(),t.getTime())}function kd(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Ad(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function jd(e,t,n){let r=Sd(e),i=r.length;if(Sd(t).length!==i)return!1;for(;i-->0;)if(!Rd(e,t,n,r[i]))return!1;return!0}function Md(e,t,n){let r=_d(e),i=r.length;if(_d(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!Rd(e,t,n,a)||(o=X(e,a),s=X(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Nd(e,t){return Cd(e.valueOf(),t.valueOf())}function Pd(e,t){return e.source===t.source&&e.flags===t.flags}function Fd(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Id(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function Ld(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Rd(e,t,n,r){return(r===xd||r===bd||r===yd)&&(e.$$typeof||t.$$typeof)?!0:vd(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var zd=Object.prototype.toString;function Bd(e){let t=Wd(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function(e,d,f){if(e===d)return!0;if(e==null||d==null)return!1;let p=typeof e;if(p!==typeof d)return!1;if(p!==`object`)return p===`number`||p===`bigint`?o(e,d,f):p===`function`?i(e,d,f):!1;let m=e.constructor;if(m!==d.constructor)return!1;if(m===Object)return s(e,d,f);if(m===Array)return n(e,d,f);if(m===Date)return r(e,d,f);if(m===RegExp)return c(e,d,f);if(m===Map)return a(e,d,f);if(m===Set)return l(e,d,f);if(m===Promise)return!1;if(Array.isArray(e))return n(e,d,f);let h=zd.call(e),g=t[h];if(g)return g(e,d,f);let _=u&&u(e,d,f,h);return _?_(e,d,f):!1}}function Vd({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Td,areArraysEqual:n?Md:Ed,areDataViewsEqual:Dd,areDatesEqual:Od,areErrorsEqual:kd,areFunctionsEqual:wd,areMapsEqual:n?hd(Ad,Md):Ad,areNumbersEqual:Cd,areObjectsEqual:n?Md:jd,arePrimitiveWrappersEqual:Nd,areRegExpsEqual:Pd,areSetsEqual:n?hd(Fd,Md):Fd,areTypedArraysEqual:n?hd(Id,Md):Id,areUrlsEqual:Ld,getUnsupportedCustomComparator:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=gd(r.areArraysEqual),t=gd(r.areMapsEqual),n=gd(r.areObjectsEqual),i=gd(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Hd(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function Ud({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}function Wd({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}var Gd=Kd();Kd({strict:!0}),Kd({circular:!0}),Kd({circular:!0,strict:!0}),Kd({createInternalComparator:()=>Cd}),Kd({strict:!0,createInternalComparator:()=>Cd}),Kd({circular:!0,createInternalComparator:()=>Cd}),Kd({circular:!0,createInternalComparator:()=>Cd,strict:!0});function Kd(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=Bd(Vd(e));return Ud({circular:t,comparator:a,createState:r,equals:n?n(a):Hd(a),strict:i})}var qd=Symbol.for(`immer-nothing`),Jd=Symbol.for(`immer-draftable`),Yd=Symbol.for(`immer-state`);function Xd(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Zd=Object,Qd=Zd.getPrototypeOf,$d=`constructor`,ef=`prototype`,tf=`configurable`,nf=`enumerable`,rf=`writable`,af=`value`,of=e=>!!e&&!!e[Yd];function sf(e){return e?uf(e)||_f(e)||!!e[Jd]||!!e[$d]?.[Jd]||vf(e)||yf(e):!1}var cf=Zd[ef][$d].toString(),lf=new WeakMap;function uf(e){if(!e||!bf(e))return!1;let t=Qd(e);if(t===null||t===Zd[ef])return!0;let n=Zd.hasOwnProperty.call(t,$d)&&t[$d];if(n===Object)return!0;if(!xf(n))return!1;let r=lf.get(n);return r===void 0&&(r=Function.toString.call(n),lf.set(n,r)),r===cf}function df(e,t,n=!0){ff(e)===0?(n?Reflect.ownKeys(e):Zd.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ff(e){let t=e[Yd];return t?t.type_:_f(e)?1:vf(e)?2:yf(e)?3:0}var pf=(e,t,n=ff(e))=>n===2?e.has(t):Zd[ef].hasOwnProperty.call(e,t),mf=(e,t,n=ff(e))=>n===2?e.get(t):e[t],hf=(e,t,n,r=ff(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function gf(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var _f=Array.isArray,vf=e=>e instanceof Map,yf=e=>e instanceof Set,bf=e=>typeof e==`object`,xf=e=>typeof e==`function`,Sf=e=>typeof e==`boolean`;function Cf(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var wf=e=>bf(e)?e?.[Yd]:null,Tf=e=>e.copy_||e.base_,Ef=e=>e.modified_?e.copy_:e.base_;function Df(e,t){if(vf(e))return new Map(e);if(yf(e))return new Set(e);if(_f(e))return Array[ef].slice.call(e);let n=uf(e);if(t===!0||t===`class_only`&&!n){let t=Zd.getOwnPropertyDescriptors(e);delete t[Yd];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[rf]===!1&&(a[rf]=!0,a[tf]=!0),(a.get||a.set)&&(t[i]={[tf]:!0,[rf]:!0,[nf]:a[nf],[af]:e[i]})}return Zd.create(Qd(e),t)}else{let t=Qd(e);if(t!==null&&n)return{...e};let r=Zd.create(t);return Zd.assign(r,e)}}function Of(e,t=!1){return jf(e)||of(e)||!sf(e)?e:(ff(e)>1&&Zd.defineProperties(e,{set:Af,add:Af,clear:Af,delete:Af}),Zd.freeze(e),t&&df(e,(e,t)=>{Of(t,!0)},!1),e)}function kf(){Xd(2)}var Af={[af]:kf};function jf(e){return e===null||!bf(e)?!0:Zd.isFrozen(e)}var Mf=`MapSet`,Nf=`Patches`,Pf=`ArrayMethods`,Ff={};function If(e){let t=Ff[e];return t||Xd(0,e),t}var Lf=e=>!!Ff[e];function Rf(e,t){Ff[e]||(Ff[e]=t)}var zf,Bf=()=>zf,Vf=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Lf(Mf)?If(Mf):void 0,arrayMethodsPlugin_:Lf(Pf)?If(Pf):void 0});function Hf(e,t){t&&(e.patchPlugin_=If(Nf),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Uf(e){Wf(e),e.drafts_.forEach(Kf),e.drafts_=null}function Wf(e){e===zf&&(zf=e.parent_)}var Gf=e=>zf=Vf(zf,e);function Kf(e){let t=e[Yd];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function qf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Yd].modified_&&(Uf(t),Xd(4)),sf(e)&&(e=Jf(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Yd].base_,e,t)}else e=Jf(t,n);return Yf(t,e,!0),Uf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===qd?void 0:e}function Jf(e,t){if(jf(t))return t;let n=t[Yd];if(!n)return rp(t,e.handledSet_,e);if(!Zf(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);tp(n,e)}return n.copy_}function Yf(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Of(t,n)}function Xf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Zf=(e,t)=>e.scope_===t,Qf=[];function $f(e,t,n,r){let i=Tf(e),a=e.type_;if(r!==void 0&&mf(i,r,a)===t){hf(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;df(i,(e,n)=>{if(of(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Qf;for(let e of o)hf(i,e,n,a)}function ep(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Zf(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Ef(i);$f(e,i.draft_??i,a,n),tp(i,r)})}function tp(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Xf(e)}}function np(e,t,n){let{scope_:r}=e;if(of(n)){let i=n[Yd];Zf(i,r)&&i.callbacks_.push(function(){dp(e),$f(e,n,Ef(i),t)})}else sf(n)&&e.callbacks_.push(function(){let i=Tf(e);e.type_===3?i.has(n)&&rp(n,r.handledSet_,r):mf(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&rp(mf(e.copy_,t,e.type_),r.handledSet_,r)})}function rp(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||of(e)||t.has(e)||!sf(e)||jf(e)?e:(t.add(e),df(e,(r,i)=>{if(of(i)){let t=i[Yd];Zf(t,n)&&(hf(e,r,Ef(t),e.type_),Xf(t))}else sf(i)&&rp(i,t,n)}),e)}function ip(e,t){let n=_f(e),r={type_:+!!n,scope_:t?t.scope_:Bf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=ap;n&&(i=[r],a=op);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var ap={get(e,t){if(t===Yd)return e;if(t===`constructor`||t===`__proto__`){let n=Tf(e)[t];return new Proxy(n||{},{get:(e,t)=>t===`__proto__`||t===`prototype`?Object.freeze(Object.create(null)):Reflect.get(e,t),set:()=>!0,apply:(e,t,n)=>Reflect.apply(e,t,n)})}let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Tf(e);if(!pf(i,t,e.type_))return cp(e,i,t);let a=i[t];if(e.finalized_||!sf(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Cf(t))return a;if(a===sp(e.base_,t)){dp(e);let n=e.type_===1?+t:t,r=pp(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t===`constructor`||t===`__proto__`||t===`prototype`?!1:t in Tf(e)},ownKeys(e){return Reflect.ownKeys(Tf(e))},set(e,t,n){if(t===`constructor`||t===`__proto__`||t===`prototype`)return!0;let r=lp(Tf(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=sp(Tf(e),t),i=r?.[Yd];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(gf(n,r)&&(n!==void 0||pf(e.base_,t,e.type_)))return!0;dp(e),up(e)}return e.copy_[t]===n&&(n!==void 0||pf(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),np(e,t,n),!0)},deleteProperty(e,t){return dp(e),sp(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),up(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Tf(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[rf]:!0,[tf]:e.type_!==1||t!==`length`,[nf]:r[nf],[af]:n[t]}},defineProperty(){Xd(11)},getPrototypeOf(e){return Qd(e.base_)},setPrototypeOf(){Xd(12)}},op={};for(let e in ap){let t=ap[e];op[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}op.deleteProperty=function(e,t){return op.set.call(this,e,t,void 0)},op.set=function(e,t,n){return ap.set.call(this,e[0],t,n,e[0])};function sp(e,t){let n=e[Yd];return(n?Tf(n):e)[t]}function cp(e,t,n){let r=lp(t,n);return r?af in r?r[af]:r.get?.call(e.draft_):void 0}function lp(e,t){if(!(t in e))return;let n=Qd(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Qd(n)}}function up(e){e.modified_||(e.modified_=!0,e.parent_&&up(e.parent_))}function dp(e){e.copy_||=(e.assigned_=new Map,Df(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var fp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(xf(e)&&!xf(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}xf(t)||Xd(6),n!==void 0&&!xf(n)&&Xd(7);let r;if(sf(e)){let i=Gf(this),a=pp(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Uf(i):Wf(i)}return Hf(i,n),qf(r,i)}else if(!e||!bf(e)){if(r=t(e),r===void 0&&(r=e),r===qd&&(r=void 0),this.autoFreeze_&&Of(r,!0),n){let t=[],i=[];If(Nf).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else Xd(1,e)},this.produceWithPatches=(e,t)=>{if(xf(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Sf(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Sf(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Sf(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){sf(e)||Xd(8),of(e)&&(e=mp(e));let t=Gf(this),n=pp(t,e,void 0);return n[Yd].isManual_=!0,Wf(t),n}finishDraft(e,t){let n=e&&e[Yd];(!n||!n.isManual_)&&Xd(9);let{scope_:r}=n;return Hf(r,t),qf(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=If(Nf).applyPatches_;return of(e)?r(e,t):this.produce(e,e=>r(e,t))}};function pp(e,t,n,r){let[i,a]=vf(t)?If(Mf).proxyMap_(t,n):yf(t)?If(Mf).proxySet_(t,n):ip(t,n);return(n?.scope_??Bf()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?ep(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function mp(e){return of(e)||Xd(10,e),hp(e)}function hp(e){if(!sf(e)||jf(e))return e;let t=e[Yd],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Df(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Df(e,!0);return df(n,(e,t)=>{hf(n,e,hp(t))},r),t&&(t.finalized_=!1),n}function gp(){function e(n,r=[]){if(n.key_!==void 0){let e=n.parent_.copy_??n.parent_.base_,t=wf(mf(e,n.key_)),i=mf(e,n.key_);if(i===void 0||i!==n.draft_&&i!==n.base_&&i!==n.copy_||t!=null&&t.base_!==n.base_)return null;let a=n.parent_.type_===3,o;if(a){let e=n.parent_;o=Array.from(e.drafts_.keys()).indexOf(n.key_)}else o=n.key_;if(!(a&&e.size>o||pf(e,o)))return null;r.push(o)}if(n.parent_)return e(n.parent_,r);r.reverse();try{t(n.copy_,r)}catch{return null}return r}function t(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(n=mf(n,r),!bf(n)||n===null)throw Error(`Cannot resolve path at '${t.join(`/`)}'`)}return n}let n=`replace`,r=`remove`;function i(e,t,n){if(e.scope_.processedForPatches_.has(e))return;e.scope_.processedForPatches_.add(e);let{patches_:r,inversePatches_:i}=n;switch(e.type_){case 0:case 2:return o(e,t,r,i);case 1:return a(e,t,r,i);case 3:return s(e,t,r,i)}}function a(e,t,i,a){let{base_:o,assigned_:s}=e,c=e.copy_;c.length<o.length&&([o,c]=[c,o],[i,a]=[a,i]);let l=e.allIndicesReassigned_===!0;for(let e=0;e<o.length;e++){let r=c[e],u=o[e];if((l||s?.get(e.toString()))&&r!==u){let o=r?.[Yd];if(o&&o.modified_)continue;let s=t.concat([e]);i.push({op:n,path:s,value:d(r)}),a.push({op:n,path:s,value:d(u)})}}for(let e=o.length;e<c.length;e++){let n=t.concat([e]);i.push({op:`add`,path:n,value:d(c[e])})}for(let e=c.length-1;o.length<=e;--e){let n=t.concat([e]);a.push({op:r,path:n})}}function o(e,t,i,a){let{base_:o,copy_:s,type_:c}=e;df(e.assigned_,(e,l)=>{let u=mf(o,e,c),f=mf(s,e,c),p=l?pf(o,e)?n:`add`:r;if(u===f&&p===n)return;let m=t.concat(e);i.push(p===r?{op:p,path:m}:{op:p,path:m,value:d(f)}),a.push(p===`add`?{op:r,path:m}:p===r?{op:`add`,path:m,value:d(u)}:{op:n,path:m,value:d(u)})})}function s(e,t,n,i){let{base_:a,copy_:o}=e,s=0;a.forEach(e=>{if(!o.has(e)){let a=t.concat([s]);n.push({op:r,path:a,value:e}),i.unshift({op:`add`,path:a,value:e})}s++}),s=0,o.forEach(e=>{if(!a.has(e)){let a=t.concat([s]);n.push({op:`add`,path:a,value:e}),i.unshift({op:r,path:a,value:e})}s++})}function c(e,t,r){let{patches_:i,inversePatches_:a}=r;i.push({op:n,path:[],value:t===qd?void 0:t}),a.push({op:n,path:[],value:e})}function l(e,t){return t.forEach(t=>{let{path:i,op:a}=t,o=e;for(let e=0;e<i.length-1;e++){let t=ff(o),n=i[e];typeof n!=`string`&&typeof n!=`number`&&(n=``+n),(t===0||t===1)&&(n===`__proto__`||n===$d)&&Xd(19),xf(o)&&n===ef&&Xd(19),o=mf(o,n),bf(o)||Xd(18,i.join(`/`))}let s=ff(o),c=u(t.value),l=i[i.length-1];switch(a){case n:switch(s){case 2:return o.set(l,c);case 3:Xd(16);default:return o[l]=c}case`add`:switch(s){case 1:return l===`-`?o.push(c):o.splice(l,0,c);case 2:return o.set(l,c);case 3:return o.add(c);default:return o[l]=c}case r:switch(s){case 1:return o.splice(l,1);case 2:return o.delete(l);case 3:return o.delete(t.value);default:return delete o[l]}default:Xd(17,a)}}),e}function u(e){if(!sf(e))return e;if(_f(e))return e.map(u);if(vf(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,u(t)]));if(yf(e))return new Set(Array.from(e).map(u));let t=Object.create(Qd(e));for(let n in e)t[n]=u(e[n]);return pf(e,Jd)&&(t[Jd]=e[Jd]),t}function d(e){return of(e)?u(e):e}Rf(Nf,{applyPatches_:l,generatePatches_:i,generateReplacementPatches_:c,getPath:e})}var _p=new fp,vp=_p.produce,yp=_p.produceWithPatches.bind(_p),bp=_p.applyPatches.bind(_p);gp();function xp(e,t,n){let r=t(e.state);return()=>{let i=e.state,a=t(i);if(a===r)return;if(Gd(a,r)){r=a;return}let o=r;r=a,n(a,i,o)}}function Sp(e,t){return n=>{let r=e(n.state);return(i=!1)=>{let a=n.state,o=e(a);if(!i){if(o===r)return;if(Gd(o,r)){r=o;return}}let s=r;if(r=o,n._hasPatchListeners()){let[e,r,i]=yp(a,e=>{t(o,e,a,s)});n._updateStateWithoutReaction(e),r.length>0&&n._emitPatches(r,i)}else{let e=vp(a,e=>{t(o,e,a,s)});n._updateStateWithoutReaction(e)}}}}var Cp=class{currentState;createInitialState;ssr=!1;listeners=new Set;reactionCreators=[];reactions=[];clientSubscriptions=[];_patchListeners=[];constructor(e){e instanceof Function?(this.createInitialState=e,this.currentState=e()):(this.createInitialState=()=>e,this.currentState=e)}get state(){return Object.freeze(this.currentState)}_setInternalOptions({ssr:e,reactionCreators:t=[]}){this.ssr=e,this.reactionCreators=t,this.reactions=t.map(e=>e(this))}_getReactionCreators(){return this.reactionCreators}_instantiateReactions(){this.reactions=this.reactionCreators.map(e=>e(this))}_getInitialState(){return this.createInitialState()}_hasPatchListeners(){return this._patchListeners.length>0}_emitPatches(e,t){for(let n of this._patchListeners)n(e,t)}_updateStateWithoutReaction(e){this.currentState=e}_updateState(e){this.currentState=e;for(let e of this.reactions)e();if(!this.ssr){for(let e of this.clientSubscriptions)e();for(let e of this.listeners)e()}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}watch(e,t){if(this.ssr)return()=>{console.warn(`@nice-code/state: Subscriptions made on the server side are not registered, so this unsubscribe call does nothing.`)};let n=xp(this,e,t);return this.clientSubscriptions.push(n),()=>{this.clientSubscriptions=this.clientSubscriptions.filter(e=>e!==n)}}createReaction(e,t,{runNow:n=!1,runNowWithSideEffects:r=!1}={}){let i=Sp(e,t);this.reactionCreators.push(i);let a=i(this);return this.reactions.push(a),(n||r)&&(a(!0),r&&!this.ssr&&this._updateState(this.currentState)),()=>{this.reactions=this.reactions.filter(e=>e!==a),this.reactionCreators=this.reactionCreators.filter(e=>e!==i)}}listenToPatches(e){return this._patchListeners.push(e),()=>{this._patchListeners=this._patchListeners.filter(t=>t!==e)}}update(e,t){Op(this,e,t)}replace(e){e!==this.currentState&&(this._hasPatchListeners()&&this._emitPatches([{op:`replace`,path:[],value:e}],[{op:`replace`,path:[],value:this.currentState}]),this._updateState(e))}replaceFromCurrent(e){this.replace(e(this.currentState))}applyPatches(e){wp(this,e)}};function wp(e,t){let n=e.state,r=bp(n,t);r!==n&&e._updateState(r)}function Tp(e,t,n){if(!n&&!t&&typeof e==`object`&&e)throw Error(`@nice-code/state: an update function returned a value without modifying its draft. Update functions are mutate-only — a returned state is ignored (unlike immer's produce). To reset or swap the state wholesale, use store.replace(next); to change part of it, mutate the draft.`)}function Ep(e,t){if(typeof t==`function`){let n,r=!1,[i,a,o]=yp(e,i=>{n=t(i,e),r=n===i});return Tp(n,i!==e,r),[i,a,o]}let n=e,r=[],i=[];for(let e of t){let t,a=!1,[o,s,c]=yp(n,r=>{t=e(r,n),a=t===r});Tp(t,o!==n,a),n=o,r.push(...s),i.push(...c)}return[n,r,i]}function Dp(e,t){if(typeof t==`function`){let n,r=!1,i=vp(e,i=>{n=t(i,e),r=n===i});return Tp(n,i!==e,r),i}return t.reduce((e,t)=>{let n,r=!1,i=vp(e,i=>{n=t(i,e),r=n===i});return Tp(n,i!==e,r),i},e)}function Op(e,t,n){let r=e.state,i;if(e._hasPatchListeners()||n!=null){let[a,o,s]=Ep(r,t);o.length>0&&(n?.(o,s),e._emitPatches(o,s)),i=a}else i=Dp(r,t);i!==r&&e._updateState(i)}var kp=fe.createChildDomain({domain:`err_nice_realm`,schema:{schema_mismatch:D({message:({realmId:e,clientHash:t,serverHash:n})=>`Realm "${e}" schema mismatch — avatar ${t.slice(0,12)}… vs server ${n.slice(0,12)}…. The client and server were built from different realm definitions; refusing to attach (silent token skew would corrupt state).`,context:{required:!0}}),realm_unknown:D({message:({realmId:e})=>`This server hosts no realm with id "${e}".`,context:{required:!0}}),unauthorized_avatar_type:D({message:({avatarType:e,expected:t})=>`Client type "${e}" is not permitted here (expected: ${t.join(`, `)}).`,context:{required:!0}}),avatar_unresolved:D({message:({realmId:e})=>`This connection's identity could not be resolved to an avatar of realm "${e}" — the server's resolveAvatar returned undefined (or the attachment carries no coordinate).`,context:{required:!0}}),insufficient_security:D({message:({realmId:e,required:t,actual:n})=>`Realm "${e}" requires a "${t}" connection but this one negotiated "${n}". Connect with at least the required security level — the realm refuses to move avatar data below it.`,context:{required:!0}}),unauthorized_coordinate:D({message:({path:e})=>`This avatar's coordinates may not write "${e}".`,context:{required:!0}}),value_invalid:D({message:({path:e,expected:t})=>`The value written to "${e}" does not match the schema (expected ${t}).`,context:{required:!0}}),limits_exceeded:D({message:({limit:e})=>`Ingress limit exceeded: ${e}.`,context:{required:!0}}),intent_unknown:D({message:({intent:e})=>`Unknown intent "${e}".`,context:{required:!0}}),version_gap_unrecoverable:D({message:({lastKnownVersion:e,oldestReplayable:t})=>`Version ${e} is behind the replayable window (oldest ${t}) — full rehydration required.`,context:{required:!0}}),write_before_hydrate:D({message:({realmId:e})=>`realm.update() on "${e}" before the first hydrate — the store is still empty. Await realm.whenLive() before writing (or use the assertOnAttach connect option for state that must exist whenever this avatar is attached).`,context:{required:!0}}),frame_too_stale:D({message:({basisVersion:e})=>`The optimistic frame (basis ${e}) expired before it could be confirmed — outcome unknown (it may have committed; re-read state rather than re-issuing a non-idempotent intent).`,context:{required:!0}}),durable_backlog_overflow:D({message:({pendingFrames:e})=>`The durable-write backlog is full (${e} unconfirmed reassert frames) — this write was rejected. Re-sync from your source of truth after reconnecting.`,context:{required:!0}}),frame_invalid:D({message:({reason:e})=>`Malformed realm frame: ${e}.`,context:{required:!0}}),write_target_missing:D({message:({path:e})=>`The write to "${e}" could not be applied — its parent no longer exists (a pruned entry or a transient region reset since the write's basis). Re-read state instead of re-issuing.`,context:{required:!0}})}});function Ap(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Uint8Array)}function jp(e,t){switch(e.kind){case`string`:return typeof t==`string`?e.maxLength!=null&&t.length>e.maxLength?{path:[],expected:`a string of at most ${e.maxLength} characters`}:void 0:{path:[],expected:`string`};case`number`:return typeof t==`number`?(e.min!=null||e.max!=null||e.integer===!0)&&!Number.isFinite(t)?{path:[],expected:`a finite number`}:e.integer===!0&&!Number.isInteger(t)?{path:[],expected:`an integer`}:e.min!=null&&t<e.min?{path:[],expected:`a number >= ${e.min}`}:e.max!=null&&t>e.max?{path:[],expected:`a number <= ${e.max}`}:void 0:{path:[],expected:`number`};case`boolean`:return typeof t==`boolean`?void 0:{path:[],expected:`boolean`};case`literal`:return t===e.value?void 0:{path:[],expected:`literal ${JSON.stringify(e.value)}`};case`optional`:return t===void 0?void 0:jp(e.inner,t);case`union`:for(let n of e.options)if(jp(n,t)==null)return;return{path:[],expected:`one of the union options`};case`object`:if(!Ap(t))return{path:[],expected:`object`};for(let n of Object.keys(t))if(e.entries[n]==null)return{path:[n],expected:`no such key in the schema`};for(let[n,r]of Object.entries(e.entries)){let e=t[n];if(e===void 0){if(r.kind!==`optional`)return{path:[n],expected:r.kind};continue}let i=jp(r,e);if(i!=null)return{path:[n,...i.path],expected:i.expected}}return;case`record`:if(!Ap(t))return{path:[],expected:`record`};if(e.maxKeys!=null&&Object.keys(t).length>e.maxKeys)return{path:[],expected:`a record with at most ${e.maxKeys} entries`};for(let[n,r]of Object.entries(t)){let t=jp(e.value,r);if(t!=null)return{path:[n,...t.path],expected:t.expected}}return;case`array`:if(!Array.isArray(t))return{path:[],expected:`array`};if(e.maxItems!=null&&t.length>e.maxItems)return{path:[],expected:`an array of at most ${e.maxItems} items`};for(let n=0;n<t.length;n++){let r=jp(e.item,t[n]);if(r!=null)return{path:[n,...r.path],expected:r.expected}}return;case`standard`:{let n=e.schema[`~standard`].validate(t);return n instanceof Promise?{path:[],expected:`a synchronous standard-schema validator`}:n.issues==null?void 0:{path:[],expected:n.issues[0]?.message??`standard-schema pass`}}}}var Mp=class{_toId=new Map;_toKey=[];intern(e){let t=this._toId.get(e);return t??(t=this._toKey.length,this._toId.set(e,t),this._toKey.push(e)),t}idOf(e){return this._toId.get(e)}keyOf(e){return this._toKey[e]}load(e){for(let[t,n]of e)this._toId.set(t,n),this._toKey[n]=t}get size(){return this._toId.size}clear(){this._toId.clear(),this._toKey.length=0}},Z={hello:0,hydrate:1,patches:2,write:3,intent:4,ack:5,reject:6,keyDict:7,detach:8,clientCaps:9,batch:10},Np=Object.fromEntries(Object.entries(Z).map(([e,t])=>[t,e])),Pp={batch:`b1`},Fp={replace:0,add:1,remove:2};function Q(e){throw kp.fromId(`frame_invalid`,{reason:e})}function Ip(e,t){return(typeof e!=`number`||!Number.isInteger(e))&&Q(`${t} must be an int`),e}function Lp(e,t){return typeof e!=`string`&&Q(`${t} must be a string`),e}function Rp(e){let t=Ip(e,`slot`);return(t<0||t>255)&&Q(`slot ${t} out of range`),t}function zp(e){(!Array.isArray(e)||e.length===0)&&Q(`op path must be a non-empty array`);for(let t of e)typeof t==`number`?(!Number.isInteger(t)||t<0)&&Q(`invalid path token ${t}`):typeof t!=`string`&&Q(`path segments must be ints or strings`);return e}function Bp(e){Array.isArray(e)||Q(`ops must be an array`);for(let t of e){(!Array.isArray(t)||t.length<2||t.length>3)&&Q(`malformed op`);let e=Ip(t[0],`op kind`);e!==Fp.replace&&e!==Fp.add&&e!==Fp.remove&&Q(`unknown op kind ${e}`),zp(t[1]),e===Fp.remove&&t.length!==2&&Q(`remove op carries no value`),e!==Fp.remove&&t.length!==3&&Q(`replace/add op requires a value`)}return e}function Vp(e){return(!Array.isArray(e)||e.length!==3)&&Q(`hydrate limits must be 3 ints`),Ip(e[0],`limits.maxPatchesPerFrame`),Ip(e[1],`limits.maxFrameBytes`),Ip(e[2],`limits.writeRatePerSecond`),e}function Hp(e){return(!Array.isArray(e)||e.length!==3)&&Q(`hydrate avatar must be 3 strings`),Lp(e[0],`avatar.type`),Lp(e[1],`avatar.persistentId`),Lp(e[2],`avatar.instanceId`),e}var Up=16,Wp=32;function Gp(e){Array.isArray(e)||Q(`clientCaps features must be an array`),e.length>Up&&Q(`clientCaps features list too long`);for(let t of e)Lp(t,`clientCaps feature`).length>Wp&&Q(`clientCaps feature too long`);return e}function Kp(e){Array.isArray(e)||Q(`keyDict entries must be an array`);for(let t of e)(!Array.isArray(t)||t.length!==2)&&Q(`malformed keyDict entry`),Lp(t[0],`keyDict key`),Ip(t[1],`keyDict id`)<0&&Q(`keyDict id must be >= 0`);return e}function qp(e){return Es([Z.hello,e.slot,e.realmId,e.schemaHash,e.lastKnownVersion,e.epoch??null])}function Jp(e){return Es([Z.write,e.slot,e.clientSeq,e.basisVersion,e.ops])}function Yp(e){return Es([Z.intent,e.slot,e.clientSeq,e.intentToken,e.input])}function Xp(e){return Es([Z.detach,e.slot,e.reason??null])}function Zp(e){return Es([Z.clientCaps,e.slot,e.features])}function Qp(e){let t;try{t=ns(e)}catch{Q(`not msgpack`)}(!Array.isArray(t)||t.length<2)&&Q(`frame must be a [kind, slot, …] array`);let n=Ip(t[0],`kind`),r=Rp(t[1]);switch(n){case Z.hello:return t.length!==6&&Q(`hello must have 6 elements`),t[5]!=null&&typeof t[5]!=`string`&&Q(`hello epoch must be a string`),{kind:n,slot:r,realmId:Lp(t[2],`realmId`),schemaHash:Lp(t[3],`schemaHash`),lastKnownVersion:Ip(t[4],`lastKnownVersion`),epoch:t[5]??void 0};case Z.hydrate:return t.length!==9&&Q(`hydrate must have 9 elements`),t[3]instanceof Uint8Array||Q(`hydrate stateBlob must be bytes`),typeof t[5]!=`boolean`&&Q(`hydrate more must be a boolean`),{kind:n,slot:r,version:Ip(t[2],`version`),stateBlob:t[3],keyDictSeed:Kp(t[4]),more:t[5],epoch:Lp(t[6],`hydrate epoch`),limits:Vp(t[7]),avatar:Hp(t[8])};case Z.patches:return t.length!==5&&Q(`patches must have 5 elements`),{kind:n,slot:r,fromVersion:Ip(t[2],`fromVersion`),toVersion:Ip(t[3],`toVersion`),ops:Bp(t[4])};case Z.write:return t.length!==5&&Q(`write must have 5 elements`),{kind:n,slot:r,clientSeq:Ip(t[2],`clientSeq`),basisVersion:Ip(t[3],`basisVersion`),ops:Bp(t[4])};case Z.intent:return t.length!==5&&Q(`intent must have 5 elements`),{kind:n,slot:r,clientSeq:Ip(t[2],`clientSeq`),intentToken:Ip(t[3],`intentToken`),input:t[4]};case Z.ack:return t.length!==4&&Q(`ack must have 4 elements`),{kind:n,slot:r,clientSeq:Ip(t[2],`clientSeq`),version:Ip(t[3],`version`)};case Z.reject:return t.length!==4&&Q(`reject must have 4 elements`),(typeof t[3]!=`object`||t[3]==null||Array.isArray(t[3]))&&Q(`reject error must be a map`),{kind:n,slot:r,clientSeq:Ip(t[2],`clientSeq`),error:t[3]};case Z.keyDict:return t.length!==3&&Q(`keyDict must have 3 elements`),{kind:n,slot:r,entries:Kp(t[2])};case Z.detach:return t.length!==3&&Q(`detach must have 3 elements`),t[2]!=null&&typeof t[2]!=`string`&&Q(`detach reason must be a string`),{kind:n,slot:r,reason:t[2]??void 0};case Z.clientCaps:return t.length!==3&&Q(`clientCaps must have 3 elements`),{kind:n,slot:r,features:Gp(t[2])};case Z.batch:{t.length!==3&&Q(`batch must have 3 elements`),Array.isArray(t[2])||Q(`batch payloads must be an array`);let e=[];for(let n of t[2]){n instanceof Uint8Array||Q(`batch payload must be bytes`);let t=Qp(n);t.kind===Z.batch&&Q(`batch may not nest`),e.push(t)}return{kind:n,slot:r,frames:e}}default:Q(`unknown frame kind ${n}`)}}var $p=new Set([`__proto__`,`constructor`,`prototype`]);function em(e){return typeof e==`string`&&$p.has(e)}function tm(e){return e.some(em)}var nm={replace:Fp.replace,add:Fp.add,remove:Fp.remove},rm={[Fp.replace]:`replace`,[Fp.add]:`add`,[Fp.remove]:`remove`};function im(e){return e.kind===`optional`?im(e.inner):e}function am(e,t){let n,r=e;for(let e of t){if(r!=null)n=typeof e==`string`?r[e]:void 0,r=void 0;else if(n!=null){let t=im(n);if(t.kind===`object`)n=t.entries[e];else if(t.kind===`record`)n=t.value;else return}if(n==null)return}return n}function om(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function sm(e,t){for(let n=1;n<t.length;n++){let r=am(e,t.slice(0,n));if(r!=null&&im(r).kind===`array`)return n}}function cm(e,t,n){let r=[],i=new Set;for(let a of e){let e=sm(n,a.path);if(e==null||e===a.path.length){r.push(a);continue}let o=a.path.slice(0,e),s=o.join(`\0`);i.has(s)||(i.add(s),r.push({op:`replace`,path:o,value:om(t,o)}))}return r}function lm(e,t,n){return e.map(e=>{let r=t.tokenizePath(e.path,n);return e.op===`remove`?[Fp.remove,r]:[nm[e.op],r,e.value]})}function um(e,t,n){return e.map(e=>{let r=t.detokenizePath(e[1],n);return e[0]===Fp.remove?{op:`remove`,path:r}:{op:rm[e[0]],path:r,value:e[2]}})}function dm(e){return e===`encrypted`?Ha.encrypted:Ha.authenticated}function fm(e,t){return t==null?e:e===`encrypted`||t===`encrypted`?`encrypted`:`authenticated`}function pm(e,t,n){let r=e.securityLevel;if(r==null)return;let i=dm(fm(t.security,n));if(!io(r,i))return kp.fromId(`insufficient_security`,{realmId:t.id,required:i,actual:r})}function mm(e,t,n=[]){if(e===t)return[];if(!hm(e)||!hm(t))return[{op:`replace`,path:[...n],value:t}];let r=[];for(let i of Object.keys(t))i in e?r.push(...mm(e[i],t[i],[...n,i])):r.push({op:`add`,path:[...n,i],value:t[i]});for(let i of Object.keys(e))i in t||r.push({op:`remove`,path:[...n,i]});return r}function hm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gm(e,t,n){if(typeof e==`function`)return e(t);switch(e.kind){case`serverOnly`:return`serverOnly`;case`serverChecked`:return n==null?!0:e.fn({...t,...n});case`all`:for(let r of e.conds){let e=gm(r,t,n);if(e!==!0)return e}return!0}}function _m(e){return e.kind===`optional`?_m(e.inner):e}function vm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}var ym=class extends Error{constructor(e){super(`subtree write expands past the ${e}-leaf limit`)}};function bm(e){let t=am(e.schemaRoot,e.path);if(t==null)throw Error(`expandWriteToLeaves: path leaves the schema (${e.path.join(`.`)})`);let n=[],r=t=>{if(n.length>=e.maxLeaves)throw new ym(e.maxLeaves);n.push(t)},i=(e,t,n,a)=>{let o=_m(e);if(o.kind===`object`){for(let[e,r]of Object.entries(o.entries))i(r,[...t,e],n?.[e],a?.[e]);return}if(o.kind===`record`){let e=new Set;if(typeof n==`object`&&n)for(let t of Object.keys(n))e.add(t);if(typeof a==`object`&&a)for(let t of Object.keys(a))e.add(t);for(let r of e)i(o.value,[...t,r],n?.[r],a?.[r]);return}r(t)},a=vm(e.state,e.path);return i(t,[...e.path],e.op===`remove`?void 0:e.value,a),n}function xm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Sm(e){let{realm:t,avatar:n,state:r,basisVersion:i}=e;for(let a of e.patches){let e=a.path,o=am(t.stateDef,e);if(o==null)return kp.fromId(`value_invalid`,{path:e.join(`.`),expected:`a schema path`});if(a.op!==`remove`){let n=jp(o,a.value);if(n!=null)return kp.fromId(`value_invalid`,{path:[...e,...n.path].join(`.`),expected:n.expected});for(let n=1;n<e.length;n++){let i=am(t.stateDef,e.slice(0,n));for(;i?.kind===`optional`;)i=i.inner;if(i?.kind!==`record`||i.maxKeys==null)continue;let a=xm(r,e.slice(0,n));if(!(typeof a!=`object`||!a||Array.isArray(a))&&!(e[n]in a)&&Object.keys(a).length>=i.maxKeys)return kp.fromId(`value_invalid`,{path:e.slice(0,n).join(`.`),expected:`a record with at most ${i.maxKeys} entries`})}}let s=bm({schemaRoot:t.stateDef,path:e,op:a.op,value:a.value,state:r,maxLeaves:1/0});for(let o of s){let s=t.ruleTrie.match(o);if(s==null)return kp.fromId(`unauthorized_coordinate`,{path:o.join(`.`)});let c=o.slice(e.length),l=gm(s.rule.alter,{avatar:n,params:s.params,prev:Cm(r,o),next:a.op===`remove`?void 0:Cm(a.value,c),state:r,basisVersion:i},void 0);if(l===`serverOnly`)return kp.fromId(`unauthorized_coordinate`,{path:o.join(`.`)});if(l!==!0)return l}}return!0}function Cm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function wm(e,t,n){let r;for(let i=0;i<t.length;i++){let a=t[i];if(a.op!==`remove`&&a.path.length>1)for(let o=1;o<a.path.length;o++){let s=a.path.slice(0,o);if(Tm(e,r??t.slice(0,i),s))continue;let c=o===1?void 0:am(n,s.slice(0,-1));if(c!=null&&Em(c).kind===`record`)break;let l=am(n,s);if(l==null)break;let u=Em(l).kind;if(u!==`object`&&u!==`record`)break;r??=t.slice(0,i),r.push({op:`add`,path:s,value:{}})}r?.push(a)}return r??t}function Tm(e,t,n){for(let e=t.length-1;e>=0;e--){let r=t[e];if(!(r.path.length>n.length)&&r.path.every((e,t)=>String(e)===String(n[t])))return r.op===`remove`?!1:Dm(r.value,n.slice(r.path.length))!==void 0}return Dm(e,n)!==void 0}function Em(e){return e.kind===`optional`?Em(e.inner):e}function Dm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Om(){let e=`pending`,t,n,r,i,a,o=()=>(r??=e===`confirmed`&&t!=null?Promise.resolve(t):e===`rejected`?Promise.reject(n):new Promise((e,t)=>{i=e,a=t}),r);return{handle:{get status(){return e},get error(){return n},then:(e,t)=>o().then(e,t)},confirm(n){e===`pending`&&(e=`confirmed`,t=n,i?.(n))},reject(t){e===`pending`&&(e=`rejected`,n=t,a?.(t))}}}gp();var km=256,Am=-2,jm=3,Mm=1e3;function Nm(e){return e.kind===Z.batch?e.frames.some(Nm):e.kind!==Z.reject}var Pm=1e4,Fm=25e3,Im=1e4;function Lm(e,t){let n=t.connection.coordinate,r=t.avatar.persistentId??n?.perId;if(r==null)throw Error(`connectRealm: no avatar identity — pass avatar.persistentId, or attach through a connection that carries the local coordinate (realmConnection(connector), with the connection returned by connectChannel).`);let i={type:t.avatar.type,persistentId:r,instanceId:t.avatar.instanceId??n?.insId??`default`},a=t.pendingExpiryMs??Pm,o=t.connection.slot,s=t.devtools,c=t.coalesce??(t.coalesceMs==null?void 0:{ms:t.coalesceMs}),l=c!=null&&c.ms>0?c.ms:0,u=c?.leading===!0&&l>0,d=new Cp({}),f=new Mp,p=new Set,m={},h=-1,g,_,v=!1,y=`connecting`,b,x=()=>g==null?`[realm:${e.id}]`:`[realm:${e.id}#${g.slice(0,8)}]`,ee=new Set,te=!1,S=e=>{if(y!==e){y=e,e===`live`&&(te=!0);for(let t of[...ee])t(e,{hasBeenLive:te});s?.onStatus?.(e,{hasBeenLive:te})}},C=[],ne=0,re=!1,ie=!1,ae,oe=Date.now(),se=0,ce,w=!1,T=0,E=new Set,le=new Set,D=e=>{s?.onDiagnostic?.(e);for(let t of[...le])t(e);if(t.onDiagnostic!=null){t.onDiagnostic(e);return}le.size>0||E.has(e.type)||(E.add(e.type),console.warn(`${x()} sync-health event "${e.type}"`,e))},ue=!1,de=e=>{if(t.onMutationRejected!=null){t.onMutationRejected(e);return}e.rolledBackPaths.length>0&&!ue&&(ue=!0,console.warn(`${x()} an optimistic ${e.kind} rolled back on [${e.rolledBackPaths.join(`, `)}] (${e.error.getIds().join(`, `)}) with no onMutationRejected handler — the change silently reverted. Wire onMutationRejected on connectRealm. Note: frame_too_stale is an UNKNOWN outcome (may have committed), not a definite reject.`))},fe=t.staleProbeAfterMs??Fm,O=t.probeReplyTimeoutMs??Im,pe=()=>{O<=0||(ce!=null&&clearTimeout(ce),ce=setTimeout(()=>{ce=void 0,y===`live`&&(oe>=se||(D({type:`probe_escalated`}),S(`connecting`),t.connection.requestReconnect?.()))},O),Na(ce))},me=()=>C.some(e=>e.isSystemAssert),he=.2,ge=null,k=null,_e=0,ve=e=>{e<0||(_e+=1,ge==null||k==null?(ge=e,k=0):(k+=he*(Math.abs(e-ge)-k),ge+=he*(e-ge)),s?.onStats?.({rttMs:ge,jitterMs:k,samples:_e}))},be=(e,t)=>{y!==`detached`&&(D({type:`resync`,reason:e,...t}),!(w&&Date.now()-T<1e4)&&ae?.isOpen()===!0&&ct({probe:!0}))},xe=new Map,Se=new Set,Ce=e=>{let t=m;for(let n of e){if(typeof t!=`object`||!t)return!1;t=t[n]}return t!=null},we=()=>{if(xe.size!==0&&!me())for(let[e,t]of[...xe]){if(Ce(t)){xe.delete(e),Se.delete(e);continue}D({type:`reown_missing`,path:t.join(`.`)}),Se.has(e)?(xe.delete(e),Se.delete(e)):ae?.isOpen()===!0&&y!==`detached`&&(Se.add(e),ct({probe:!0,forceFullHydrate:!0}))}},Te=0,Ee,De=()=>{Ee!=null&&(clearTimeout(Ee),Ee=void 0)},Oe=()=>{if(w=!1,Ee!=null)return;let e=Math.min(250*2**Te,5e3);Te+=1;let t=setTimeout(()=>{Ee=void 0,be(`frame_error`)},e);Na(t),Ee=t},ke=()=>{for(let e of p)e()},Ae=new Set,je={},Me=!1,Ne=!1,Pe=!0,Fe=!1,Ie=e=>e?.fullReplace===!0?`hydrate`:e?.confirmed==null?e?.cause??`rebase`:`confirm`,Le=e=>e==null?!1:e.fullReplace===!0||e.confirmed!=null?!0:e.authoritative===!0,Re=e=>{if(Me){Ne=!0,Ie(e)!==`confirm`&&(Pe=!1),Le(e)&&(Fe=!0);return}let t=m,n=[];for(let e of C)try{t=bp(t,e.patches)}catch{n.push(e)}if(n.length>0){C=C.filter(e=>!n.includes(e));for(let e of n)Be(e,kp.fromId(`frame_too_stale`,{basisVersion:e.basisVersion}))}ie=!0;try{d.replace(t)}finally{ie=!1}if(t!==je){let n=Ie(e),r=Le(e);if(s?.onFlush?.({cause:n,authoritative:r,confirmedVersion:h}),Ae.size>0){let i=e?.fullReplace===!0?[{op:`replace`,path:[],value:t}]:e?.confirmed??mm(je,t);if(i.length>0){let e={cause:n,authoritative:r,confirmedVersion:h};for(let t of[...Ae])t(i,e)}}}je=t,ke()},ze=t=>{let n=t.filter(e=>{if(e.op!==`remove`)return!0;let t=m;for(let n of e.path.slice(0,-1)){if(typeof t!=`object`||!t)return!1;t=t[n]}return typeof t==`object`&&!!t&&String(e.path[e.path.length-1])in t}),r=wm(m,n,e.stateDef);return m=bp(m,r),r},Be=(e,t)=>{e.expiryTimer!=null&&clearTimeout(e.expiryTimer);for(let n of e.handles)n.reject(t);s?.onMutation?.({type:`rejected`,clientSeq:e.clientSeq,kind:e.kind,intentName:e.intentName,durability:e.durability,systemAssert:e.isSystemAssert,errorIds:t.getIds(),rolledBackPaths:e.patches.map(e=>e.path.join(`.`))}),!(e.isSystemAssert&&t.getIds().includes(`frame_too_stale`))&&de({error:t,kind:e.kind,intentName:e.intentName,rolledBackPaths:e.patches.map(e=>e.path.join(`.`))})},Ve=(e,t)=>{e.expiryTimer!=null&&clearTimeout(e.expiryTimer),e.sentAt!=null&&ve(Date.now()-e.sentAt);for(let n of e.handles)n.confirm({version:t});s?.onMutation?.({type:`confirmed`,clientSeq:e.clientSeq,kind:e.kind,intentName:e.intentName,durability:e.durability,systemAssert:e.isSystemAssert,version:t})},A=e=>{e.durability!==`reassert`&&(e.expiryTimer=setTimeout(()=>{C.includes(e)&&(C=C.filter(t=>t!==e),Be(e,kp.fromId(`frame_too_stale`,{basisVersion:e.basisVersion})),Re())},a),Na(e.expiryTimer))},He=e=>{if(ae==null||!ae.isOpen())return;e.sentAt=Date.now();let t=e.buildFrame(e.clientSeq,e.basisVersion);s?.onFrame?.(`out`,e.kind,t.byteLength),ae.send(t)},Ue,We=()=>Ue??_?.maxPatchesPerFrame??1/0,Ge=(t,n,r,i,a,s)=>{let c={clientSeq:t,kind:`write`,patches:n,basisVersion:r,handles:i,buildFrame:(t,n)=>Jp({slot:o,clientSeq:t,basisVersion:n,ops:lm(Rm(c.patches),e.tokens)}),expiryTimer:void 0,openForMerge:!1,retries:a,durability:s};return c},Ke=(e,t,n)=>{e.expiryTimer!=null&&clearTimeout(e.expiryTimer);let r=[];for(let i=0;i<t.length;i+=n){let a=t.slice(i,i+n),o=i+n>=t.length;r.push(Ge(r.length===0?e.clientSeq:ne++,a,e.basisVersion,o?e.handles:[],e.retries,e.durability))}let i=C.indexOf(e);i>=0&&C.splice(i,1,...r);for(let e of r)A(e);return r},qe=e=>{if(e.kind!==`write`){He(e);return}let t=Rm(e.patches),n=We();if(t.length<=n){He(e);return}for(let r of Ke(e,t,n))He(r)},Je=()=>{re=!1;for(let e of[...C])e.openForMerge&&(e.openForMerge=!1,!w&&qe(e))},Ye,Xe=()=>{let e=setTimeout(()=>{Ye=void 0,C.some(e=>e.openForMerge)&&(Je(),Xe())},l);Na(e),Ye=e},Ze=()=>{re||(re=!0,!(u&&Ye!=null)&&(l>0?Na(setTimeout(Je,l)):queueMicrotask(Je)))},Qe=(e,t,n)=>{let r=Om();return r.reject(t),de({error:t,kind:e,intentName:n,rolledBackPaths:[]}),s?.onMutation?.({type:`rejected`,clientSeq:-1,kind:e,intentName:n,errorIds:t.getIds(),rolledBackPaths:[]}),r.handle},$e=(t,n)=>{let r=n?.durability,i=n?.flush===`immediate`;if(r===`reassert`){let e=C.filter(e=>e.durability===`reassert`).length;if(e>=km)return Qe(`write`,kp.fromId(`durable_backlog_overflow`,{pendingFrames:e}))}let a=Om();i&&Je();let c=i?void 0:C.find(e=>e.kind===`write`&&e.openForMerge&&e.durability===r);if(c!=null)return c.patches.push(...t),c.handles.push(a),Re({cause:`optimistic`}),Ze(),a.handle;let l={clientSeq:ne++,kind:`write`,patches:t,basisVersion:h,handles:[a],buildFrame:(t,n)=>Jp({slot:o,clientSeq:t,basisVersion:n,ops:lm(Rm(l.patches),e.tokens)}),expiryTimer:void 0,openForMerge:!0,retries:0,durability:r};return C.push(l),s?.onMutation?.({type:`created`,clientSeq:l.clientSeq,kind:`write`,durability:r}),A(l),Re({cause:`optimistic`}),i?(l.openForMerge=!1,w||qe(l)):u&&Ye==null?(Je(),Xe()):Ze(),a.handle},j=(t,n)=>{let r=d.state;if(h===-1){let n=kp.fromId(`write_before_hydrate`,{realmId:e.id});try{yp(r,e=>{t(e)})}catch(e){throw Error(n.message,{cause:e})}return Qe(`write`,n)}let a,[o,s]=yp(r,e=>{a=t(e)});if(s.length===0){if(typeof a==`object`&&a)throw Error(`[realm:${e.id}] realm.update(fn): the update function returned a value without modifying its draft. Updates are mutate-only — a returned state is ignored (unlike immer's produce). Mutate the draft instead.`);let t=Om();return t.confirm({version:h}),t.handle}let c=cm(s,o,e.stateDef),l=Sm({realm:e,patches:c,avatar:i,state:r,basisVersion:h});return l===!0?$e(c,n):Qe(`write`,l)},et=(t,n)=>{let r=e.intents[t];if(r==null)return Qe(`intent`,kp.fromId(`intent_unknown`,{intent:t}),t);let a=jp(r.input,n);if(a!=null)return Qe(`intent`,kp.fromId(`value_invalid`,{path:[t,...a.path].join(`.`),expected:a.expected}),t);Je();let c=[];if(r.optimistic!=null)try{let t=d.state,[a,o]=yp(t,e=>{r.optimistic?.({view:e,avatar:i,input:n})});c=cm(o,a,e.stateDef)}catch{c=[]}let l=Om(),u=e.intentNames.indexOf(t),f={clientSeq:ne++,kind:`intent`,intentName:t,patches:c,basisVersion:h,handles:[l],buildFrame:e=>Yp({slot:o,clientSeq:e,intentToken:u,input:n}),expiryTimer:void 0,openForMerge:!1,retries:0};return C.push(f),s?.onMutation?.({type:`created`,clientSeq:f.clientSeq,kind:`intent`,intentName:t}),A(f),c.length>0?Re({cause:`optimistic`}):ke(),w||He(f),l.handle},tt=(e,t)=>{if(e.kind!==`write`||!t.getIds().includes(`limits_exceeded`)||e.retries>=jm)return!1;let n=t.getContext(`limits_exceeded`),r=typeof n==`object`&&n&&`limit`in n?String(n.limit):``;if(r===`writeRatePerSecond`)return e.retries+=1,Na(setTimeout(()=>{C.includes(e)&&!w&&He(e)},Mm)),!0;if(r===`maxPatchesPerFrame`||r===`maxFrameBytes`){e.retries+=1;let t=Rm(e.patches);if(t.length<=1)return!1;Ue=Math.max(1,Math.floor(Math.min(We(),t.length)/2));for(let n of Ke(e,t,Ue))He(n);return!0}return!1},nt=()=>{let t=[],n=m;for(let e of C)if(e.isSystemAssert)try{n=bp(n,e.patches)}catch{}for(let r of C){if(r.isSystemAssert){t.push(r);continue}let a=r.kind===`intent`?!0:Sm({realm:e,patches:r.patches,avatar:i,state:m,basisVersion:h});if(a!==!0){Be(r,a);continue}if(r.kind===`write`){let e;try{e=bp(n,r.patches)}catch{Be(r,kp.fromId(`frame_too_stale`,{basisVersion:r.basisVersion}));continue}n=e}r.basisVersion=h,t.push(r)}C=t;for(let e of[...t])e.openForMerge||He(e)},rt=[],it=n=>{switch(n.kind){case Z.batch:{let e=Me;Me=!0,e||(Pe=!0,Fe=!1);let t=!1,r;try{for(let e of n.frames)try{it(e)}catch(e){t||(t=!0,r=e)}}finally{Me=e}if(!Me&&Ne&&(Ne=!1,Re({cause:Pe?`confirm`:`rebase`,authoritative:Fe})),t)throw r;return}case Z.hydrate:{if(f.load(n.keyDictSeed),rt.push(n.stateBlob),n.more)return;let r=zm(rt);rt=[];let i=h<0;m=ns(r),h=n.version,g=n.epoch,_={maxPatchesPerFrame:n.limits[0],maxFrameBytes:n.limits[1],writeRatePerSecond:n.limits[2]},Ue=void 0,ot(n.avatar),S(`live`),w&&ve(Date.now()-T),w=!1,!i&&e.transient.length>0&&t.assertOnAttach!=null&&!me()&&st(m),nt(),Re({fullReplace:!0}),t.assertOnAttach!=null&&!me()&&j(t.assertOnAttach),we();return}case Z.keyDict:f.load(n.entries);return;case Z.patches:{let t=n.fromVersion===h,r=n.toVersion===h;if(!t&&!r){w?D({type:`gap_dropped`,fromVersion:n.fromVersion,toVersion:n.toVersion,confirmedVersion:h}):be(`version_gap`,{fromVersion:n.fromVersion,toVersion:n.toVersion,confirmedVersion:h});return}let i=w;w=!1,i&&ve(Date.now()-T);let a=um(n.ops,e.tokens,e=>f.keyOf(e)).filter(e=>!tm(e.path)),o=C.length===0&&je===m,s=ze(a);h=n.toVersion,i&&(me()||st(m),nt()),y===`connecting`&&S(`live`),Re(o&&C.length===0?{confirmed:s}:{authoritative:!0}),we();return}case Z.ack:{let e=C.findIndex(e=>e.clientSeq===n.clientSeq);if(e<0)return;let[t]=C.splice(e,1);Ve(t,n.version),Re(),t.isSystemAssert&&we();return}case Z.reject:{let e=ye(n.error);if(n.clientSeq===-1){b=e,w=!1,S(`detached`);return}let t=C.findIndex(e=>e.clientSeq===n.clientSeq);if(t<0){D({type:`late_reject`,clientSeq:n.clientSeq,errorIds:e.getIds()});return}if(tt(C[t],e))return;let[r]=C.splice(t,1);if(Be(r,e),Re(),e.getIds().includes(`write_target_missing`)){for(let e of r.patches)if(e.path.length>1){let t=e.path.slice(0,-1);xe.set(JSON.stringify(t),t)}be(`write_target_missing`)}r.isSystemAssert&&we();return}case Z.detach:if(n.reason===`rehello`){y===`live`&&ct({probe:!0});return}w=!1,S(`detached`);return;default:return}},at=(e,t)=>{s?.onFrame?.(`in`,Np[e.kind]??String(e.kind),t??0);try{it(e)}catch(e){D({type:`frame_error`,error:e}),rt=[],Oe();return}Nm(e)&&(oe=Date.now(),Te=0,De(),ce!=null&&(clearTimeout(ce),ce=void 0))},ot=e=>{let[t,n,r]=e;t===i.type&&n===i.persistentId&&r===i.instanceId||v||(v=!0,console.warn(`${x()} identity mismatch — this client predicts as ${i.type}/${i.persistentId}/${i.instanceId} but the server resolved it as ${t}/${n}/${r} (review A.4.2). Prediction and view slicing run against DIFFERENT identities: owner-gated writes will pass locally and reject on the server. Fix the server's resolveAvatar/avatarType, or the avatar passed to connectRealm.`))},st=n=>{if(t.assertOnAttach==null||e.transient.length===0||h<0||ae==null||!ae.isOpen())return;let[r,i]=yp(n,e=>{t.assertOnAttach?.(e)});if(i.length===0)return;let a=cm(i,r,e.stateDef);if(a.length===0)return;C.some(e=>e.isSystemAssert)&&(C=C.filter(e=>!e.isSystemAssert));let s={clientSeq:Am,kind:`write`,patches:a,basisVersion:h,handles:[],buildFrame:(t,n)=>Jp({slot:o,clientSeq:t,basisVersion:n,ops:lm(Rm(a),e.tokens)}),expiryTimer:void 0,openForMerge:!1,retries:0,isSystemAssert:!0};C.unshift(s),Re({cause:`optimistic`})},ct=t=>{t?.probe===!0?(se=Date.now(),pe()):(S(`connecting`),b=void 0,f.clear()),w=!0,T=Date.now(),rt=[],st(d.state);let n=qp({slot:o,realmId:e.id,schemaHash:e.schemaHash,lastKnownVersion:t?.forceFullHydrate===!0?-1:h,epoch:g});s?.onFrame?.(`out`,`hello`,n.byteLength),ae?.send(n);let r=Zp({slot:o,features:[Pp.batch]});s?.onFrame?.(`out`,`clientCaps`,r.byteLength),ae?.send(r)},lt,ut=pm(t.connection,e,t.security);ut==null?(ae=t.connection.register({onFrame:at,onAttach:()=>ct(),onDetach:()=>{y!==`detached`&&S(`connecting`)}}),ae.isOpen()&&ct(),lt=t.connection.subscribeLinkEvents?.(e=>{e.type===`link_up`&&e.downForMs!=null&&D({type:`link_redialed`,downForMs:e.downForMs})})):(b=ut,S(`detached`),t.connection.release());let dt;if(ut==null&&fe>0&&(dt=setInterval(()=>{if(y!==`live`||ae?.isOpen()!==!0)return;let e=Date.now();e-oe<fe||e-se<fe||ct({probe:!0})},Math.max(1e3,Math.floor(fe/2))),Na(dt)),t.experimental_writeThroughStore===!0)d.listenToPatches(t=>{if(ie)return;let n=t.filter(e=>e.path.length>0);n.length!==0&&queueMicrotask(()=>{let t=cm(n,d.state,e.stateDef);if(t.length===0)return;let r=Sm({realm:e,patches:t,avatar:i,state:d.state,basisVersion:h});if(r!==!0){de({error:r,kind:`write`,rolledBackPaths:t.map(e=>e.path.join(`.`))}),Re();return}$e(t)})});else{let e=!1;d.listenToPatches(()=>{ie||e||(e=!0,console.warn(`${x()} realm.store was written directly. The store is a read projection — this change was never sent to the server and will vanish on the next incoming flush. Did you mean realm.update()? (Raw store write-through requires the experimental_writeThroughStore option.)`))})}let ft={store:d,update:j,intents:Object.fromEntries(e.intentNames.map(e=>[e,t=>et(e,t)])),pending:{get count(){return C.reduce((e,t)=>t.isSystemAssert?e:e+1,0)},has(e){return C.some(t=>!t.isSystemAssert&&t.patches.some(t=>t.path.join(`.`).startsWith(e)))},subscribe(e){return p.add(e),()=>p.delete(e)}},get status(){return y},get hasBeenLive(){return te},get version(){return h},get attachError(){return b},whenLive(e){return y===`live`?Promise.resolve():b==null?y===`detached`?Promise.reject(Error(`whenLive: the realm is detached`)):new Promise((t,n)=>{let r=e?.timeoutMs??1e4,i=()=>{clearTimeout(a),ee.delete(o)},a=setTimeout(()=>{i(),n(Error(`whenLive: the realm did not hydrate within ${r}ms`))},r),o=()=>{y===`live`?(i(),t()):(b!=null||y===`detached`)&&(i(),n(b??Error(`whenLive: the realm detached before going live`)))};ee.add(o)}):Promise.reject(b)},subscribeStatus(e){return ee.add(e),()=>ee.delete(e)},subscribeDiagnostics(e){return le.add(e),()=>le.delete(e)},listenToPatches(e){return Ae.add(e),()=>Ae.delete(e)},get stats(){return{rttMs:ge,jitterMs:k,samples:_e}},detach(){if(dt!=null&&clearInterval(dt),ce!=null&&clearTimeout(ce),Ye!=null&&(clearTimeout(Ye),Ye=void 0),lt?.(),De(),xe.clear(),Se.clear(),ae?.isOpen()===!0)try{let e=Xp({slot:o,reason:void 0});s?.onFrame?.(`out`,`detach`,e.byteLength),ae.send(e)}catch{}w=!1,S(`detached`),t.connection.release();for(let e of C.splice(0))Be(e,kp.fromId(`frame_too_stale`,{basisVersion:e.basisVersion}));Re()}};return s?.handleReady?.({handle:ft,realmId:e.id,slot:o,avatar:i,peer:t.connection.peerCoordinate?.envId}),ft}function Rm(e){let t=new Map;for(let n of e)t.set(n.path.join(` `),n);return[...t.values()]}function zm(e){if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}gp();var Bm=new WeakMap,Vm=5e3;function Hm(e){let t=Bm.get(e);if(t!=null)return t;let n=new Map,r=(e,t,n)=>{try{e.onFrame(t,n)}catch(e){console.error(`[realm] a realm slot handler threw while dispatching an inbound frame`,e)}},i=(e,t)=>{if(e.slot===255){for(let i of n.values())r(i,e,t);return}let i=n.get(e.slot);i!=null&&r(i,e,t)};return t={nextSlot:0,freeSlots:[],slots:n,port:e.registerProtocol({id:`realm`,prefixByte:Ns.realm,onFrame:e=>{let t;try{t=Qp(e)}catch{return}if(t.kind===Z.batch){let a=new Map;for(let e of t.frames){if(e.slot===255){i(e);continue}let t=a.get(e.slot);t==null?a.set(e.slot,[e]):t.push(e)}for(let[t,i]of a){let o=n.get(t);o!=null&&r(o,i.length===1?i[0]:{kind:Z.batch,slot:t,frames:i},a.size===1?e.byteLength:void 0)}return}i(t,e.byteLength)},onAttach:()=>{for(let e of n.values())e.onAttach()},onDetach:()=>{for(let e of n.values())e.onDetach()}})},Bm.set(e,t),t}function Um(e){let t=e instanceof lc,n=t?e:e.wireMux;if(n==null)throw Error(`realmConnection: this link has no frame-protocol mux — connect it via connectChannel (which creates one per connection) or pass a WireProtocolMux directly.`);let r=t?void 0:e.localCoordinate,i=t?void 0:e.peerClient,a=t?void 0:e.securityLevel,o=t?void 0:e.requestReconnect,s=t?void 0:e.addLinkEventListener?.bind(e),c=Hm(n),l=c.freeSlots.pop();if(l==null&&c.nextSlot>=255)throw Error(`realmConnection: slot space exhausted (max 254)`);let u=l??c.nextSlot++,d=!1;return{slot:u,coordinate:r,peerCoordinate:i,securityLevel:a,requestReconnect:o,subscribeLinkEvents:s,register(e){return c.slots.set(u,e),{send:e=>c.port.send(e),isOpen:()=>c.port.isOpen()}},release(){d||(d=!0,c.slots.delete(u),Na(setTimeout(()=>c.freeSlots.push(u),Vm)))}}}function Wm(){return{define:e=>e}}function Gm(){return{path(e){return{view:t=>({alter:n=>({pattern:e,view:t,alter:n})})}},everyone:{kind:`everyone`},serverOnly:{kind:`serverOnly`},avatarTypes:(...e)=>({kind:`avatarTypes`,types:e}),serverChecked:e=>({kind:`serverChecked`,fn:e}),all:(...e)=>({kind:`all`,conds:e})}}function Km(e){if(e.length===0)throw Error(`rule pattern may not be empty`);let t=e.split(`.`),n=[[]];return t.forEach((r,i)=>{let a=i===t.length-1;if(r.startsWith(`{`)&&r.endsWith(`}`)){let t=r.slice(1,-1).split(`,`).map(e=>e.trim());if(t.some(e=>e.length===0))throw Error(`rule pattern "${e}": empty name in brace group "${r}"`);n=n.flatMap(e=>t.map(t=>[...e,t]));return}if((r===`*`||r===`**`)&&!a)throw Error(`rule pattern "${e}": "${r}" is only valid as the final segment`);n=n.map(e=>[...e,r])}),n.map(t=>({source:e,segments:t.map(t=>{if(t===`*`)return{kind:`star`};if(t===`**`)return{kind:`deep`};if(t.startsWith(`$`)){let n=t.slice(1);if(n.length===0)throw Error(`rule pattern "${e}": bare "$" segment`);return{kind:`var`,name:n}}if(t.includes(`{`)||t.includes(`}`)||t.includes(`$`))throw Error(`rule pattern "${e}": malformed segment "${t}"`);return{kind:`lit`,name:t}})}))}function qm(e,t){for(let n of t)for(let t of Km(n)){let r=Zm({kind:`object`,entries:e},t.segments,0);if(r!=null)throw Error(`rule pattern "${n}" can never match: ${r}`)}}function Jm(e,t){let n=[];for(let r of t){let t=r.split(`.`);for(let e of t)if(e.length===0||/[$*{}]/.test(e))throw Error(`transient path "${r}" must be a concrete, wildcard-free path (no $var, *, ** or {a,b}); offending segment "${e}". Wildcard transient regions are not supported in v1.`);if(Ym({kind:`object`,entries:e},t,0)==null)throw Error(`transient path "${r}" does not resolve to any node in the realm schema.`);n.push(t)}return n}function Ym(e,t,n){if(n>=t.length)return e;let r=Xm(e);if(r.kind===`object`){let e=r.entries[t[n]];return e==null?void 0:Ym(e,t,n+1)}if(r.kind===`record`)return Ym(r.value,t,n+1)}function Xm(e){return e.kind===`optional`?Xm(e.inner):e}function Zm(e,t,n){if(n>=t.length)return;let r=Xm(e),i=t[n],a=Qm(t,n);if(r.kind===`object`){if(i.kind===`lit`){let e=r.entries[i.name];return e==null?`"${i.name}" is not a key of the object at ${a}`:Zm(e,t,n+1)}if(i.kind===`var`){let e=Object.values(r.entries);return e.length===0?`the object at ${a} has no keys`:e.some(e=>Zm(e,t,n+1)==null)?void 0:`no key of the object at ${a} admits the rest of the pattern`}return}if(r.kind===`record`)return i.kind===`lit`||i.kind===`var`?Zm(r.value,t,n+1):void 0;let o=r.kind===`array`?` (t.array is leaf-replace-only on the wire — rule it with the exact path, e.g. "${Qm(t,n,!0)}")`:``;return`it descends into the ${r.kind} wire-leaf at ${a}${o}`}function Qm(e,t,n=!1){let r=e.slice(0,t).map(e=>e.kind===`lit`?e.name:e.kind===`var`?`$${e.name}`:e.kind===`star`?`*`:`**`).join(`.`);return r.length===0?`the state root`:n?r:`"${r}"`}var $m=class{_root={};_patterns=[];constructor(e){for(let t of e){for(let e of Km(t.pattern))this._insert(e,t);this._patterns.push(t.pattern)}}get patterns(){return this._patterns}_insert(e,t){let n=[],r=this._root;for(let i=0;i<e.segments.length;i++){let a=e.segments[i];if(a.kind===`star`){if(r.star!=null)throw Error(`duplicate rule pattern at "${e.source}"`);r.star={rule:t,varNames:n};return}if(a.kind===`deep`){if(r.deep!=null)throw Error(`duplicate rule pattern at "${e.source}"`);r.deep={rule:t,varNames:n};return}if(a.kind===`var`){if(n[i]=a.name,r.var==null)r.var={name:a.name,node:{}};else if(r.var.name!==a.name)throw Error(`conflicting $var names at the same trie position: "$${r.var.name}" vs "$${a.name}" (${e.source})`);r=r.var.node;continue}r.lit??=new Map;let o=r.lit.get(a.name);o??(o={},r.lit.set(a.name,o)),r=o}if(r.exact!=null)throw Error(`duplicate rule pattern at "${e.source}"`);r.exact={rule:t,varNames:n}}match(e){let t=this._match(this._root,e,0);if(t==null)return;let n={};return t.varNames.forEach((t,r)=>{t!=null&&(n[t]=e[r])}),{rule:t.rule,params:n}}_match(e,t,n){if(n===t.length)return e.exact;let r=t[n],i=n===t.length-1,a=e.lit?.get(r);if(a!=null){let e=this._match(a,t,n+1);if(e!=null)return e}if(e.var!=null){let r=this._match(e.var.node,t,n+1);if(r!=null)return r}if(i&&e.star!=null)return e.star;if(e.deep!=null)return e.deep}};function eh(e){switch(e.kind){case`string`:return e.maxLength==null?e.kind:{k:`string`,max:e.maxLength};case`number`:return e.min==null&&e.max==null&&e.integer!==!0?e.kind:{k:`number`,...e.min==null?{}:{min:e.min},...e.max==null?{}:{max:e.max},...e.integer===!0?{int:!0}:{}};case`boolean`:return e.kind;case`literal`:return{k:`lit`,v:e.value};case`union`:return{k:`u`,o:e.options.map(e=>JSON.stringify(eh(e))).sort()};case`optional`:return{k:`opt`,i:eh(e.inner)};case`object`:return{k:`obj`,e:Object.keys(e.entries).sort().map(t=>[t,eh(e.entries[t])])};case`record`:{let t={k:`rec`,id:e.keyVar,v:eh(e.value)};return e.maxKeys==null?t:{...t,max:e.maxKeys}}case`array`:{let t={k:`arr`,i:eh(e.item)};return e.maxItems==null?t:{...t,max:e.maxItems}}case`standard`:return e.hashTag==null?{k:`std`}:{k:`std`,tag:e.hashTag}}}function th(e){let t=Object.keys(e.state).sort();return JSON.stringify({id:e.id,state:t.map(t=>[t,eh(e.state[t])]),clients:[...e.avatarTypes].sort(),intents:[...e.intents].sort((e,t)=>e[0]<t[0]?-1:1).map(([e,t])=>[e,eh(t)]),rules:[...e.rulePatterns].sort()})}function nh(e){return vi(th(e))}function rh(e){return e.kind===`optional`?rh(e.inner):e}function ih(e){let t=rh(e);return t.kind===`object`?ah(t.entries):t.kind===`record`?{toToken:new Map,toName:[],children:new Map,recordChild:ih(t.value)}:`leaf`}function ah(e){let t=Object.keys(e).sort(),n={toToken:new Map,toName:[],children:new Map};return t.forEach((t,r)=>{n.toToken.set(t,r),n.toName.push(t),n.children.set(t,ih(e[t]))}),n}var oh=class{_root;constructor(e){this._root=ah(e)}tokenizePath(e,t){let n=[],r=this._root;for(let i of e){if(r===`leaf`||r==null)throw Error(`tokenizePath: path descends past a leaf at "${i}" (${e.join(`.`)})`);if(r===`record`)throw Error(`tokenizePath: internal record level error at "${i}"`);if(r.recordChild!=null){n.push(t?.(i)??i),r=r.recordChild;continue}let a=r.toToken.get(i);if(a==null)throw Error(`tokenizePath: unknown key "${i}" in path ${e.join(`.`)}`);n.push(a),r=r.children.get(i)??`leaf`}return n}detokenizePath(e,t){let n=[],r=this._root;for(let i of e){if(r===`leaf`||r===`record`||r==null)throw Error(`detokenizePath: path descends past a leaf (${e.join(`.`)})`);if(r.recordChild!=null){if(typeof i==`number`){let e=t?.(i);if(e==null)throw Error(`detokenizePath: unknown interned key id ${i}`);n.push(e)}else n.push(i);r=r.recordChild;continue}if(typeof i!=`number`||i<0||i>=r.toName.length)throw Error(`detokenizePath: invalid token "${i}" (${e.join(`.`)})`);let a=r.toName[i];n.push(a),r=r.children.get(a)??`leaf`}return n}rootTokenNames(){return this._root.toName}};function sh(e){let t=e.rules(Gm());qm(e.state,t.map(e=>e.pattern));let n=new $m(t),r=Jm(e.state,e.transient??[]),i=e.intents?.(Wm())??{},a=Object.keys(i).sort(),o=Object.keys(e.avatars).sort(),s=new oh(e.state),c=nh({id:e.id,state:e.state,avatarTypes:o,intents:a.map(e=>[e,i[e].input]),rulePatterns:t.map(e=>e.pattern)});return{id:e.id,security:e.security??`authenticated`,avatarTypes:o,stateDef:e.state,rules:t,ruleTrie:n,intents:i,intentNames:a,tokens:s,transient:r,schemaHash:c}}function ch(e,t){if(t!=null){if(!Number.isSafeInteger(t)||t<0)throw Error(`t: ${e} must be a non-negative safe integer, got ${t}`);return t}}function lh(e){let{min:t,max:n,integer:r}=e;if(t!=null&&!Number.isFinite(t))throw Error(`t: number min must be finite, got ${t}`);if(n!=null&&!Number.isFinite(n))throw Error(`t: number max must be finite, got ${n}`);if(t!=null&&n!=null&&t>n)throw Error(`t: number min (${t}) must be <= max (${n})`);if(r!=null&&typeof r!=`boolean`)throw Error(`t: number integer must be a boolean`);return{...t==null?{}:{min:t},...n==null?{}:{max:n},...r===!0?{integer:!0}:{}}}function uh(...e){let t=e.flatMap(e=>Array.isArray(e)?e:[e]);if(t.length<2)throw Error(`t.union needs at least 2 options, got ${t.length}`);return{kind:`union`,options:t}}var $={string(e={}){let t=ch(`string maxLength`,e.maxLength);return{kind:`string`,...t==null?{}:{maxLength:t}}},number(e={}){return{kind:`number`,...lh(e)}},boolean(){return{kind:`boolean`}},literal(e){return{kind:`literal`,value:e}},union:uh,optional(e){return{kind:`optional`,inner:e}},object(e){return{kind:`object`,entries:e}},id(e){return{kind:`id`,varName:e}},record(e,t,n={}){let r=ch(`record maxKeys`,n.maxKeys);return{kind:`record`,keyVar:e.varName,value:t,...r==null?{}:{maxKeys:r}}},array(e,t={}){let n=ch(`array maxItems`,t.maxItems);return{kind:`array`,item:e,...n==null?{}:{maxItems:n}}},schema(e,t={}){if(t.hashTag!=null&&(typeof t.hashTag!=`string`||t.hashTag===``))throw Error(`t.schema: hashTag must be a non-empty string`);return{kind:`standard`,schema:e,...t.hashTag==null?{}:{hashTag:t.hashTag}}},serverContext(){return{kind:`serverContext`}}};gp();var dh=`/wire`,fh=`/logs`,ph=`/bootstrap`,mh=`/ticket`,hh=`commander-auth.`,gh=9e5;function _h(e){return{"~standard":{version:1,vendor:`nice-commander`,validate:t=>{let n=e(t);return typeof n==`string`?{issues:[{message:n}]}:{value:n}}}}}function vh(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!=`string`||n===``)return null;t.push(n)}return t}function yh(e){return typeof e!=`object`||!e||Array.isArray(e)?null:{...e}}function bh(e){let t=yh(e);if(t==null)return`expected an object`;let n=vh(t.ids);if(n==null)return`ids: expected an array of process ids`;let r=t.wait;if(r!=null&&typeof r!=`boolean`)return`wait: expected a boolean`;let i=t.staggerMs;if(i!=null&&(typeof i!=`number`||i<0))return`staggerMs: expected a non-negative number`;let a={ids:n};return r!=null&&(a.wait=r),i!=null&&(a.staggerMs=i),a}function xh(e){let t=yh(e);if(t==null)return`expected an object`;let n=yh(t.processes);if(n==null)return`processes: expected an object keyed by process id`;let r={};for(let[e,t]of Object.entries(n)){let n=yh(t);if(n==null)return`processes[${JSON.stringify(e)}]: expected an object`;let i={};for(let[t,r]of Object.entries(n)){if(r!==null&&typeof r!=`string`)return`processes[${JSON.stringify(e)}][${JSON.stringify(t)}]: expected string | null`;i[t]=r}r[e]=i}let i=t.clear;if(i==null)return{processes:r};let a=vh(i);return a==null?`clear: expected an array of process ids`:{processes:r,clear:a}}function Sh(e){let t=yh(e);if(t==null||t.ok!==!0)return`expected { ok: true }`;let n=t.warnings;return!Array.isArray(n)||!n.every(e=>typeof e==`string`)?`warnings: expected an array of strings`:{ok:!0,warnings:n}}function Ch(e){let t=yh(e);if(t==null)return`expected an object`;let n=vh(t.ids);return n==null?`ids: expected an array of process ids`:{ids:n}}function wh(e){return yh(e)==null?`expected an object`:{}}function Th(e){let t=yh(e);if(t==null)return`expected an object`;let n=t.errors;return t.ok===!0?typeof t.applied==`boolean`?typeof t.configRevisionHash==`string`?!Array.isArray(n)||!n.every(e=>typeof e==`string`)?`errors: expected an array of strings`:{ok:!0,applied:t.applied,configRevisionHash:t.configRevisionHash,errors:n}:`configRevisionHash: expected a string`:`applied: expected a boolean`:`expected { ok: true }`}var Eh=new Set([`ready`,`spawned`,`already-running`,`blocked`,`failed`,`succeeded`,`stopped`,`already-stopped`]);function Dh(e){return typeof e==`string`&&Eh.has(e)}function Oh(e){let t=yh(e);if(t==null)return`expected an object`;let{results:n,warnings:r}=t;if(!Array.isArray(n)||!Array.isArray(r))return`expected { results, warnings }`;let i=[];for(let e of n){let t=yh(e);if(t==null)return`results: expected objects`;let{id:n,outcome:r,reason:a}=t;if(typeof n!=`string`||!Dh(r))return`results: malformed entry`;if(a!=null&&typeof a!=`string`)return`results: reason must be a string`;i.push(a==null?{id:n,outcome:r}:{id:n,outcome:r,reason:a})}let a=[];for(let e of r){if(typeof e!=`string`)return`warnings: expected strings`;a.push(e)}return{results:i,warnings:a}}function kh(e){let t=Oh(e);return typeof t==`string`?null:t}var Ah=_u({domain:`commander`}).createChildDomain({domain:`control`,actions:{ports:hl().input({schema:_h(ar)}).output({schema:_h(or)}),start:hl().input({schema:_h(bh)}).output({schema:_h(Oh)}),stop:hl().input({schema:_h(Ch)}).output({schema:_h(Oh)}),restart:hl().input({schema:_h(bh)}).output({schema:_h(Oh)}),setEnv:hl().input({schema:_h(xh)}).output({schema:_h(Sh)}),reloadConfig:hl().input({schema:_h(wh)}).output({schema:_h(Th)}),shutdown:hl().input({schema:_h(wh)}).output({schema:_h(e=>e!=null&&e.ok===!0?{ok:!0}:`expected { ok: true }`)})}}),jh=ad({toAcceptor:[Ah],toConnector:[]}),Mh=sh({id:`commander_status`,avatars:{viewer:{persistentId:$.string()}},state:{generation:$.number(),configName:$.string(),configRevisionHash:$.string(),configError:$.array($.string()),processes:$.record($.id(`processId`),$.object({kind:$.string(),state:$.string(),pid:$.optional($.number()),startedAt:$.optional($.number()),sawOutputAt:$.optional($.number()),lastTask:$.optional($.object({outcome:$.string(),reason:$.optional($.string()),timedOut:$.boolean(),endedAt:$.number(),durationMs:$.optional($.number())})),recentRuns:$.array($.object({startedAt:$.number(),endedAt:$.optional($.number()),outcome:$.optional($.union($.literal(`succeeded`),$.literal(`failed`),$.literal(`stopped`),$.literal(`crashed`),$.literal(`timedOut`)))})),restarts:$.number(),lastExit:$.optional($.object({code:$.optional($.number()),signal:$.optional($.string()),expected:$.boolean()})),stale:$.boolean(),removed:$.boolean(),envDrift:$.boolean(),blockedBy:$.optional($.string()),degradedBy:$.array($.string()),unreadyReason:$.optional($.string()),capability:$.optional($.object({treeMechanism:$.string(),degraded:$.boolean(),notes:$.array($.string())})),tags:$.record($.id(`tag`),$.string()),detail:$.object({command:$.string(),cwd:$.string(),dependsOn:$.array($.string()),ready:$.optional($.string()),timeoutMs:$.optional($.number()),endpoints:$.array($.object({name:$.string(),protocol:$.string(),host:$.string(),port:$.number(),ownership:$.string(),url:$.optional($.string())})),envVars:$.array($.object({name:$.string(),description:$.optional($.string()),secret:$.boolean(),required:$.boolean(),values:$.optional($.array($.string())),source:$.string(),value:$.optional($.string())}))})})),groups:$.record($.id(`groupName`),$.object({members:$.array($.string())}))},rules:e=>[e.path(`**`).view(e.everyone).alter(e.serverOnly)]});async function Nh(e,t,n){let r;e.connect().catch(e=>{r=e});try{await t.whenLive({timeoutMs:n})}catch(e){throw t.attachError??r??e}}var Ph=3*6e4,Fh=null,Ih=null;function Lh(){return`tab-${crypto.randomUUID()}`}async function Rh(){let e=Fh;if(e!=null&&Date.now()-e.mintedAt<Ph)return e.token;if(Ih==null){let e=zh();Ih=e;let t=()=>{Ih===e&&(Ih=null)};e.then(t,t)}return Ih}async function zh(){let e=await fetch(ph,{credentials:`omit`,cache:`no-store`});if(!e.ok)throw Error(`bootstrap failed (${e.status})`);let t=(await e.json()).capability;if(typeof t!=`string`||t===``)throw Error(`bootstrap returned no capability`);return Fh={token:t,mintedAt:Date.now()},t}function Bh(e){let t=e,n=!1,r=()=>{t!=null||n||(n=!0,Vh().then(e=>{t=e,n=!1},()=>{n=!1}))};return{peek:()=>(r(),t),take:()=>{let e=t;return t=null,r(),e}}}async function Vh(){let e=await Hh(await Rh());if(e!=null)return e;Fh=null;let t=await Hh(await Rh());if(t==null)throw Error(`ticket refused (401) even with a fresh capability`);return t}async function Hh(e){let t=await fetch(mh,{method:`POST`,credentials:`omit`,cache:`no-store`,headers:{authorization:`Bearer ${e}`}});if(t.status===401)return null;if(!t.ok)throw Error(`ticket refused (${t.status})`);let n=(await t.json()).ticket;if(typeof n!=`string`||n===``)throw Error(`no ticket issued`);return n}function Uh(e){return`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${e}`}async function Wh(){let e=Bh(await Vh()),t=new iu(Ra.env(`commander_web`).withPersistentId(Lh())),n=cd(t,jh,{peer:Ra.env(`commander_daemon`),storage:new ja({methods:Ma(new Map)}),ephemeralIdentity:!0,securityLevel:Ha.authenticated,defaultTimeout:gh,keepLinkAlive:!0,transports:[{carrier:dd(()=>e.peek()==null?null:{url:Uh(dh)},{createWebSocket:t=>new WebSocket(t,[`${hh}${e.take()}`])})}]}),r=Lm(Mh,{onDiagnostic:()=>{},avatar:{type:`viewer`},connection:Um(n),assertOnAttach:()=>{}});try{await Nh(n,r,15e3)}catch(e){throw r.detach(),n.dispose(),e}return{realm:r,control:async(e,n)=>{let r={ids:[...n]},i=e===`start`?Ah.actionForId(`start`).request({...r,wait:!1}):e===`stop`?Ah.actionForId(`stop`).request(r):Ah.actionForId(`restart`).request(r),a=await(await t.handleActionPayload(i)).waitForResultPayload();if(!a.result.ok)throw Error(`"${e}" was refused by the daemon`);let o=kh(a.result.output);if(o==null)throw Error(`"${e}" answered in a shape this build cannot read`);return o},ports:async e=>{let n=Ah.actionForId(`ports`).request(e),r=await(await t.handleActionPayload(n)).waitForResultPayload();if(!r.result.ok)throw Error(`the daemon refused port inspection`);let i=or(r.result.output);if(typeof i==`string`)throw Error(i);return i},setEnv:async(e,n)=>{let r=Ah.actionForId(`setEnv`).request({processes:{[e]:n}}),i=await(await t.handleActionPayload(r)).waitForResultPayload();if(!i.result.ok)throw Error(`the daemon refused the env change`);let a=i.result.output.warnings;return Array.isArray(a)?a.filter(e=>typeof e==`string`):[]},shutdown:async()=>{let e=Ah.actionForId(`shutdown`).request({}),n=await(await t.handleActionPayload(e)).waitForResultPayload();if(!n.result.ok)throw Error(`the daemon refused shutdown`);let r=n.result.output;if(typeof r!=`object`||!r||!(`ok`in r)||r.ok!==!0)throw Error(`shutdown answered in a shape this build cannot read`)},dispose:()=>{r.detach(),n.dispose()}}}async function Gh(){let e=await Vh();return new WebSocket(Uh(fh),[`${hh}${e}`])}var Kh=18,qh=500,Jh=250,Yh=[];function Xh({view:e,runningIds:t,clearSignal:n,onSelectProc:r}){let i=Zn(e),[a,o]=(0,d.useState)({key:i,rows:Yh}),[s,c]=(0,d.useState)(`connecting`),[l,u]=(0,d.useState)(!0),[f,p]=(0,d.useState)(``),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),b=xn(location.hostname),x=(0,d.useRef)(null),ee=(0,d.useRef)(0),te=(0,d.useRef)({socket:null,view:e,key:i,cursor:{},awaitingResnap:!0}),S=(0,d.useRef)(Yh),C=(0,d.useCallback)(e=>{S.current=e,o({key:te.current.key,rows:e})},[]),ne=a.key===i?a.rows:Yh,re=(0,d.useCallback)(e=>{let t=e.socket;t==null||t.readyState!==t.OPEN||(e.awaitingResnap=e.cursor.seq==null&&e.cursor.s==null,t.send($n(e.view,e.cursor)))},[]),ie=(0,d.useCallback)((e,t)=>{if(t.k===`search-result`){h(e=>e==null||e.id!==t.id?e:{...e,rows:t.entries.map(Qn),complete:t.complete,scanned:t.scanned,running:!1});return}if(e.awaitingResnap){if(!tr(e.view,t))return;e.awaitingResnap=!1}let n=Xn(e.view,S.current,e.cursor,t);n!=null&&(e.cursor=n.cursor,C(n.rows))},[C]);(0,d.useEffect)(()=>{let e=te.current,t=null,n=!1,r=r=>{n||(e.socket=null,c(r),t=setTimeout(i,qh))},i=()=>{Gh().then(t=>{if(n){t.close();return}e.socket=t,t.addEventListener(`open`,()=>{c(`live`),re(e)}),t.addEventListener(`message`,t=>{let n=Pn(String(t.data));n!=null&&ie(e,n)}),t.addEventListener(`close`,()=>r(`reconnecting`))},()=>r(`reconnecting`))};return i(),()=>{n=!0,t!=null&&clearTimeout(t),e.socket?.close(),e.socket=null}},[ie,re]),(0,d.useEffect)(()=>{let t=te.current,n=t.view;if(t.view=e,t.key===i)return;t.key=i,t.cursor={},t.awaitingResnap=!0,C(Yh),u(!0);let r=t.socket;r==null||r.readyState!==r.OPEN||(r.send(er(n)),re(t))},[e,i,C,re]);let ae=(0,d.useRef)(null);ae.current=m,(0,d.useEffect)(()=>{let e=f.trim();if(e===``){h(null);return}if(s!==`live`)return;let t=setTimeout(()=>{let t=te.current,n=t.socket;if(n==null||n.readyState!==n.OPEN)return;ee.current+=1;let r=`s${ee.current}`,i=ae.current;i!=null&&n.send(JSON.stringify({k:`search-cancel`,id:i.id})),h({id:r,key:t.key,rows:Yh,complete:!0,scanned:0,running:!0}),n.send(JSON.stringify({k:`search`,id:r,query:e,...t.view.kind===`proc`?{procs:[t.view.id]}:t.view.procs==null?{}:{procs:t.view.procs}}))},Jh);return()=>clearTimeout(t)},[f,s,i]);let oe=m!=null&&m.key===i?m:null,se=oe==null?ne:oe.rows,ce=Xt({count:se.length,getScrollElement:()=>x.current,estimateSize:()=>Kh,overscan:20}),w=(0,d.useRef)(t);w.current=t;let T=(0,d.useCallback)(()=>{let e=te.current;C(ir(e.view,S.current,{keepProcs:w.current,now:Date.now()}).rows)},[C]),E=(0,d.useRef)(0);(0,d.useEffect)(()=>{n<=E.current||(E.current=n,T())},[n,T]),(0,d.useEffect)(()=>{ce.measure()},[v,ce]),(0,d.useEffect)(()=>{oe==null&&l&&se.length>0&&ce.scrollToIndex(se.length-1)},[se.length,l,oe,ce]);let le=ce.getVirtualItems(),D=(0,d.useMemo)(()=>le.map(e=>({item:e,row:se[e.index]})),[le,se]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`nc-chrome`,style:{alignItems:`center`,borderBottom:`1px solid ${M.border}`,display:`flex`,flexWrap:`wrap`,gap:10,padding:`8px 14px`},children:[(0,j.jsx)(`span`,{style:{color:M.textEmphasis,fontSize:13,minWidth:0,overflowWrap:`anywhere`},children:e.kind===`proc`?e.id:`merged timeline`}),(0,j.jsx)(`span`,{style:{color:M.textMuted,fontSize:11},children:oe==null?`${ne.length} lines`:Qh(oe)}),s!==`live`&&(0,j.jsx)(`span`,{role:`status`,style:{color:M.warning,fontSize:11},children:s===`connecting`?`opening the log lane…`:`log lane dropped — retrying…`}),(0,j.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`search history…`,"aria-label":`search log history`,style:{background:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:6,color:M.text,fontSize:12,padding:`3px 8px`}}),(0,j.jsx)(`span`,{style:{flex:1}}),(0,j.jsx)(`button`,{type:`button`,"aria-pressed":g,title:`prefix every line with its timestamp`,onClick:()=>_(e=>!e),style:$h(g),children:`ts`}),(0,j.jsx)(`button`,{type:`button`,"aria-pressed":v,title:`wrap long lines`,onClick:()=>y(e=>!e),style:$h(v),children:`wrap`}),(0,j.jsx)(`button`,{type:`button`,title:`clear the pane — keeps the last lines of what is still running; history stays searchable (c)`,onClick:T,style:$h(!1),children:`clear`}),(0,j.jsxs)(`label`,{style:{color:M.textMeta,fontSize:12},children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:l,disabled:oe!=null,onChange:e=>u(e.target.checked)}),` `,`follow`]})]}),(0,j.jsxs)(`div`,{ref:x,onScroll:e=>{let t=e.currentTarget,n=t.scrollHeight-t.scrollTop-t.clientHeight<Kh*2;u(n)},style:{flex:1,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:12,overflow:`auto`,padding:`6px 0`},children:[se.length===0&&(0,j.jsx)(`div`,{style:{color:M.textMuted,fontSize:12,padding:`2px 12px`},children:Zh(s,e,oe)}),(0,j.jsx)(`div`,{style:{height:ce.getTotalSize(),position:`relative`,width:`100%`},children:D.map(({item:e,row:t})=>t==null?null:(0,j.jsxs)(`div`,{"data-index":e.index,ref:v?ce.measureElement:void 0,style:{...v?{}:{height:Kh},left:0,position:`absolute`,top:0,transform:`translateY(${e.start}px)`,whiteSpace:v?`pre-wrap`:`pre`,width:`100%`,paddingLeft:12,color:t.gap?M.warning:void 0},children:[g&&t.ts!=null&&(0,j.jsxs)(`span`,{style:{color:M.textMuted},children:[eg(t.ts),` `]}),t.prefix!=null&&(0,j.jsxs)(`button`,{type:`button`,"aria-label":`show only ${t.prefix} in the log`,title:`show only ${t.prefix}`,onClick:()=>r(t.prefix??``),style:{background:`transparent`,border:`none`,color:nn(t.prefix),cursor:`pointer`,font:`inherit`,padding:0},children:[t.prefix,` │`,` `]}),t.gap?t.text:qn(Hn(t.text),{allowLoopback:b}).map((e,t)=>e.kind===`link`?(0,j.jsx)(`a`,{className:`nc-log-link`,href:e.href,target:`_blank`,rel:`noreferrer`,children:e.pieces.map((e,t)=>(0,j.jsx)(`span`,{style:e.style,children:e.text},t))},t):(0,j.jsx)(`span`,{style:e.style,children:e.text},t))]},t.key))})]})]})}function Zh(e,t,n){return e===`connecting`?`opening the log lane…`:e===`reconnecting`?`the log lane dropped — retrying, then the tail resumes`:n==null?t.kind===`proc`?`${t.id} has printed nothing yet`:t.procs!=null&&t.procs.length===0?`nothing matches the current filter`:`no output yet`:n.running?`searching the history…`:`no matches in the daemon's history`}function Qh(e){let t=`${e.rows.length} match${e.rows.length===1?``:`es`}`;return e.running?`${t} · searching…`:e.complete?t:`${t} · stopped after ${e.scanned} lines`}function $h(e){return{background:e?M.surfaceHeader:`transparent`,border:`1px solid ${M.border}`,borderRadius:5,color:e?M.textEmphasis:M.textMeta,cursor:`pointer`,fontSize:11,padding:`1px 7px`}}function eg(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var tg={background:`transparent`,border:`1px solid ${M.border}`,borderRadius:5,color:M.textMeta,cursor:`pointer`,fontSize:11,padding:`3px 8px`};function ng({id:e,ports:t,retry:n}){let[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(null);async function f(n,r){c(!0),u(null),o(null);try{i(await t({ids:[e],...n?{token:n,force:r}:{}}))}catch(e){u(e.message)}finally{c(!1)}}return(0,j.jsxs)(`div`,{style:{marginTop:6,fontSize:12},children:[(0,j.jsx)(`button`,{style:tg,type:`button`,disabled:s,onClick:()=>void f(),children:s?`checking ports…`:`inspect ports`}),l&&(0,j.jsx)(`div`,{role:`alert`,style:{color:M.error},children:l}),r&&(0,j.jsxs)(`section`,{"aria-label":`port owners for ${e}`,style:{overflowWrap:`anywhere`},children:[r.warnings.map(e=>(0,j.jsx)(`div`,{role:`alert`,style:{color:M.warning},children:e},e)),r.listeners.length===0&&(0,j.jsxs)(`div`,{children:[`No visible listeners found.`,` `,(0,j.jsx)(`button`,{style:tg,type:`button`,disabled:s,onClick:()=>void n(),children:`retry start`})]}),r.listeners.map(e=>(0,j.jsxs)(`div`,{style:{borderTop:`1px solid ${M.border}`,paddingTop:6,marginTop:6},children:[(0,j.jsxs)(`div`,{children:[e.endpoint,` · `,e.host,`:`,e.port,` · PID `,e.pid]}),(0,j.jsxs)(`div`,{children:[e.command,` · parent PID `,e.ppid??`unknown`]}),(0,j.jsxs)(`div`,{children:[`cwd: `,e.cwd??`unavailable`]}),(0,j.jsxs)(`div`,{children:[`identity: `,e.startStamp??`unavailable`]}),e.refusal?(0,j.jsx)(`div`,{children:e.refusal}):(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`button`,{style:tg,type:`button`,disabled:s,onClick:()=>o({listener:e,force:!1}),children:[`stop PID `,e.pid]}),` `,(0,j.jsxs)(`button`,{style:tg,type:`button`,disabled:s,onClick:()=>o({listener:e,force:!0}),children:[`force kill PID `,e.pid]})]})]},`${e.endpoint}:${e.pid}`))]}),a&&(0,j.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Confirm listener termination`,style:{marginTop:8,color:M.warning,overflowWrap:`anywhere`},children:[(0,j.jsxs)(`p`,{children:[a.force?`Force kill`:`Stop`,` PID `,a.listener.pid,` (`,a.listener.command,`) holding `,a.listener.host,`:`,a.listener.port,`? This may affect other applications using this process.`,a.force?` Force kill does not allow cleanup.`:` Sends SIGTERM.`]}),(0,j.jsxs)(`button`,{style:tg,type:`button`,onClick:()=>void f(a.listener.token,a.force),children:[`confirm `,a.force?`force kill`:`stop`]}),` `,(0,j.jsx)(`button`,{style:tg,type:`button`,onClick:()=>o(null),children:`cancel`})]})]})}function rg(e,t){let n=[],r=new Set([e]),i=(e,a)=>{for(let o of t[e]?.detail.dependsOn??[])r.has(o)||(r.add(o),n.push({id:o,depth:a,missing:t[o]==null}),i(o,a+1))};i(e,1);let a=[],o=new Set([e]),s=(e,n)=>{for(let[r,i]of Object.entries(t))!i.detail.dependsOn.includes(e)||o.has(r)||(o.add(r),a.push({id:r,depth:n,missing:!1}),s(r,n+1))};return s(e,1),n.length===0&&a.length===0?null:{needs:n,neededBy:a}}function ig({rows:e,processes:t,selected:n,onSelect:r,act:i,setEnv:a,ports:o}){return e.length===0?(0,j.jsx)(`div`,{style:{color:M.textMuted,padding:8},children:`no processes match this filter`}):(0,j.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.map(e=>(0,j.jsx)(ag,{row:e,processes:t,selected:n.has(e.id),onSelect:r,act:i,setEnv:a,ports:o},e.id))})}function ag({row:e,processes:t,selected:n,onSelect:r,act:i,setEnv:a,ports:o}){let[s,c]=(0,d.useState)(!1),{node:l}=e,u=l.startedAt!=null&&dn(l.state)?gg(Date.now()-l.startedAt):null,f=!dn(l.state)&&l.lastTask!=null?l.lastTask:null,p=rg(e.id,t);return(0,j.jsxs)(`div`,{"data-process-card":e.id,className:`nc-row`,"data-selected":n,"data-outcome":un(l).indicator,style:{background:n?M.surfaceSelected:M.surface,border:`1px solid ${n?M.system:M.border}`,borderRadius:8,padding:`7px 12px`,position:`relative`},children:[(0,j.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,flexWrap:`wrap`,gap:8,minWidth:0},children:[(0,j.jsx)(og,{id:e.id,deps:p,processes:t,row:e,selected:n,onSelect:r}),e.chips.length>0&&(0,j.jsxs)(`span`,{title:e.chips.join(`
|
|
20
|
+
`),style:{background:tn(M.warning,12),border:`1px solid ${tn(M.warning,35)}`,borderRadius:4,color:M.warning,cursor:`default`,flex:`0 0 auto`,fontSize:10,padding:`0 5px`},children:[`⚠ `,e.chips.length]}),e.stickyOverrides.length>0&&(0,j.jsx)(`span`,{title:`sticky: ${e.stickyOverrides.join(`, `)} — applies to every start until cleared`,style:{background:tn(M.warning,12),border:`1px solid ${tn(M.warning,35)}`,borderRadius:4,color:M.warning,flex:`0 0 auto`,fontSize:10,padding:`0 5px`},children:e.stickyOverrides.length===1?`1 sticky env override`:`${e.stickyOverrides.length} sticky env overrides`})]}),(u!=null||f!=null)&&(0,j.jsxs)(`div`,{style:{color:M.textMuted,fontSize:11,marginTop:2,whiteSpace:`nowrap`},children:[u!=null&&(0,j.jsxs)(j.Fragment,{children:[`up `,u]}),f!=null&&(0,j.jsxs)(j.Fragment,{children:[f.outcome,f.durationMs==null?``:` in ${gg(f.durationMs)}`,` · ${gg(Date.now()-f.endedAt)} ago`]})]}),(0,j.jsxs)(`span`,{className:`nc-row-actions`,style:{background:n?M.surfaceSelected:M.surface,borderRadius:6,display:`flex`,gap:4,paddingLeft:8,position:`absolute`,right:7,top:6,zIndex:2},children:[[`start`,`restart`,`stop`].map(t=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>void i(t,[e.id]),style:pg,children:t},t)),(0,j.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),style:pg,children:s?`less`:`detail`})]}),e.stickyOverrides.length>0&&(0,j.jsx)(`div`,{style:{marginTop:4},children:(0,j.jsx)(`button`,{type:`button`,title:`clear ${e.stickyOverrides.join(`, `)} — back to the config's values`,onClick:()=>void a(e.id,Object.fromEntries(e.stickyOverrides.map(e=>[e,null]))),style:{...pg,color:M.warning,fontSize:10,padding:`1px 6px`},children:`clear all`})}),(0,j.jsx)(cg,{row:e}),(s||!dn(l.state))&&l.detail.endpoints.some(e=>e.ownership===`exclusive`)&&(0,j.jsx)(ng,{id:e.id,ports:o,retry:()=>i(`start`,[e.id])}),s&&(0,j.jsxs)(j.Fragment,{children:[e.chips.length>0&&(0,j.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginTop:6},children:e.chips.map(e=>(0,j.jsx)(`span`,{style:{background:tn(M.warning,12),border:`1px solid ${tn(M.warning,35)}`,borderRadius:4,color:M.warning,fontSize:11,padding:`1px 6px`},children:e},e))}),(0,j.jsx)(lg,{row:e}),(0,j.jsx)(ug,{row:e,setEnv:a})]})]})}function og({id:e,deps:t,processes:n,row:r,selected:i,onSelect:a}){let o=(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e),style:{alignItems:`center`,background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,display:`flex`,flex:`0 1 auto`,gap:8,minWidth:0,overflow:`hidden`,padding:0,textAlign:`left`},children:[(0,j.jsx)(Tn,{node:r.node}),(0,j.jsx)(`span`,{style:{color:M.textEmphasis,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),t!=null&&(0,j.jsx)(`span`,{"aria-hidden":`true`,style:{color:M.textMuted,fontSize:10},title:`has a dependency tree — hover to see it`,children:`⬦`}),(0,j.jsx)(`span`,{style:{color:M.textMeta,fontSize:12},children:un(r.node).label}),(0,j.jsx)(`span`,{style:{color:M.textMuted,fontSize:11},children:r.node.kind})]});return t==null?o:(0,j.jsx)(it,{config:{title:`${e} — dependency tree`,content:(0,j.jsx)(sg,{deps:t,processes:n,onSelect:a}),align:`edge`,maxWidth:320},children:o})}function sg({deps:e,processes:t,onSelect:n}){let r=e=>e.map(e=>(0,j.jsx)(`div`,{style:{paddingLeft:(e.depth-1)*12},children:e.missing?(0,j.jsxs)(`span`,{style:{color:M.textMuted,fontSize:11},children:[e.id,` (not in config)`]}):(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),title:`select ${e.id}`,style:{alignItems:`center`,background:`transparent`,border:`none`,color:M.text,cursor:`pointer`,display:`flex`,fontSize:11,gap:6,padding:`1px 0`},children:[t[e.id]&&(0,j.jsx)(Tn,{node:t[e.id],compact:!0}),e.id]})},e.id));return(0,j.jsxs)(`div`,{children:[e.needs.length>0&&(0,j.jsxs)(`div`,{style:{marginBottom:e.neededBy.length>0?6:0},children:[(0,j.jsx)(`div`,{style:{color:M.textMuted,fontSize:10,marginBottom:2},children:`needs`}),r(e.needs)]}),e.neededBy.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{style:{color:M.textMuted,fontSize:10,marginBottom:2},children:`needed by`}),r(e.neededBy)]})]})}function cg({row:e}){let t=e.node.detail.timeoutMs,n=e.node.startedAt;if(e.node.kind!==`task`||t==null||n==null||!dn(e.node.state))return(0,j.jsx)(j.Fragment,{});let r=Math.min(1,(Date.now()-n)/t);return(0,j.jsx)(`div`,{role:`progressbar`,"aria-label":`elapsed ${gg(Date.now()-n)} of ${gg(t)} cap`,"aria-valuenow":Math.round(r*100),"aria-valuemin":0,"aria-valuemax":100,style:{background:M.surfaceHeader,borderRadius:2,height:3,marginTop:5,overflow:`hidden`},children:(0,j.jsx)(`div`,{style:{background:r>.8?M.warning:M.system,height:`100%`,width:`${r*100}%`}})})}function lg({row:e}){let t=xn(location.hostname),n=bn(e.node,t);return n.length===0?(0,j.jsx)(j.Fragment,{}):(0,j.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:6},children:n.map(e=>e.href==null?(0,j.jsxs)(`span`,{style:hg,title:e.remote?`bound on the daemon's machine — forward the port to reach it from here`:void 0,children:[e.label,e.remote?` (remote)`:``]},e.name):(0,j.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,style:{...hg,color:M.system},children:[e.label,` ↗`]},e.name))})}function ug({row:e,setEnv:t}){let{detail:n}=e.node;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`dl`,{style:{display:`grid`,fontSize:11,gap:`2px 8px`,gridTemplateColumns:`auto minmax(0, 1fr)`,margin:`8px 0 0`},children:[e.node.pid!=null&&(0,j.jsx)(fg,{label:`pid`,value:String(e.node.pid)}),(0,j.jsx)(fg,{label:`run`,value:n.command}),(0,j.jsx)(fg,{label:`cwd`,value:n.cwd}),n.ready!=null&&(0,j.jsx)(fg,{label:`ready`,value:n.ready}),n.dependsOn.length>0&&(0,j.jsx)(fg,{label:`needs`,value:n.dependsOn.join(`, `)})]}),n.envVars.length>0&&(0,j.jsx)(dg,{row:e,setEnv:t})]})}function dg({row:e,setEnv:t}){let[n,r]=(0,d.useState)({}),[i,a]=(0,d.useState)(!1),o=e.node.detail.envVars,s=Object.keys(n).length>0,c=async()=>{a(!0);try{await t(e.id,n),r({})}finally{a(!1)}};return(0,j.jsxs)(`div`,{style:{borderTop:`1px solid ${M.border}`,marginTop:8,paddingTop:8},children:[(0,j.jsx)(`div`,{style:{color:M.textMuted,fontSize:11,marginBottom:6},children:`env`}),(0,j.jsx)(`div`,{style:{display:`grid`,gap:6},children:o.map(i=>(0,j.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,j.jsxs)(`label`,{htmlFor:`env-${e.id}-${i.name}`,style:{color:M.textMeta,flex:`0 0 40%`,fontSize:11},title:i.description,children:[i.name,i.required&&(0,j.jsx)(`span`,{style:{color:M.error},children:` *`}),i.source===`override`&&(0,j.jsx)(`span`,{title:`sticky override — applies to every start until cleared`,style:{background:tn(M.warning,12),border:`1px solid ${tn(M.warning,35)}`,borderRadius:4,color:M.warning,fontSize:10,marginLeft:6,padding:`0px 5px`},children:`sticky`})]}),i.values==null?(0,j.jsx)(`input`,{id:`env-${e.id}-${i.name}`,type:i.secret?`password`:`text`,value:n[i.name]??(i.secret?``:i.value??``),placeholder:i.secret&&i.source!==`unset`?`•••• set`:i.source,onChange:e=>r(t=>({...t,[i.name]:e.target.value})),style:mg}):(0,j.jsx)(`select`,{id:`env-${e.id}-${i.name}`,value:n[i.name]??i.value??``,onChange:e=>r(t=>({...t,[i.name]:e.target.value})),style:mg,children:i.values.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}),(0,j.jsx)(`button`,{type:`button`,disabled:i.source!==`override`,title:`drop the override, back to the config's value`,onClick:()=>void t(e.id,{[i.name]:null}),style:{...pg,opacity:i.source===`override`?1:.35},children:`clear`})]},i.name))}),(0,j.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:8,marginTop:8},children:[(0,j.jsx)(`button`,{type:`button`,disabled:!s||i,onClick:()=>void c(),style:pg,children:i?`saving…`:`save`}),(0,j.jsx)(`span`,{style:{color:M.textMuted,fontSize:10},children:`sticky — applies to every start until cleared`})]})]})}function fg({label:e,value:t}){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`dt`,{style:{color:M.textMuted},children:e}),(0,j.jsx)(`dd`,{style:{color:M.textMeta,margin:0,overflowWrap:`anywhere`},children:t})]})}var pg={background:`transparent`,border:`1px solid ${M.border}`,borderRadius:5,color:M.textMeta,cursor:`pointer`,fontSize:11,padding:`1px 8px`},mg={background:M.surfaceSection,border:`1px solid ${M.border}`,borderRadius:4,color:M.textEmphasis,flex:1,fontSize:11,minWidth:0,padding:`2px 5px`},hg={background:M.surfaceSection,border:`1px solid ${M.borderStrong}`,borderRadius:4,color:M.textMeta,fontSize:11,padding:`1px 6px`,textDecoration:`none`,maxWidth:`100%`,overflowWrap:`anywhere`};function gg(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${(e/36e5).toFixed(1)}h`}var _g=`nice-commander:scheme`;function vg(){try{let e=localStorage.getItem(_g);return e===`dark`||e===`light`||e===`system`?e:null}catch{return null}}function yg(e){try{localStorage.setItem(_g,e)}catch{}}var bg=`nice-commander:rail-width`;function xg(e){return Math.min(780,Math.max(300,Math.round(e)))}function Sg(){try{let e=localStorage.getItem(bg),t=e==null?NaN:Number(e);return Number.isFinite(t)?xg(t):440}catch{return 440}}function Cg(e){try{localStorage.setItem(bg,String(e))}catch{}}var wg=30*6e4,Tg={succeeded:M.success,stopped:M.textMuted,failed:M.error,crashed:M.error,timedOut:M.error};function Eg(e,t,n,r){let i=e.endedAt??n;if(i<t||e.startedAt>n)return null;let a=Math.max(e.startedAt,t),o=Math.min(i,n);return{left:(a-t)/r,width:Math.max(0,o-a)/r,live:e.endedAt==null,...e.outcome==null?{}:{outcome:e.outcome},startedAt:e.startedAt,...e.endedAt==null?{}:{endedAt:e.endedAt}}}function Dg(e,t,n=wg){let r=t-n,i=[];for(let[a,o]of Object.entries(e)){let e=o.recentRuns.map(e=>Eg(e,r,t,n)).filter(e=>e!=null);if(e.length===0)continue;let s=e.some(e=>e.live),c=0;for(let t of e)c=Math.max(c,t.endedAt??t.startedAt);i.push({id:a,live:s,activityAt:c,segments:e})}return i.sort((e,t)=>e.live===t.live?t.activityAt-e.activityAt:e.live?-1:1)}function Og(e){let t=e.filter(e=>e.live).length,n=e.reduce((e,t)=>e+t.segments.length,0);return`${t} live · ${n} run${n===1?``:`s`} in window`}var kg=6e4;function Ag(e,t){let n=new Date(e.startedAt),r=String(n.getHours()).padStart(2,`0`),i=String(n.getMinutes()).padStart(2,`0`),a=(e.endedAt??t)-e.startedAt,o=[`started ${r}:${i}`,jg(a)];return e.live?o.push(`running`):e.outcome!=null&&o.push(e.outcome),o.join(` · `)}function jg(e){if(e<kg)return`${Math.max(1,Math.round(e/1e3))}s`;let t=Math.floor(e/kg),n=Math.round(e%kg/1e3);return t<60?n===0?`${t}m`:`${t}m ${n}s`:`${Math.floor(t/60)}h ${t%60}m`}var Mg=1e3,Ng=[30,20,10],Pg=.4;function Fg({processes:e,selected:t,onToggle:n}){let[r,i]=(0,d.useState)(()=>Date.now()),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(new Set);(0,d.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),Mg);return()=>clearInterval(e)},[]);let l=(0,d.useMemo)(()=>Dg(e,r),[e,r]),u=(0,d.useMemo)(()=>l.filter(e=>e.live||!s.has(e.id)),[l,s]),f=l.length-l.filter(e=>e.live).length;return(0,j.jsxs)(`section`,{"aria-label":`run timeline, last 30 minutes`,className:`nc-chrome nc-timeline-float`,children:[(0,j.jsxs)(`div`,{style:{alignItems:`baseline`,display:`flex`,gap:8},children:[(0,j.jsx)(`span`,{className:`nc-section-title`,style:{marginBottom:0},children:`timeline`}),(0,j.jsx)(`span`,{style:{color:M.textMuted,fontSize:11},children:l.length===0?`no runs in the last 30 min`:Og(l)}),(0,j.jsx)(`span`,{style:{flex:1}}),f>0&&!a&&(0,j.jsx)(`button`,{type:`button`,title:`dismiss every ended run from the strip`,onClick:()=>c(e=>{let t=new Set(e);for(let e of l)e.live||t.add(e.id);return t}),style:Rg,children:`clear ended`}),(0,j.jsx)(`button`,{type:`button`,"aria-expanded":!a,title:a?`expand the timeline`:`collapse the timeline`,onClick:()=>o(e=>!e),style:Rg,children:a?`▸`:`▾`})]}),!a&&l.length>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,style:{display:`flex`,color:M.textMuted,fontSize:9,marginBottom:2},children:[(0,j.jsx)(`span`,{style:{flex:`0 0 148px`}}),(0,j.jsxs)(`span`,{style:{flex:1,display:`flex`,justifyContent:`space-between`},children:[Ng.map(e=>(0,j.jsxs)(`span`,{children:[`−`,e,`m`]},e)),(0,j.jsx)(`span`,{children:`now`})]})]}),(0,j.jsx)(`div`,{style:{maxHeight:176,overflowY:`auto`},children:u.map(e=>(0,j.jsx)(Ig,{row:e,now:r,selected:t.has(e.id),onToggle:n,onDismiss:e=>c(t=>{let n=new Set(t);return n.add(e),n})},e.id))})]})]})}function Ig({row:e,now:t,selected:n,onToggle:r,onDismiss:i}){return(0,j.jsxs)(`div`,{"data-timeline-row":e.id,style:{alignItems:`center`,borderRadius:4,display:`flex`,gap:6,height:20,...n?{background:tn(M.system,10),outline:`1px solid ${tn(M.system,45)}`}:{}},children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),title:n?`${e.id} — selected; click to release`:e.id,"aria-pressed":n,style:{background:`transparent`,border:`none`,color:n?M.textEmphasis:nn(e.id),cursor:`pointer`,flex:`0 0 140px`,fontSize:11,fontWeight:n?600:400,minWidth:0,overflow:`hidden`,padding:0,textAlign:`left`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[n?`› `:``,e.id]}),(0,j.jsx)(`div`,{style:{background:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:4,flex:1,height:12,minWidth:0,position:`relative`},children:e.segments.map(i=>(0,j.jsx)(Lg,{id:e.id,segment:i,now:t,selected:n,onToggle:r},i.startedAt))}),!e.live&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`remove ${e.id} from the timeline`,title:`dismiss this finished process from the strip (a fresh run brings it back)`,onClick:()=>i(e.id),style:Rg,children:`×`})]})}function Lg({id:e,segment:t,now:n,selected:r,onToggle:i}){let a=Math.max(t.width*100,Pg);return(0,j.jsx)(it,{config:{title:e,content:Ag(t,n),align:`edge`},children:(0,j.jsx)(`span`,{className:t.live?`nc-run-live`:void 0,"data-run-of":e,"data-run-outcome":t.live?`live`:t.outcome??`unknown`,onClick:()=>i(e),style:{background:t.live?void 0:Tg[t.outcome??`stopped`],borderRadius:3,bottom:1,cursor:`pointer`,display:`block`,left:`${t.left*100}%`,opacity:t.live?.95:r?1:.75,outline:r?`1px solid ${tn(M.system,60)}`:void 0,overflow:`hidden`,position:`absolute`,top:1,width:`${a}%`}})})}var Rg={background:`transparent`,border:`none`,color:M.textMuted,cursor:`pointer`,fontSize:11,padding:`0 4px`};function zg({rows:e,tags:t,onToggle:n,onClear:r}){let i=(0,d.useMemo)(()=>gn(e),[e]);return i.length===0?(0,j.jsx)(j.Fragment,{}):(0,j.jsxs)(`section`,{"aria-label":`tags`,style:{marginBottom:10},children:[(0,j.jsxs)(`div`,{style:{alignItems:`baseline`,display:`flex`,gap:8,marginBottom:4},children:[(0,j.jsx)(`span`,{className:`nc-section-title`,children:`tags`}),t.length>0&&(0,j.jsxs)(`button`,{type:`button`,onClick:r,title:`clear ${t.join(`, `)}`,style:{background:`transparent`,border:`none`,color:M.textMuted,cursor:`pointer`,fontSize:11,padding:0},children:[`× clear `,t.length]})]}),(0,j.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,maxHeight:160,overflowY:`auto`},children:i.map(e=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{style:{color:M.textMuted,fontSize:10,letterSpacing:.4,marginBottom:3,overflow:`hidden`,textOverflow:`ellipsis`,textTransform:`uppercase`,whiteSpace:`nowrap`},title:e.key,children:e.key}),(0,j.jsx)(`span`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:e.values.map(r=>{let i=`${e.key}=${r}`,a=t.includes(i);return(0,j.jsx)(`button`,{type:`button`,"aria-pressed":a,title:i,onClick:()=>n(i),style:{background:a?M.system:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:999,color:a?M.void:M.textMeta,cursor:`pointer`,fontSize:11,padding:`1px 9px`,maxWidth:`100%`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r},r)})})]},e.key))})]})}function Bg(e){let t=new URLSearchParams(e.startsWith(`#`)?e.slice(1):e),n={},r=t.get(`sel`);r!=null&&r!==``&&(n.selected=r.split(`,`).filter(Boolean));let i=t.get(`group`);i!=null&&i!==``&&(n.group=i);let a=t.get(`q`);a!=null&&a!==``&&(n.q=a);let o=t.get(`tags`);return o!=null&&o!==``&&(n.tags=o.split(`,`).filter(Boolean)),n}function Vg(e){let t=new URLSearchParams;e.selected!=null&&e.selected.length>0&&t.set(`sel`,e.selected.join(`,`)),e.group!=null&&e.group!==``&&t.set(`group`,e.group),e.q!=null&&e.q!==``&&t.set(`q`,e.q),e.tags!=null&&e.tags.length>0&&t.set(`tags`,e.tags.join(`,`));let n=t.toString();return n===``?``:`#${n}`}function Hg(){let[e,t]=(0,d.useState)({kind:`connecting`}),[n,r]=(0,d.useState)(null),[i]=(0,d.useState)(()=>Bg(location.hash)),[a,o]=(0,d.useState)(i.tags??[]),[s,c]=(0,d.useState)(i.q??``),[l,u]=(0,d.useState)(i.selected??[]),[f,p]=(0,d.useState)(i.group??null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(null),[v,y]=(0,d.useState)(0),[b,x]=(0,d.useState)({status:`connecting`,hasBeenLive:!1}),[ee,te]=(0,d.useState)(!1),[S,C]=(0,d.useState)(!1),ne=(0,d.useRef)(!1),[re,ie]=(0,d.useState)(()=>{let e=document.documentElement.getAttribute(we);return e===`light`||e===`system`?e:`dark`}),[ae,oe]=(0,d.useState)(Sg),se=(0,d.useRef)(null);(0,d.useEffect)(()=>{se.current?.style.setProperty(`--nc-rail-w`,`${ae}px`)},[ae]);let ce=(0,d.useRef)(null),w=(0,d.useRef)([]),T=(0,d.useRef)(null),E=(0,d.useRef)([]),le=(0,d.useRef)(null),D=(0,d.useRef)(!1),ue=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=!1,n=null;return Wh().then(i=>{if(e){i.dispose();return}n=i,t({kind:`live`,session:i}),r(i.realm.store.state),i.realm.store.subscribe(()=>r({...i.realm.store.state})),x({status:i.realm.status,hasBeenLive:i.realm.hasBeenLive}),i.realm.subscribeStatus((e,t)=>x({status:e,hasBeenLive:t.hasBeenLive}))},n=>{e||t({kind:`lost`,message:n.message})}),()=>{e=!0,n?.dispose()}},[]);let[de,fe]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>fe(Date.now()),5e3);return()=>clearInterval(e)},[]),(0,d.useEffect)(()=>{let e=n?.configName;e!=null&&(document.title=`${e} · nice-commander`)},[n?.configName]);let O=(0,d.useMemo)(()=>n==null?[]:mn(n,de),[n,de]),pe=(0,d.useMemo)(()=>{if(f==null)return O;let e=n?.groups[f]?.members;return e==null?O:hn(O,e)},[O,n,f]),me=(0,d.useMemo)(()=>yn(pe,a,s),[pe,a,s]),he=(0,d.useMemo)(()=>new Set(O.filter(e=>dn(e.node.state)).map(e=>e.id)),[O]);(0,d.useEffect)(()=>{f!=null&&n!=null&&n.groups[f]==null&&p(null)},[n,f]);let ge=(0,d.useMemo)(()=>l.length===1?{kind:`proc`,id:l[0]}:l.length>1?{kind:`merged`,procs:[...l].sort()}:{kind:`merged`,procs:a.length>0||s.trim()!==``||f!=null?me.map(e=>e.id).sort():null},[l,a,s,me,f]),k=(0,d.useCallback)(async(t,n)=>{if(!(e.kind!==`live`||ne.current||n.length===0)){h(t),_(null);try{let{results:r,warnings:i}=await e.session.control(t,n),a=r.filter(e=>e.outcome===`failed`||e.outcome===`blocked`),o=t===`start`?r.filter(e=>e.outcome===`spawned`):[],s=[o.length>0?`${t}: ${r.length} process(es), ${o.length} running — the grid shows progress`:`${t}: ${r.length} process(es)`,...a.map(e=>`✗ ${e.id} — ${e.outcome}${e.reason==null?``:`: ${e.reason}`}`),...i.map(e=>`⚠ ${e}`)];_(s.join(`
|
|
21
|
+
`))}catch(e){_(`${t} failed: ${e.message}`)}finally{h(null)}}},[e]),_e=async()=>{if(!(e.kind!==`live`||ne.current)){ne.current=!0,h(`shutdown`),_(null);try{await e.session.shutdown(),C(!1),t({kind:`shutdown`}),e.session.dispose()}catch(e){C(!1),_(`shutdown failed: ${e.message}`),ne.current=!1}finally{h(null)}}},ve=(0,d.useCallback)(async(t,n)=>{if(!(e.kind!==`live`||ne.current)){_(null);try{let r=await e.session.setEnv(t,n);_(r.length>0?r.map(e=>`⚠ ${e}`).join(`
|
|
22
|
+
`):`${t}: saved — sticky until cleared, and it applies on the next start`)}catch(e){_(`env change failed: ${e.message}`)}}},[e]);w.current=l,T.current=f;let ye=(0,d.useMemo)(()=>new Set(l),[l]),be=(0,d.useCallback)(e=>u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]);if(E.current=me.map(e=>e.id),le.current=n,D.current=ee||S,ue.current=k,(0,d.useEffect)(()=>{let e=Vg({...l.length>0?{selected:l}:{},...f==null?{}:{group:f},...s.trim()===``?{}:{q:s},...a.length>0?{tags:a}:{}});history.replaceState(null,``,e===``?location.pathname:e)},[l,f,s,a]),(0,d.useEffect)(()=>{let e=e=>{if(ne.current||D.current)return;let t=e.target,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable;if(e.key===`Escape`){if(n)t.blur();else if(D.current)return;else w.current.length>0?u([]):p(null);return}if(!(n||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`/`){e.preventDefault(),ce.current?.focus();return}if(e.key===`?`){te(!0);return}if(e.key===`c`){y(e=>e+1);return}if(e.key===`g`){let e=Object.keys(le.current?.groups??{});if(e.length===0)return;let t=T.current,n=(t==null?-1:e.indexOf(t))+1;p(n>=e.length?null:e[n]??null);return}if(e.key>=`1`&&e.key<=`9`){let t=E.current[Number(e.key)-1];t!=null&&be(t);return}w.current.length!==0&&(e.key===`r`&&ue.current?.(`restart`,[...w.current]),e.key===`s`&&ue.current?.(`stop`,[...w.current]),e.key===`u`&&ue.current?.(`start`,[...w.current]))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[be]),e.kind===`shutdown`)return(0,j.jsx)(qg,{children:(0,j.jsxs)(`div`,{role:`status`,style:{textAlign:`center`,padding:24},children:[(0,j.jsx)(`strong`,{children:`Shutdown accepted`}),(0,j.jsx)(`p`,{children:`The daemon is stopping all managed processes and will exit when cleanup finishes.`}),(0,j.jsxs)(`p`,{children:[`You can close this tab. Run `,(0,j.jsx)(`code`,{children:`nice-commander ui`}),` to start it again.`]})]})});if(e.kind===`connecting`)return(0,j.jsx)(qg,{children:`connecting…`});if(e.kind===`lost`)return(0,j.jsxs)(qg,{children:[`could not reach the daemon — `,e.message]});if(n==null)return(0,j.jsx)(qg,{children:`waiting for the status realm…`});let xe=me.map(e=>e.id),Se=O.filter(e=>e.node.stale&&!e.node.removed).map(e=>e.id);return(0,j.jsxs)(`div`,{className:`nc-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,j.jsxs)(`header`,{className:`nc-chrome nc-header`,style:{display:`flex`,alignItems:`center`,gap:12,padding:`10px 16px`,borderBottom:`1px solid ${M.border}`,flexWrap:`wrap`},children:[(0,j.jsx)(`strong`,{style:{color:M.textEmphasis},children:n?.configName??`nice-commander`}),(0,j.jsxs)(`span`,{style:{color:M.textMuted,fontSize:12},children:[`generation `,n.generation,` · revision `,n.configRevisionHash.slice(0,8)]}),(0,j.jsx)(`input`,{ref:ce,value:s,onChange:e=>c(e.target.value),placeholder:`filter ids… (/)`,"aria-label":`filter ids`,style:{background:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:6,color:M.text,padding:`4px 8px`}}),(0,j.jsx)(`span`,{style:{flex:1}}),(0,j.jsx)(Wg,{link:b}),(0,j.jsxs)(`button`,{type:`button`,title:`colour scheme: dark → light → system (persisted for this browser)`,onClick:()=>{let e=re===`dark`?`light`:re===`light`?`system`:`dark`;ie(e),document.documentElement.setAttribute(we,e),document.documentElement.setAttribute(Te,`persisted`),yg(e)},style:Gg,children:[`theme: `,re]}),(0,j.jsx)(`button`,{type:`button`,title:`keyboard shortcuts`,onClick:()=>te(!0),style:Gg,children:`keys`}),[`start`,`restart`,`stop`].map(e=>(0,j.jsxs)(`button`,{type:`button`,disabled:m!=null||xe.length===0,onClick:()=>void k(e,xe),style:{background:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:6,color:M.text,cursor:m==null?`pointer`:`wait`,padding:`4px 12px`},children:[e,` `,xe.length]},e)),(0,j.jsx)(`button`,{type:`button`,disabled:m!=null||b.status!==`live`,onClick:()=>C(!0),title:`Shut down this daemon and all its managed processes, including hidden tasks`,style:{...Gg,color:M.error},children:`shutdown daemon`})]}),(a.length>0||s.trim()!==``)&&(0,j.jsxs)(`div`,{style:{color:M.textMeta,fontSize:11,padding:`4px 14px`},children:[`selection (`,xe.length,`): `,xe.join(`, `)||`nothing matches`]}),n.configError.length>0&&(0,j.jsxs)(Jg,{tone:M.error,children:[`config reload failed — the last good config is still live:`,n.configError.map(e=>(0,j.jsxs)(`div`,{children:[`· `,e]},e))]}),g!=null&&(0,j.jsx)(Jg,{tone:M.warning,children:g}),Se.length>0&&(0,j.jsx)(Jg,{tone:M.warning,children:(0,j.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:10},children:[(0,j.jsxs)(`span`,{children:[Se.length,` process`,Se.length===1?``:`es`,` running an old config revision: `,Se.join(`, `)]}),(0,j.jsx)(`span`,{style:{flex:1}}),(0,j.jsxs)(`button`,{type:`button`,disabled:m!=null,onClick:()=>void k(`restart`,Se),style:Gg,children:[`restart `,Se.length,` stale`]})]})}),(0,j.jsxs)(`div`,{className:`nc-main`,children:[(0,j.jsxs)(`div`,{className:`nc-rail`,ref:se,children:[(0,j.jsx)(wn,{rows:me}),(0,j.jsx)(zg,{rows:O,tags:a,onToggle:e=>o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),onClear:()=>o([])}),(0,j.jsx)(En,{state:n,tags:a,selected:f,onSelect:e=>p(t=>t===e?null:e),busy:m!=null,act:k}),(0,j.jsxs)(`div`,{className:`nc-procs`,children:[f!=null&&(0,j.jsxs)(`div`,{style:{alignItems:`center`,color:M.textMeta,display:`flex`,fontSize:11,gap:6,marginBottom:6},children:[(0,j.jsxs)(`span`,{style:{minWidth:0,overflowWrap:`anywhere`},children:[`group: `,f,` (`,me.length,`) — dependency order`]}),(0,j.jsx)(`button`,{type:`button`,"aria-label":`clear group ${f}`,onClick:()=>p(null),style:{background:`transparent`,border:`none`,color:M.textMuted,cursor:`pointer`,fontSize:11,padding:`0 2px`},children:`×`})]}),(0,j.jsx)(ig,{rows:me,processes:n.processes,selected:ye,onSelect:be,act:k,setEnv:ve,ports:async t=>{if(e.kind!==`live`)throw Error(`Daemon is not connected`);return e.session.ports(t)}})]})]}),(0,j.jsx)(Kg,{width:ae,onChange:oe,onCommit:e=>Cg(e)}),(0,j.jsxs)(`div`,{className:`nc-logs`,children:[(0,j.jsx)(Fg,{processes:n.processes,selected:ye,onToggle:be}),(0,j.jsx)(Xh,{view:ge,runningIds:he,clearSignal:v,onSelectProc:e=>u([e])})]})]}),(0,j.jsxs)(_t,{open:S,onClose:()=>{ne.current||C(!1)},title:`Shut down ${n.configName}?`,description:`This stops all tasks and services managed by this daemon, including processes hidden by filters or groups, then exits the daemon.`,children:[(0,j.jsxs)(`p`,{children:[he.size,` active process(es). This dashboard will disconnect.`]}),(0,j.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,j.jsx)(`button`,{type:`button`,disabled:m===`shutdown`,onClick:()=>C(!1),style:Gg,children:`cancel`}),(0,j.jsx)(`button`,{type:`button`,disabled:m===`shutdown`,onClick:()=>void _e(),style:{...Gg,color:M.error},children:m===`shutdown`?`shutting down…`:`shut down daemon and all tasks`})]})]}),(0,j.jsx)(_t,{open:ee,onClose:()=>te(!1),title:`keyboard shortcuts`,description:`All keys are plain presses and never fire while typing in a field.`,children:(0,j.jsx)(`table`,{style:{borderCollapse:`collapse`,fontSize:12,width:`100%`},children:(0,j.jsx)(`tbody`,{children:Ug.map(([e,t])=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{style:{color:M.textEmphasis,padding:`3px 12px 3px 0`,whiteSpace:`nowrap`},children:(0,j.jsx)(`code`,{children:e})}),(0,j.jsx)(`td`,{style:{color:M.textMeta,padding:`3px 0`},children:t})]},e))})})})]})}var Ug=[[`/`,`focus the id filter`],[`1–9`,`toggle the nth visible process in the selection`],[`g`,`cycle group selection (then release)`],[`c`,`clear the log pane (keeps the last lines of running processes)`],[`r / s / u`,`restart / stop / start the whole selection`],[`Esc`,`close dialogs, then clear the selection, then the group`]];function Wg({link:e}){let t=e.status===`live`?`live`:e.status===`detached`?`detached`:e.hasBeenLive?`reconnecting…`:`connecting…`,n=e.status===`live`?M.success:e.status===`detached`?M.error:e.hasBeenLive?M.warning:M.textMuted;return(0,j.jsxs)(`span`,{role:`status`,title:`the live link to the daemon`,style:{alignItems:`center`,color:n,display:`inline-flex`,fontSize:11,gap:5},children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,style:{background:n,borderRadius:999,height:7,width:7}}),t]})}var Gg={background:M.surfaceHeader,border:`1px solid ${M.border}`,borderRadius:6,color:M.text,cursor:`pointer`,fontSize:12,padding:`4px 10px`};function Kg({width:e,onChange:t,onCommit:n}){let r=(0,d.useRef)(null),[i,a]=(0,d.useState)(!1),o=()=>{r.current!=null&&(r.current=null,a(!1),document.body.style.userSelect=``,n(e))};return(0,j.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`resize the process rail`,"aria-valuenow":e,"aria-valuemin":300,"aria-valuemax":780,tabIndex:0,className:`nc-gutter`,"data-dragging":i||void 0,title:`drag to resize · arrows nudge · double-click resets`,onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),r.current={startX:t.clientX,startWidth:e},a(!0),document.body.style.userSelect=`none`},onPointerMove:e=>{let n=r.current;n!=null&&t(xg(n.startWidth+e.clientX-n.startX))},onPointerUp:o,onPointerCancel:o,onLostPointerCapture:o,onDoubleClick:()=>{t(440),n(440)},onKeyDown:r=>{let i=r.key===`ArrowLeft`?-16:r.key===`ArrowRight`?16:null;if(i!=null){r.preventDefault();let a=xg(e+i);t(a),n(a)}else r.key===`Home`&&(r.preventDefault(),t(440),n(440))}})}function qg({children:e}){return(0,j.jsx)(`div`,{style:{alignItems:`center`,display:`flex`,height:`100%`,justifyContent:`center`,color:M.textMeta},children:e})}function Jg({tone:e,children:t}){return(0,j.jsx)(`div`,{style:{background:M.surfaceHeader,borderBottom:`1px solid ${M.border}`,borderLeft:`3px solid ${e}`,color:M.text,fontSize:13,padding:`8px 14px`,whiteSpace:`pre-wrap`},children:t})}var Yg=vg();Ct(Ve,{document}),document.documentElement.setAttribute(we,Yg??Ve.defaultScheme),document.documentElement.setAttribute(Te,Yg==null?`default`:`persisted`);var Xg=document.getElementById(`root`);Xg!=null&&(0,en.createRoot)(Xg).render((0,j.jsx)(d.StrictMode,{children:(0,j.jsx)(Hg,{})}));
|
|
23
|
+
//# sourceMappingURL=index-RJ2tYN8w.js.map
|